summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/menu_items/edit.html.erb12
-rw-r--r--app/views/menu_items/index.html.erb10
-rw-r--r--app/views/menu_items/new.html.erb12
-rw-r--r--app/views/page_translations/edit.html.erb32
-rw-r--r--app/views/page_translations/show.html.erb18
-rw-r--r--app/views/revisions/diff.html.erb66
-rw-r--r--app/views/revisions/index.html.erb36
-rw-r--r--app/views/revisions/show.html.erb22
-rw-r--r--config/locales/de.yml70
-rw-r--r--config/locales/en.yml70
-rw-r--r--test/controllers/revisions_controller_test.rb10
11 files changed, 242 insertions, 116 deletions
diff --git a/app/views/menu_items/edit.html.erb b/app/views/menu_items/edit.html.erb
index 89854c93..0652dc78 100644
--- a/app/views/menu_items/edit.html.erb
+++ b/app/views/menu_items/edit.html.erb
@@ -1,25 +1,25 @@
1<h1>Edit Menu Item</h1> 1<h1><%= t(".title") %></h1>
2 2
3<div id="admin_layout"> 3<div id="admin_layout">
4 <%= form_for @menu_item do |f| %> 4 <%= form_for @menu_item do |f| %>
5 <div id="content"> 5 <div id="content">
6 <div class="layout_row_label">Search</div> 6 <div class="layout_row_label"><%= t("admin.common.search") %></div>
7 <div class="layout_row_content"> 7 <div class="layout_row_content">
8 <%= text_field_tag :menu_search_term %> 8 <%= text_field_tag :menu_search_term %>
9 <div id="menu_item_search_results" class="search_results"></div> 9 <div id="menu_item_search_results" class="search_results"></div>
10 </div> 10 </div>
11 11
12 <div class="layout_row_label">Node Id</div> 12 <div class="layout_row_label"><%= MenuItem.human_attribute_name(:node_id) %></div>
13 <div class="layout_row_content"><%= f.text_field :node_id %></div> 13 <div class="layout_row_content"><%= f.text_field :node_id %></div>
14 14
15 <div class="layout_row_label">Path</div> 15 <div class="layout_row_label"><%= MenuItem.human_attribute_name(:path) %></div>
16 <div class="layout_row_content"><%= f.text_field :path %></div> 16 <div class="layout_row_content"><%= f.text_field :path %></div>
17 17
18 <div class="layout_row_label">Title</div> 18 <div class="layout_row_label"><%= MenuItem.human_attribute_name(:title) %></div>
19 <div class="layout_row_content"><%= f.text_field :title %></div> 19 <div class="layout_row_content"><%= f.text_field :title %></div>
20 20
21 <div class="layout_row_label"></div> 21 <div class="layout_row_label"></div>
22 <div class="layout_row_content"><%= f.submit 'Update' %></div> 22 <div class="layout_row_content"><%= f.submit t("admin.common.update") %></div>
23 <% end %> 23 <% end %>
24 </div> 24 </div>
25</div> 25</div>
diff --git a/app/views/menu_items/index.html.erb b/app/views/menu_items/index.html.erb
index 591eb68d..cdc60c63 100644
--- a/app/views/menu_items/index.html.erb
+++ b/app/views/menu_items/index.html.erb
@@ -1,7 +1,7 @@
1<h1>Menu Items</h1> 1<h1><%= t(".title") %></h1>
2 2
3<%= link_to new_menu_item_path, class: 'action_button' do %> 3<%= link_to new_menu_item_path, class: 'action_button' do %>
4 <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create menu item 4 <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_item") %>
5<% end %> 5<% end %>
6 6
7<table id="menu_item_list"> 7<table id="menu_item_list">
@@ -11,11 +11,11 @@
11 <div></div> 11 <div></div>
12 </td> 12 </td>
13 <td class="menu_item_title"><%= menu_item.title %></td> 13 <td class="menu_item_title"><%= menu_item.title %></td>
14 <td><%= link_to "Edit", edit_menu_item_path(menu_item) %></td> 14 <td><%= link_to t("admin.common.edit"), edit_menu_item_path(menu_item) %></td>
15 <td> 15 <td>
16 <%= button_to menu_item_path(menu_item), method: :delete, 16 <%= button_to menu_item_path(menu_item), method: :delete,
17 form: { data: { confirm: "Do you really want to destroy the menu entry?" }, class: 'button_to destructive' } do %> 17 form: { data: { confirm: t(".confirm_destroy") }, class: 'button_to destructive' } do %>
18 <%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy 18 <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.destroy") %>
19 <% end %> 19 <% end %>
20 </td> 20 </td>
21 </tr> 21 </tr>
diff --git a/app/views/menu_items/new.html.erb b/app/views/menu_items/new.html.erb
index 408ba7bd..713ac967 100644
--- a/app/views/menu_items/new.html.erb
+++ b/app/views/menu_items/new.html.erb
@@ -1,20 +1,20 @@
1<h1>Add Menu Item</h1> 1<h1><%= t(".title") %></h1>
2 2
3<%= form_for @menu_item do |f| %> 3<%= form_for @menu_item do |f| %>
4 <div class="layout_row_label">Search</div> 4 <div class="layout_row_label"><%= t("admin.common.search") %></div>
5 <div class="layout_row_content"> 5 <div class="layout_row_content">
6 <%= text_field_tag :menu_search_term %> 6 <%= text_field_tag :menu_search_term %>
7 <div id="menu_item_search_results" class="search_results"></div> 7 <div id="menu_item_search_results" class="search_results"></div>
8 </div> 8 </div>
9 9
10 <div class="layout_row_label">Node Id</div> 10 <div class="layout_row_label"><%= MenuItem.human_attribute_name(:node_id) %></div>
11 <div class="layout_row_content"><%= f.text_field :node_id %></div> 11 <div class="layout_row_content"><%= f.text_field :node_id %></div>
12 12
13 <div class="layout_row_label">Path</div> 13 <div class="layout_row_label"><%= MenuItem.human_attribute_name(:path) %></div>
14 <div class="layout_row_content"><%= f.text_field :path %></div> 14 <div class="layout_row_content"><%= f.text_field :path %></div>
15 15
16 <div class="layout_row_label">Title</div> 16 <div class="layout_row_label"><%= MenuItem.human_attribute_name(:title) %></div>
17 <div class="layout_row_content"><%= f.text_field :title %></div> 17 <div class="layout_row_content"><%= f.text_field :title %></div>
18 18
19 <div class="layout_row_content"><%= f.submit 'Create' %></div> 19 <div class="layout_row_content"><%= f.submit t("admin.common.create") %></div>
20<% end %> 20<% end %>
diff --git a/app/views/page_translations/edit.html.erb b/app/views/page_translations/edit.html.erb
index ac91d22c..f398a544 100644
--- a/app/views/page_translations/edit.html.erb
+++ b/app/views/page_translations/edit.html.erb
@@ -1,22 +1,20 @@
1<div class="translation_banner"> 1<div class="translation_banner">
2 Editing the <strong><%= @locale.to_s.upcase %></strong> translation of <strong><%= title_for_node(@node) %></strong>. 2 <%= t(".editing_prefix") %> <strong><%= @locale.to_s.upcase %></strong> <%= t(".translation_of") %> <strong><%= title_for_node(@node) %></strong>.
3</div> 3</div>
4 4
5<p class="node_action_bar standalone_action_bar"><%= link_to 'View revision history', node_revisions_path(@node, :locale => @locale) %></p> 5<p class="node_action_bar standalone_action_bar"><%= link_to t("page_translations.revision_history_link"), node_revisions_path(@node, :locale => @locale) %></p>
6 6
7<p class="field_hint"> 7<p class="field_hint">
8 Metadata such as images, tags, template, and author belong to the page 8 <%= t(".metadata_hint_prefix") %> <%= link_to t(".metadata_hint_link"), edit_node_path(@node) %>.
9 as a whole, not to a single translation — change those from the
10 <%= link_to 'default-locale editor', edit_node_path(@node) %>.
11</p> 9</p>
12 10
13<div class="node_action_bar"> 11<div class="node_action_bar">
14 <%= button_to 'Unlock + Back', unlock_node_path(@node), method: :put, 12 <%= button_to t("nodes.edit.unlock_back"), unlock_node_path(@node), method: :put,
15 form: { class: 'button_to state_changing' }, 13 form: { class: 'button_to state_changing' },
16 disabled: @node.autosave.present? %> 14 disabled: @node.autosave.present? %>
17 <%= submit_tag "Save #{@locale.to_s.upcase} translation", form: "translation_edit_form" %> 15 <%= submit_tag t(".save_translation", :lang => @locale.to_s.upcase), form: "translation_edit_form" %>
18 <%= submit_tag "Save + Unlock + Exit", name: "unlock_exit", form: "translation_edit_form" %> 16 <%= submit_tag t("nodes.edit.save_unlock_exit"), name: "unlock_exit", form: "translation_edit_form" %>
19 <%= link_to "Preview ↗", preview_page_path(@page, :locale => @locale), target: "_blank", rel: "noopener", class: "preview_link" %> 17 <%= link_to t("nodes.edit.preview"), preview_page_path(@page, :locale => @locale), target: "_blank", rel: "noopener", class: "preview_link" %>
20</div> 18</div>
21 19
22<div id="admin_layout"> 20<div id="admin_layout">
@@ -32,23 +30,23 @@
32 <%= form_with url: node_translation_path(@node, @locale), method: :patch, local: true, id: "translation_edit_form", 30 <%= form_with url: node_translation_path(@node, @locale), method: :patch, local: true, id: "translation_edit_form",
33 data: { autosave_url: autosave_node_translation_path(@node, @locale), show_url: node_path(@node) } do |f| %> 31 data: { autosave_url: autosave_node_translation_path(@node, @locale), show_url: node_path(@node) } do |f| %>
34 <div id="content"> 32 <div id="content">
35 <div class="layout_row_label">Title</div> 33 <div class="layout_row_label"><%= Page.human_attribute_name(:title) %></div>
36 <div class="layout_row_content"> 34 <div class="layout_row_content">
37 <%= text_field_tag "page[title]", @translation&.title %> 35 <%= text_field_tag "page[title]", @translation&.title %>
38 </div> 36 </div>
39 37
40 <div class="layout_row_label">Abstract</div> 38 <div class="layout_row_label"><%= Page.human_attribute_name(:abstract) %></div>
41 <div class="layout_row_content"> 39 <div class="layout_row_content">
42 <%= text_area_tag "page[abstract]", @translation&.abstract %> 40 <%= text_area_tag "page[abstract]", @translation&.abstract %>
43 </div> 41 </div>
44 42
45 <div class="layout_row_label">Body</div> 43 <div class="layout_row_label"><%= Page.human_attribute_name(:body) %></div>
46 <div class="body_toolbar_row"> 44 <div class="body_toolbar_row">
47 <button type="button" id="preview_toggle" class="view_toggle" aria-pressed="false" aria-label="Toggle live preview" title="Toggle live preview"> 45 <button type="button" id="preview_toggle" class="view_toggle" aria-pressed="false" aria-label="<%= t("admin.common.toggle_preview") %>" title="<%= t("admin.common.toggle_preview") %>">
48 <%= icon("layout-sidebar-right", library: "tabler", "aria-hidden": true) %> <span>Live preview</span> 46 <%= icon("layout-sidebar-right", library: "tabler", "aria-hidden": true) %> <span><%= t("nodes.edit.live_preview") %></span>
49 </button> 47 </button>
50 <button type="button" id="preview_force_render" class="view_toggle" style="display:none" aria-label="Force preview render" title="Force preview render"> 48 <button type="button" id="preview_force_render" class="view_toggle" style="display:none" aria-label="<%= t("admin.common.force_render") %>" title="<%= t("admin.common.force_render") %>">
51 <%= icon("refresh", library: "tabler", "aria-hidden": true) %> <span>Force refresh</span> 49 <%= icon("refresh", library: "tabler", "aria-hidden": true) %> <span><%= t("nodes.edit.force_refresh") %></span>
52 </button> 50 </button>
53 </div> 51 </div>
54 52
@@ -59,7 +57,7 @@
59 </div> 57 </div>
60 </div> 58 </div>
61 <div id="preview_panel" style="display:none"> 59 <div id="preview_panel" style="display:none">
62 <iframe id="live_preview_iframe" title="Live preview" data-src="<%= preview_page_path(@page, :locale => @locale) %>"></iframe> 60 <iframe id="live_preview_iframe" title="<%= t("nodes.edit.live_preview") %>" data-src="<%= preview_page_path(@page, :locale => @locale) %>"></iframe>
63 </div> 61 </div>
64 </div> 62 </div>
65 </div> 63 </div>
diff --git a/app/views/page_translations/show.html.erb b/app/views/page_translations/show.html.erb
index c4091fc3..0fbcd0b6 100644
--- a/app/views/page_translations/show.html.erb
+++ b/app/views/page_translations/show.html.erb
@@ -1,29 +1,29 @@
1<h1>Compare — <%= title_for_node(@node) %></h1> 1<h1><%= t(".title") %> — <%= title_for_node(@node) %></h1>
2 2
3<p class="node_action_bar standalone_action_bar"><%= link_to 'View revision history', node_revisions_path(@node, :locale => @locale) %></p> 3<p class="node_action_bar standalone_action_bar"><%= link_to t("page_translations.revision_history_link"), node_revisions_path(@node, :locale => @locale) %></p>
4 4
5<div class="translation_compare"> 5<div class="translation_compare">
6 <div class="translation_compare_column"> 6 <div class="translation_compare_column">
7 <h2><%= @locale.to_s.upcase %></h2> 7 <h2><%= @locale.to_s.upcase %></h2>
8 <div class="layout_row_label">Title</div> 8 <div class="layout_row_label"><%= Page.human_attribute_name(:title) %></div>
9 <div class="layout_row_content"><%= @translation&.title %></div> 9 <div class="layout_row_content"><%= @translation&.title %></div>
10 10
11 <div class="layout_row_label">Abstract</div> 11 <div class="layout_row_label"><%= Page.human_attribute_name(:abstract) %></div>
12 <div class="layout_row_content"><%= sanitize(@translation&.abstract.to_s) %></div> 12 <div class="layout_row_content"><%= sanitize(@translation&.abstract.to_s) %></div>
13 13
14 <div class="layout_row_label">Body</div> 14 <div class="layout_row_label"><%= Page.human_attribute_name(:body) %></div>
15 <div class="layout_row_content"><%= sanitize(@translation&.body.to_s) %></div> 15 <div class="layout_row_content"><%= sanitize(@translation&.body.to_s) %></div>
16 </div> 16 </div>
17 17
18 <div class="translation_compare_column"> 18 <div class="translation_compare_column">
19 <h2><%= I18n.default_locale.to_s.upcase %> (default)</h2> 19 <h2><%= I18n.default_locale.to_s.upcase %> (<%= t(".default_marker") %>)</h2>
20 <div class="layout_row_label">Title</div> 20 <div class="layout_row_label"><%= Page.human_attribute_name(:title) %></div>
21 <div class="layout_row_content"><%= @default_translation&.title %></div> 21 <div class="layout_row_content"><%= @default_translation&.title %></div>
22 22
23 <div class="layout_row_label">Abstract</div> 23 <div class="layout_row_label"><%= Page.human_attribute_name(:abstract) %></div>
24 <div class="layout_row_content"><%= sanitize(@default_translation&.abstract.to_s) %></div> 24 <div class="layout_row_content"><%= sanitize(@default_translation&.abstract.to_s) %></div>
25 25
26 <div class="layout_row_label">Body</div> 26 <div class="layout_row_label"><%= Page.human_attribute_name(:body) %></div>
27 <div class="layout_row_content"><%= sanitize(@default_translation&.body.to_s) %></div> 27 <div class="layout_row_content"><%= sanitize(@default_translation&.body.to_s) %></div>
28 </div> 28 </div>
29</div> 29</div>
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb
index 7e7b729e..1318bd37 100644
--- a/app/views/revisions/diff.html.erb
+++ b/app/views/revisions/diff.html.erb
@@ -1,18 +1,18 @@
1<h1>Revisions#diff</h1> 1<h1><%= t(".title") %></h1>
2 2
3<p class="node_action_bar standalone_action_bar"> 3<p class="node_action_bar standalone_action_bar">
4 <%= link_to 'Revisions', node_revisions_path(@node) %> 4 <%= link_to t(".revisions_link"), node_revisions_path(@node) %>
5</p> 5</p>
6 6
7<p class="diff_comparison_label"> 7<p class="diff_comparison_label">
8 Comparing <strong><%= describe_page_reference(params[:start_revision]) %></strong> 8 <%= t(".comparing") %> <strong><%= describe_page_reference(params[:start_revision]) %></strong>
9 against <strong><%= describe_page_reference(params[:end_revision]) %></strong> 9 <%= t(".against") %> <strong><%= describe_page_reference(params[:end_revision]) %></strong>
10 showing the <strong><%= @locale.to_s.upcase %></strong> translation 10 <%= t(".showing_prefix") %> <strong><%= @locale.to_s.upcase %></strong> <%= t(".translation_suffix") %>
11</p> 11</p>
12 12
13<% if @locale_summary.size > 1 %> 13<% if @locale_summary.size > 1 %>
14 <p class="diff_locale_toggle"> 14 <p class="diff_locale_toggle">
15 Locale: 15 <%= t("revisions.locale_label") %>
16 <% @locale_summary.each_with_index do |s, i| %> 16 <% @locale_summary.each_with_index do |s, i| %>
17 <%= " &middot; ".html_safe if i > 0 %> 17 <%= " &middot; ".html_safe if i > 0 %>
18 <% label = "#{s[:locale].to_s.upcase}#{' *' if s[:changed]}" %> 18 <% label = "#{s[:locale].to_s.upcase}#{' *' if s[:changed]}" %>
@@ -23,21 +23,21 @@
23 <% end %> 23 <% end %>
24 <% end %> 24 <% end %>
25 </p> 25 </p>
26 <p class="field_hint">* has a difference between these two versions.</p> 26 <p class="field_hint"><%= t(".changed_hint") %></p>
27<% end %> 27<% end %>
28 28
29<p class="diff_view_toggle"> 29<p class="diff_view_toggle">
30 View: 30 <%= t(".view_label") %>
31 <% if @diff_view == :inline %> 31 <% if @diff_view == :inline %>
32 <strong>Inline</strong> 32 <strong><%= t("revisions.inline") %></strong>
33 <% else %> 33 <% else %>
34 <%= link_to 'Inline', diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'inline', locale: @locale) %> 34 <%= link_to t("revisions.inline"), diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'inline', locale: @locale) %>
35 <% end %> 35 <% end %>
36 &middot; 36 &middot;
37 <% if @diff_view == :side_by_side %> 37 <% if @diff_view == :side_by_side %>
38 <strong>Side by side</strong> 38 <strong><%= t("revisions.side_by_side") %></strong>
39 <% else %> 39 <% else %>
40 <%= link_to 'Side by side', diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'side_by_side', locale: @locale) %> 40 <%= link_to t("revisions.side_by_side"), diff_node_revisions_path(@node, start_revision: params[:start_revision], end_revision: params[:end_revision], view: 'side_by_side', locale: @locale) %>
41 <% end %> 41 <% end %>
42</p> 42</p>
43 43
@@ -49,17 +49,17 @@
49 <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> 49 <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %>
50 <%= hidden_field_tag :view, @diff_view %> 50 <%= hidden_field_tag :view, @diff_view %>
51 <%= hidden_field_tag :locale, @locale %> 51 <%= hidden_field_tag :locale, @locale %>
52 <%= submit_tag 'Diff' %> 52 <%= submit_tag t(".diff_button") %>
53 <% end %> 53 <% end %>
54<% else %> 54<% else %>
55 <p class="node_action_bar standalone_action_bar"><%= link_to 'Compare two numbered revisions instead', node_revisions_path(@node) %></p> 55 <p class="node_action_bar standalone_action_bar"><%= link_to t(".compare_numbered"), node_revisions_path(@node) %></p>
56<% end %> 56<% end %>
57 57
58<% if @available_layer_pairs.present? %> 58<% if @available_layer_pairs.present? %>
59 <div class="node_action_bar standalone_action_bar"> 59 <div class="node_action_bar standalone_action_bar">
60 <% @available_layer_pairs.each do |pair| %> 60 <% @available_layer_pairs.each do |pair| %>
61 <% next if [params[:start_revision].to_s, params[:end_revision].to_s].sort == pair.map(&:to_s).sort %> 61 <% next if [params[:start_revision].to_s, params[:end_revision].to_s].sort == pair.map(&:to_s).sort %>
62 <%= button_to "Diff #{pair.first.to_s.capitalize} vs. #{pair.last.to_s.capitalize}", 62 <%= button_to t("nodes.show.diff_layers", :from => t("nodes.show.layer_#{pair.first}"), :to => t("nodes.show.layer_#{pair.last}")),
63 diff_node_revisions_path(@node), 63 diff_node_revisions_path(@node),
64 method: :get, 64 method: :get,
65 params: { start_revision: pair.first, end_revision: pair.last, view: @diff_view, locale: @locale }, 65 params: { start_revision: pair.first, end_revision: pair.last, view: @diff_view, locale: @locale },
@@ -68,9 +68,9 @@
68 <% if !@locked_by_other && (@node.autosave || @node.draft) %> 68 <% if !@locked_by_other && (@node.autosave || @node.draft) %>
69 <%= button_to revert_node_path(@node), method: :put, 69 <%= button_to revert_node_path(@node), method: :put,
70 params: { return_to: request.fullpath }, 70 params: { return_to: request.fullpath },
71 form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } do %> 71 form: { data: { confirm: t("admin.common.confirm_irreversible") }, class: 'button_to destructive' } do %>
72 <%= icon("trash", library: "tabler", "aria-hidden": true) %> 72 <%= icon("trash", library: "tabler", "aria-hidden": true) %>
73 <%= @node.draft && !@node.autosave ? "Destroy Draft" : "Discard Autosave" %> 73 <%= @node.draft && !@node.autosave ? t("nodes.show.destroy_draft") : t("nodes.show.discard_autosave") %>
74 <% end %> 74 <% end %>
75 <% end %> 75 <% end %>
76 </div> 76 </div>
@@ -80,34 +80,34 @@
80 <% if @diff_view == :side_by_side %> 80 <% if @diff_view == :side_by_side %>
81 <div class="diff_side_by_side"> 81 <div class="diff_side_by_side">
82 <div class="diff_column"> 82 <div class="diff_column">
83 <h3>Title</h3> 83 <h3><%= Page.human_attribute_name(:title) %></h3>
84 <p><%= raw @diff[:title][0] %></p> 84 <p><%= raw @diff[:title][0] %></p>
85 <h3>Abstract</h3> 85 <h3><%= Page.human_attribute_name(:abstract) %></h3>
86 <p><%= raw @diff[:abstract][0] %></p> 86 <p><%= raw @diff[:abstract][0] %></p>
87 <h3>Body</h3> 87 <h3><%= Page.human_attribute_name(:body) %></h3>
88 <%= raw @diff[:body][0] %> 88 <%= raw @diff[:body][0] %>
89 </div> 89 </div>
90 <div class="diff_column"> 90 <div class="diff_column">
91 <h3>Title</h3> 91 <h3><%= Page.human_attribute_name(:title) %></h3>
92 <p><%= raw @diff[:title][1] %></p> 92 <p><%= raw @diff[:title][1] %></p>
93 <h3>Abstract</h3> 93 <h3><%= Page.human_attribute_name(:abstract) %></h3>
94 <p><%= raw @diff[:abstract][1] %></p> 94 <p><%= raw @diff[:abstract][1] %></p>
95 <h3>Body</h3> 95 <h3><%= Page.human_attribute_name(:body) %></h3>
96 <%= raw @diff[:body][1] %> 96 <%= raw @diff[:body][1] %>
97 </div> 97 </div>
98 </div> 98 </div>
99 <% else %> 99 <% else %>
100 <h3>Title</h3> 100 <h3><%= Page.human_attribute_name(:title) %></h3>
101 <p><%= raw @diff[:title] %></p> 101 <p><%= raw @diff[:title] %></p>
102 <h3>Abstract</h3> 102 <h3><%= Page.human_attribute_name(:abstract) %></h3>
103 <p><%= raw @diff[:abstract] %></p> 103 <p><%= raw @diff[:abstract] %></p>
104 <h3>Body</h3> 104 <h3><%= Page.human_attribute_name(:body) %></h3>
105 <%= raw @diff[:body] %> 105 <%= raw @diff[:body] %>
106 <% end %> 106 <% end %>
107 107
108 <h3>Tags</h3> 108 <h3><%= Page.human_attribute_name(:tag_list) %></h3>
109 <% if @diff[:tags][:added].empty? && @diff[:tags][:removed].empty? %> 109 <% if @diff[:tags][:added].empty? && @diff[:tags][:removed].empty? %>
110 <p class="diff_unchanged">No change.</p> 110 <p class="diff_unchanged"><%= t(".no_change") %></p>
111 <% else %> 111 <% else %>
112 <ul class="diff_set_list"> 112 <ul class="diff_set_list">
113 <% @diff[:tags][:added].each do |tag| %><li><ins><%= tag %></ins></li><% end %> 113 <% @diff[:tags][:added].each do |tag| %><li><ins><%= tag %></ins></li><% end %>
@@ -115,16 +115,16 @@
115 </ul> 115 </ul>
116 <% end %> 116 <% end %>
117 117
118 <h3>Template</h3> 118 <h3><%= Page.human_attribute_name(:template_name) %></h3>
119 <% if @diff[:template_name][:changed] %> 119 <% if @diff[:template_name][:changed] %>
120 <p><del><%= @diff[:template_name][:from] || '(none)' %></del> <ins><%= @diff[:template_name][:to] || '(none)' %></ins></p> 120 <p><del><%= @diff[:template_name][:from] || t(".none_marker") %></del> <ins><%= @diff[:template_name][:to] || t(".none_marker") %></ins></p>
121 <% else %> 121 <% else %>
122 <p class="diff_unchanged">No change.</p> 122 <p class="diff_unchanged"><%= t(".no_change") %></p>
123 <% end %> 123 <% end %>
124 124
125 <h3>Assets</h3> 125 <h3><%= Page.human_attribute_name(:assets) %></h3>
126 <% if @diff[:assets][:added].empty? && @diff[:assets][:removed].empty? %> 126 <% if @diff[:assets][:added].empty? && @diff[:assets][:removed].empty? %>
127 <p class="diff_unchanged">No change.</p> 127 <p class="diff_unchanged"><%= t(".no_change") %></p>
128 <% else %> 128 <% else %>
129 <ul class="diff_set_list"> 129 <ul class="diff_set_list">
130 <% @diff[:assets][:added].each do |asset| %><li><ins><%= asset.upload_file_name %></ins></li><% end %> 130 <% @diff[:assets][:added].each do |asset| %><li><ins><%= asset.upload_file_name %></ins></li><% end %>
diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb
index 7ea74a6c..6bcf1820 100644
--- a/app/views/revisions/index.html.erb
+++ b/app/views/revisions/index.html.erb
@@ -1,12 +1,12 @@
1<h2>Revisions for Node: <%= @node.unique_name %></h2> 1<h2><%= t(".title", :path => @node.unique_name) %></h2>
2 2
3<p class="node_action_bar standalone_action_bar"> 3<p class="node_action_bar standalone_action_bar">
4 <%= link_to 'Back to node', node_path(@node) %> 4 <%= link_to t(".back_to_node"), node_path(@node) %>
5</p> 5</p>
6 6
7<% if Page.non_default_locales.any? %> 7<% if Page.non_default_locales.any? %>
8 <p class="diff_locale_toggle"> 8 <p class="diff_locale_toggle">
9 Locale: 9 <%= t("revisions.locale_label") %>
10 <% ([I18n.default_locale] + Page.non_default_locales).each_with_index do |locale, i| %> 10 <% ([I18n.default_locale] + Page.non_default_locales).each_with_index do |locale, i| %>
11 <%= " &middot; ".html_safe if i > 0 %> 11 <%= " &middot; ".html_safe if i > 0 %>
12 <% if locale == @locale %> 12 <% if locale == @locale %>
@@ -21,25 +21,25 @@
21<table id="revisions" class="revisions_table"> 21<table id="revisions" class="revisions_table">
22 <thead> 22 <thead>
23 <tr class="header"> 23 <tr class="header">
24 <th>First</th> 24 <th><%= t(".first") %></th>
25 <th>Last</th> 25 <th><%= t(".last") %></th>
26 <th>Rev.</th> 26 <th><%= t("admin.columns.rev") %></th>
27 <th>Title</th> 27 <th><%= t("admin.columns.title") %></th>
28 <th>Editor</th> 28 <th><%= t("admin.columns.editor") %></th>
29 <th>Date</th> 29 <th><%= t("admin.columns.date") %></th>
30 <th></th> 30 <th></th>
31 <th></th> 31 <th></th>
32 </tr> 32 </tr>
33 <tr class="no_hover diff_sticky_bar"> 33 <tr class="no_hover diff_sticky_bar">
34 <td colspan="8"> 34 <td colspan="8">
35 <%= button_to 'Diff revisions', diff_node_revisions_path(@node), 35 <%= button_to t(".diff_revisions"), diff_node_revisions_path(@node),
36 method: :post, 36 method: :post,
37 params: { locale: @locale }, 37 params: { locale: @locale },
38 form: { id: 'diff_form', class: 'button_to computation' }, 38 form: { id: 'diff_form', class: 'button_to computation' },
39 disabled: true %> 39 disabled: true %>
40 <span id="diff_selection_label"></span> 40 <span id="diff_selection_label" data-against="<%= t(".against_word") %>" data-selected="<%= t(".selected_word") %>"></span>
41 <label><%= radio_button_tag :view, 'inline', true %> Inline</label> 41 <label><%= radio_button_tag :view, 'inline', true %> <%= t("revisions.inline") %></label>
42 <label><%= radio_button_tag :view, 'side_by_side', false %> Side by side</label> 42 <label><%= radio_button_tag :view, 'side_by_side', false %> <%= t("revisions.side_by_side") %></label>
43 </td> 43 </td>
44 </tr> 44 </tr>
45 </thead> 45 </thead>
@@ -53,11 +53,11 @@
53 <td class="title"><%= page.translations.find_by(:locale => @locale)&.title || "—" %></td> 53 <td class="title"><%= page.translations.find_by(:locale => @locale)&.title || "—" %></td>
54 <td class="user"><%= page.editor.try(:login) %></td> 54 <td class="user"><%= page.editor.try(:login) %></td>
55 <td class="date"><%= page.updated_at %></td> 55 <td class="date"><%= page.updated_at %></td>
56 <td><%= link_to 'show', node_revision_path(@node, page, :locale => @locale) %></td> 56 <td><%= link_to t(".show_link"), node_revision_path(@node, page, :locale => @locale) %></td>
57 <td> 57 <td>
58 <%= button_to 'restore', restore_node_revision_path(@node, page), 58 <%= button_to t(".restore_link"), restore_node_revision_path(@node, page),
59 method: :put, 59 method: :put,
60 form: { data: { confirm: "Restore this revision?" }, class: 'button_to state_changing' } %> 60 form: { data: { confirm: t(".confirm_restore") }, class: 'button_to state_changing' } %>
61 </td> 61 </td>
62 </tr> 62 </tr>
63 <% end %> 63 <% end %>
@@ -73,9 +73,9 @@
73 73
74 var label = document.getElementById('diff_selection_label'); 74 var label = document.getElementById('diff_selection_label');
75 if (start && end) { 75 if (start && end) {
76 label.textContent = start.value + ' against ' + end.value; 76 label.textContent = start.value + ' ' + label.dataset.against + ' ' + end.value;
77 } else if (start || end) { 77 } else if (start || end) {
78 label.textContent = (start || end).value + ' selected'; 78 label.textContent = (start || end).value + ' ' + label.dataset.selected;
79 } else { 79 } else {
80 label.textContent = ''; 80 label.textContent = '';
81 } 81 }
diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb
index 64bc0eea..a39071c6 100644
--- a/app/views/revisions/show.html.erb
+++ b/app/views/revisions/show.html.erb
@@ -1,39 +1,39 @@
1<% translation = @page.translations.find_by(:locale => @locale) %> 1<% translation = @page.translations.find_by(:locale => @locale) %>
2<div id="admin_layout" class="show_node"> 2<div id="admin_layout" class="show_node">
3 <h1>Revision <%= @page.revision %>: <%= translation&.title %> <small>(<%= @locale.to_s.upcase %>)</small></h1> 3 <h1><%= t(".title", :rev => @page.revision) %>: <%= translation&.title %> <small>(<%= @locale.to_s.upcase %>)</small></h1>
4 4
5 <div id="content"> 5 <div id="content">
6 <div class="layout_row_label">Actions</div> 6 <div class="layout_row_label"><%= t("admin.columns.actions") %></div>
7 <div class="layout_row_content info_group"> 7 <div class="layout_row_content info_group">
8 <div class="info_group_items"> 8 <div class="info_group_items">
9 <div class="info_item"> 9 <div class="info_item">
10 <%= link_to 'Show all revisions', node_revisions_path(@node, :locale => @locale) %> 10 <%= link_to t(".show_all"), node_revisions_path(@node, :locale => @locale) %>
11 </div> 11 </div>
12 </div> 12 </div>
13 </div> 13 </div>
14 14
15 <div class="layout_row_label">Path</div> 15 <div class="layout_row_label"><%= t("admin.columns.path") %></div>
16 <div class="layout_row_content"><%= @page.public_link %></div> 16 <div class="layout_row_content"><%= @page.public_link %></div>
17 17
18 <div class="layout_row_label">Author</div> 18 <div class="layout_row_label"><%= t("admin.columns.author") %></div>
19 <div class="layout_row_content"><%= @page.user.try(:login) %></div> 19 <div class="layout_row_content"><%= @page.user.try(:login) %></div>
20 20
21 <div class="layout_row_label">Editor</div> 21 <div class="layout_row_label"><%= t("admin.columns.editor") %></div>
22 <div class="layout_row_content"><%= @page.editor.try(:login) %></div> 22 <div class="layout_row_content"><%= @page.editor.try(:login) %></div>
23 23
24 <div class="layout_row_label">Last updated</div> 24 <div class="layout_row_label"><%= t("nodes.show.last_updated") %></div>
25 <div class="layout_row_content"><%= @page.updated_at %></div> 25 <div class="layout_row_content"><%= @page.updated_at %></div>
26 26
27 <div class="layout_row_label">Published at</div> 27 <div class="layout_row_label"><%= t("nodes.show.published_at") %></div>
28 <div class="layout_row_content"><%= @page.published_at %></div> 28 <div class="layout_row_content"><%= @page.published_at %></div>
29 29
30 <div class="layout_row_label">Title</div> 30 <div class="layout_row_label"><%= Page.human_attribute_name(:title) %></div>
31 <div class="layout_row_content"><%= translation&.title %></div> 31 <div class="layout_row_content"><%= translation&.title %></div>
32 32
33 <div class="layout_row_label">Abstract</div> 33 <div class="layout_row_label"><%= Page.human_attribute_name(:abstract) %></div>
34 <div class="layout_row_content"><%= translation&.abstract %></div> 34 <div class="layout_row_content"><%= translation&.abstract %></div>
35 35
36 <div class="layout_row_label">Body</div> 36 <div class="layout_row_label"><%= Page.human_attribute_name(:body) %></div>
37 <div class="layout_row_content"><%= raw translation&.body %></div> 37 <div class="layout_row_content"><%= raw translation&.body %></div>
38 </div> 38 </div>
39</div> 39</div>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 8a8a9a40..0ffc6ecc 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -103,6 +103,17 @@ de:
103 tag_list: "Tags" 103 tag_list: "Tags"
104 latitude: "Breitengrad" 104 latitude: "Breitengrad"
105 longitude: "Längengrad" 105 longitude: "Längengrad"
106 page:
107 title: "Titel"
108 abstract: "Abstract"
109 body: "Text"
110 tag_list: "Tags"
111 template_name: "Template"
112 assets: "Anhänge"
113 menu_item:
114 node_id: "Node-ID"
115 path: "Pfad"
116 title: "Titel"
106 117
107 tags: 118 tags:
108 index: 119 index:
@@ -247,6 +258,8 @@ de:
247 path: "Pfad" 258 path: "Pfad"
248 preview: "Vorschau" 259 preview: "Vorschau"
249 name: "Name" 260 name: "Name"
261 editor: "Editor"
262 date: "Datum"
250 author: "Autor" 263 author: "Autor"
251 type: "Typ" 264 type: "Typ"
252 menu: 265 menu:
@@ -505,9 +518,6 @@ de:
505 created: "Termin wurde angelegt." 518 created: "Termin wurde angelegt."
506 updated: "Termin wurde aktualisiert." 519 updated: "Termin wurde aktualisiert."
507 tag_prefilled: "Tag '%{tag}' wurde vorausgefüllt, weil diese Seite mit '%{source}' getaggt ist. Er lässt sich unten entfernen." 520 tag_prefilled: "Tag '%{tag}' wurde vorausgefüllt, weil diese Seite mit '%{source}' getaggt ist. Er lässt sich unten entfernen."
508 occurrences:
509 created: "Termin-Instanz wurde angelegt."
510 updated: "Termin-Instanz wurde aktualisiert."
511 revisions: 521 revisions:
512 unavailable: "Dieser Vergleich ist nicht mehr verfügbar." 522 unavailable: "Dieser Vergleich ist nicht mehr verfügbar."
513 restored: "Revision %{rev} wiederhergestellt" 523 restored: "Revision %{rev} wiederhergestellt"
@@ -565,6 +575,60 @@ de:
565 as_headline: "als Aufmacher der Seite anhängen" 575 as_headline: "als Aufmacher der Seite anhängen"
566 headline_hint: "Gilt nur, wenn die Seite noch keinen Aufmacher hat." 576 headline_hint: "Gilt nur, wenn die Seite noch keinen Aufmacher hat."
567 577
578 revisions:
579 locale_label: "Sprache:"
580 inline: "Inline"
581 side_by_side: "Nebeneinander"
582 diff:
583 title: "Revisionen vergleichen"
584 revisions_link: "Revisionen"
585 comparing: "Vergleiche"
586 against: "mit"
587 showing_prefix: "— gezeigt wird die"
588 translation_suffix: "Übersetzung"
589 changed_hint: "* unterscheidet sich zwischen diesen beiden Versionen."
590 view_label: "Ansicht:"
591 diff_button: "Diff"
592 compare_numbered: "Stattdessen zwei nummerierte Revisionen vergleichen"
593 none_marker: "(keins)"
594 no_change: "Keine Änderung."
595 index:
596 title: "Revisionen für Node: %{path}"
597 back_to_node: "Zurück zum Node"
598 first: "Von"
599 last: "Bis"
600 diff_revisions: "Revisionen vergleichen"
601 against_word: "mit"
602 selected_word: "ausgewählt"
603 show_link: "anzeigen"
604 restore_link: "wiederherstellen"
605 confirm_restore: "Diese Revision wiederherstellen?"
606 show:
607 title: "Revision %{rev}"
608 show_all: "Alle Revisionen anzeigen"
609
610 page_translations:
611 revision_history_link: "Revisionsübersicht anzeigen"
612 edit:
613 editing_prefix: "Bearbeite die"
614 translation_of: "Übersetzung von"
615 metadata_hint_prefix: "Metadaten wie Bilder, Tags, Template und Autor gehören zur Seite als Ganzes, nicht zu einer einzelnen Übersetzung — ändere sie im"
616 metadata_hint_link: "Editor der Standardsprache"
617 save_translation: "%{lang}-Übersetzung speichern"
618 show:
619 title: "Vergleich"
620 default_marker: "Standard"
621
622 menu_items:
623 index:
624 title: "Menüeinträge"
625 create_item: "Menüeintrag anlegen"
626 confirm_destroy: "Diesen Menüeintrag wirklich löschen?"
627 new:
628 title: "Menüeintrag hinzufügen"
629 edit:
630 title: "Menüeintrag bearbeiten"
631
568 layouts: 632 layouts:
569 flash: 633 flash:
570 go_to_status: "Zum Status" 634 go_to_status: "Zum Status"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 44b1615b..5f2f266a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -55,6 +55,17 @@ en:
55 tag_list: "Tags" 55 tag_list: "Tags"
56 latitude: "Latitude" 56 latitude: "Latitude"
57 longitude: "Longitude" 57 longitude: "Longitude"
58 page:
59 title: "Title"
60 abstract: "Abstract"
61 body: "Body"
62 tag_list: "Tags"
63 template_name: "Template"
64 assets: "Assets"
65 menu_item:
66 node_id: "Node Id"
67 path: "Path"
68 title: "Title"
58 69
59 tags: 70 tags:
60 index: 71 index:
@@ -200,6 +211,8 @@ en:
200 preview: "Preview" 211 preview: "Preview"
201 name: "Name" 212 name: "Name"
202 author: "Author" 213 author: "Author"
214 editor: "Editor"
215 date: "Date"
203 type: "Type" 216 type: "Type"
204 menu: 217 menu:
205 dashboard: "Dashboard" 218 dashboard: "Dashboard"
@@ -422,6 +435,16 @@ en:
422 new: 435 new:
423 title: "New event" 436 title: "New event"
424 437
438 menu_items:
439 index:
440 title: "Menu Items"
441 create_item: "Create menu item"
442 confirm_destroy: "Do you really want to destroy the menu entry?"
443 new:
444 title: "Add Menu Item"
445 edit:
446 title: "Edit Menu Item"
447
425 flash: 448 flash:
426 common: 449 common:
427 logged_in: "Logged in successfully" 450 logged_in: "Logged in successfully"
@@ -456,9 +479,6 @@ en:
456 created: "Event was successfully created." 479 created: "Event was successfully created."
457 updated: "Event was successfully updated." 480 updated: "Event was successfully updated."
458 tag_prefilled: "Tag '%{tag}' was pre-filled because this page is tagged '%{source}'. You can remove it below." 481 tag_prefilled: "Tag '%{tag}' was pre-filled because this page is tagged '%{source}'. You can remove it below."
459 occurrences:
460 created: "Occurrence was successfully created."
461 updated: "Occurrence was successfully updated."
462 revisions: 482 revisions:
463 unavailable: "That comparison is no longer available." 483 unavailable: "That comparison is no longer available."
464 restored: "Revision %{rev} restored" 484 restored: "Revision %{rev} restored"
@@ -516,6 +536,50 @@ en:
516 as_headline: "attach as the page's headline" 536 as_headline: "attach as the page's headline"
517 headline_hint: "Applies only if the page has no headline yet." 537 headline_hint: "Applies only if the page has no headline yet."
518 538
539 revisions:
540 locale_label: "Locale:"
541 inline: "Inline"
542 side_by_side: "Side by side"
543 diff:
544 title: "Compare revisions"
545 revisions_link: "Revisions"
546 comparing: "Comparing"
547 against: "against"
548 showing_prefix: "— showing the"
549 translation_suffix: "translation"
550 changed_hint: "* has a difference between these two versions."
551 view_label: "View:"
552 diff_button: "Diff"
553 compare_numbered: "Compare two numbered revisions instead"
554 none_marker: "(none)"
555 no_change: "No change."
556 index:
557 title: "Revisions for Node: %{path}"
558 back_to_node: "Back to node"
559 first: "First"
560 last: "Last"
561 diff_revisions: "Diff revisions"
562 against_word: "against"
563 selected_word: "selected"
564 show_link: "show"
565 restore_link: "restore"
566 confirm_restore: "Restore this revision?"
567 show:
568 title: "Revision %{rev}"
569 show_all: "Show all revisions"
570
571 page_translations:
572 revision_history_link: "View revision history"
573 edit:
574 editing_prefix: "Editing the"
575 translation_of: "translation of"
576 metadata_hint_prefix: "Metadata such as images, tags, template, and author belong to the page as a whole, not to a single translation — change those from the"
577 metadata_hint_link: "default-locale editor"
578 save_translation: "Save %{lang} translation"
579 show:
580 title: "Compare"
581 default_marker: "default"
582
519 layouts: 583 layouts:
520 flash: 584 flash:
521 go_to_status: "Go to Status" 585 go_to_status: "Go to Status"
diff --git a/test/controllers/revisions_controller_test.rb b/test/controllers/revisions_controller_test.rb
index bb21ea68..8311735c 100644
--- a/test/controllers/revisions_controller_test.rb
+++ b/test/controllers/revisions_controller_test.rb
@@ -33,7 +33,7 @@ class RevisionsControllerTest < ActionController::TestCase
33 login_as :quentin 33 login_as :quentin
34 get :show, params: { :node_id => @node.id, :id => @node.pages.last.id } 34 get :show, params: { :node_id => @node.id, :id => @node.pages.last.id }
35 assert_response :success 35 assert_response :success
36 assert_select ".layout_row_label", "Body" 36 assert_select ".layout_row_label", Page.human_attribute_name(:body)
37 assert_select ".layout_row_content", {:count => 1, :text => "second"} 37 assert_select ".layout_row_content", {:count => 1, :text => "second"}
38 end 38 end
39 39
@@ -146,7 +146,7 @@ class RevisionsControllerTest < ActionController::TestCase
146 146
147 post(:diff, params: { :node_id => @node.id, :start_revision => "head", :end_revision => "draft" }) 147 post(:diff, params: { :node_id => @node.id, :start_revision => "head", :end_revision => "draft" })
148 assert_response :success 148 assert_response :success
149 assert_select "a", "Side by side" 149 assert_select "a", I18n.t("revisions.side_by_side")
150 end 150 end
151 151
152 test "diffing two revisions also shows tag, template, and asset changes" do 152 test "diffing two revisions also shows tag, template, and asset changes" do
@@ -157,9 +157,9 @@ class RevisionsControllerTest < ActionController::TestCase
157 157
158 post(:diff, params: { :node_id => @node.id, :start_revision => @node.pages.first.revision, :end_revision => @node.pages.last.revision }) 158 post(:diff, params: { :node_id => @node.id, :start_revision => @node.pages.first.revision, :end_revision => @node.pages.last.revision })
159 assert_response :success 159 assert_response :success
160 assert_select "h3", "Tags" 160 assert_select "h3", Page.human_attribute_name(:tag_list)
161 assert_select "h3", "Template" 161 assert_select "h3", Page.human_attribute_name(:template_name)
162 assert_select "h3", "Assets" 162 assert_select "h3", Page.human_attribute_name(:assets)
163 end 163 end
164 164
165 test "revisions#index links back to the node" do 165 test "revisions#index links back to the node" do