Files
nairobi/db/pages/accessibility.rb
Javi Martín 7782ed73b6 Remove unneeded _html suffix
Although this translation has HTML, we aren't marking them as HTML safe
since we're using `I18n.t` instead of Rails' helper `t` method. So using
the `_html` suffix is counterintuitive in this case.
2019-10-09 19:46:47 +02:00

97 lines
4.0 KiB
Ruby

if SiteCustomization::Page.find_by_slug("accessibility").nil?
page = SiteCustomization::Page.new(slug: "accessibility", status: "published")
page.title = I18n.t("pages.accessibility.title")
content = ""
I18n.t("pages.accessibility.description").each_line do |line|
content << "<p>#{line}</p>"
end
content << "<ul>"
I18n.t("pages.accessibility.examples").each do |example|
content << "<li>#{example}</li>"
end
content << "</ul>
<h2>#{I18n.t("pages.accessibility.keyboard_shortcuts.title")}</h2>
<p>#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.description")}</p>
<table>
<caption class='show-for-sr'>
#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.caption")}
</caption>
<thead>
<tr>
<th scope='col' class='text-center'>
#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.key_header")}
</th>
<th scope='col'>
#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.page_header")}
</th>
</tr>
</thead>
<tbody>"
I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.rows").each do |row|
content << " <tr>
<td class='text-center'>#{row[:key_column]}</td>
<td>#{row[:page_column]}</td>
</tr>"
end
content << " </tbody>
</table>
<p>#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.description")}</p>
<table>
<caption class='show-for-sr'>
#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.caption")}
</caption>
<thead>
<tr>
<th scope='col'>
#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.browser_header")}
</th>
<th scope='col'>
#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.key_header")}
</th>
</tr>
</thead>
<tbody>"
I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.rows").each do |row|
content << " <tr>
<td>#{row[:browser_column]}</td>
<td>#{row[:key_column]}</td>
</tr>"
end
content << " </tbody>
</table>
<h2>#{I18n.t("pages.accessibility.textsize.title")}</h2>
<p>#{I18n.t("pages.accessibility.textsize.browser_settings_table.description")}</p>
<table>
<thead>
<tr>
<th scope='col'>
#{I18n.t("pages.accessibility.textsize.browser_settings_table.browser_header")}
</th>
<th scope='col'>
#{I18n.t("pages.accessibility.textsize.browser_settings_table.action_header")}
</th>
</tr>
</thead>
<tbody>"
I18n.t("pages.accessibility.textsize.browser_settings_table.rows").each do |row|
content << " <tr>
<td>#{row[:browser_column]}</td>
<td>#{row[:action_column]}</td>
</tr>"
end
content << " </tbody>
</table>"
content << "<p>#{I18n.t("pages.accessibility.textsize.browser_shortcuts_table.description")}</p>
<ul>"
I18n.t("pages.accessibility.textsize.browser_shortcuts_table.rows").each do |row|
content << "<li><strong>#{row[:shortcut_column]}</strong> #{row[:description_column]}</li>"
end
content << "</ul>
<h2>#{I18n.t("pages.accessibility.compatibility.title")}</h2>
<p>#{I18n.t("pages.accessibility.compatibility.description")}</p>"
page.content = content
page.save!
end