summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/revisions/index.html.erb138
-rw-r--r--config/locales/de.yml1
-rw-r--r--config/locales/en.yml1
-rw-r--r--public/stylesheets/admin.css15
-rw-r--r--test/controllers/revisions_controller_test.rb2
5 files changed, 83 insertions, 74 deletions
diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb
index 4f854518..08273749 100644
--- a/app/views/revisions/index.html.erb
+++ b/app/views/revisions/index.html.erb
@@ -1,68 +1,80 @@
1<h2><%= t(".title", :path => @node.unique_name) %></h2> 1<div class="admin_layout">
2 <h1><%= t(".title", :path => @node.unique_name) %></h1>
2 3
3<p class="node_action_bar"> 4 <p class="node_action_bar">
4 <%= link_to t(".back_to_node"), node_path(@node) %> 5 <%= link_to t(".back_to_node"), node_path(@node) %>
5</p>
6
7<% if Page.non_default_locales.any? %>
8 <p class="diff_locale_toggle">
9 <%= t("revisions.locale_label") %>
10 <% ([I18n.default_locale] + Page.non_default_locales).each_with_index do |locale, i| %>
11 <%= " &middot; ".html_safe if i > 0 %>
12 <% if locale == @translation_locale %>
13 <strong><%= locale.to_s.upcase %></strong>
14 <% else %>
15 <%= link_to locale.to_s.upcase, node_revisions_path(@node, :translation_locale => locale) %>
16 <% end %>
17 <% end %>
18 </p> 6 </p>
19<% end %>
20
21<% pages = (@pages || @node.pages.all).reverse %>
22 7
23<table id="revisions" class="admin_table revisions_table"> 8 <% if Page.non_default_locales.any? %>
24 <thead> 9 <p class="diff_locale_toggle">
25 <tr class="header"> 10 <%= t("revisions.locale_label") %>
26 <th><%= t("admin.columns.rev") %></th> 11 <% ([I18n.default_locale] + Page.non_default_locales).each_with_index do |locale, i| %>
27 <th><%= t("admin.columns.title") %></th> 12 <%= " &middot; ".html_safe if i > 0 %>
28 <th><%= t("admin.columns.editor") %></th> 13 <% if locale == @translation_locale %>
29 <th><%= t("admin.columns.date") %></th> 14 <strong><%= locale.to_s.upcase %></strong>
30 <th></th> 15 <% else %>
31 <th></th> 16 <%= link_to locale.to_s.upcase, node_revisions_path(@node, :translation_locale => locale) %>
32 </tr>
33 <tr class="diff_sticky_bar">
34 <td colspan="6">
35 <%= form_tag diff_node_revisions_path(@node), :method => :post,
36 :id => "diff_form", :class => "button_to computation" do %>
37 <%= hidden_field_tag :translation_locale, @translation_locale %>
38 <%= hidden_field_tag :start_revision, pages[1]&.revision %>
39 <%= hidden_field_tag :end_revision, pages[0]&.revision %>
40 <%= submit_tag t(".diff_revisions") %>
41 <span id="diff_selection_label" aria-live="polite">
42 <%= t(".diff_selection_html",
43 :from => tag.span(:id => "diff_from"),
44 :to => tag.span(:id => "diff_to")) %>
45 </span>
46 <label><%= radio_button_tag :view, 'inline', true %> <%= t("revisions.inline") %></label>
47 <label><%= radio_button_tag :view, 'side_by_side', false %> <%= t("revisions.side_by_side") %></label>
48 <% end %> 17 <% end %>
49 </td> 18 <% end %>
50 </tr> 19 </p>
51 </thead>
52 <tbody>
53 <% pages.each do |page| %>
54 <tr data-revision="<%= page.revision %>" tabindex="0" aria-pressed="false">
55 <td class="revision"><%= page.revision %></td>
56 <td class="title"><%= page.translations.find_by(:locale => @translation_locale)&.title || "—" %></td>
57 <td class="user"><%= page.editor.try(:login) %></td>
58 <td class="date"><%= admin_datetime(page.updated_at) %></td>
59 <td><%= link_to t(".show_link"), node_revision_path(@node, page, :translation_locale => @translation_locale) %></td>
60 <td>
61 <%= button_to t(".restore_link"), restore_node_revision_path(@node, page),
62 method: :put,
63 form: { data: { confirm: t(".confirm_restore") }, class: 'button_to state_changing' } %>
64 </td>
65 </tr>
66 <% end %> 20 <% end %>
67 </tbody> 21
68</table> 22 <% pages = (@pages || @node.pages.all).reverse %>
23
24 <table id="revisions" class="admin_table revisions_table">
25 <thead>
26 <tr class="diff_sticky_bar">
27 <td colspan="2">
28 <%= form_tag diff_node_revisions_path(@node), :method => :post,
29 :id => "diff_form", :class => "button_to computation" do %>
30 <%= hidden_field_tag :translation_locale, @translation_locale %>
31 <%= hidden_field_tag :start_revision, pages[1]&.revision %>
32 <%= hidden_field_tag :end_revision, pages[0]&.revision %>
33 <%= submit_tag t(".diff_revisions") %>
34 <span id="diff_selection_label" aria-live="polite">
35 <%= t(".diff_selection_html",
36 :from => tag.span(:id => "diff_from"),
37 :to => tag.span(:id => "diff_to")) %>
38 </span>
39 <label><%= radio_button_tag :view, 'inline', true %> <%= t("revisions.inline") %></label>
40 <label><%= radio_button_tag :view, 'side_by_side', false %> <%= t("revisions.side_by_side") %></label>
41 <% end %>
42 </td>
43 </tr>
44 </thead>
45 <tbody>
46 <% pages.each do |page| %>
47 <tr data-revision="<%= page.revision %>" tabindex="0" aria-pressed="false">
48 <td class="title">
49 <div class="row_primary">
50 <%= page.translations.find_by(:locale => @translation_locale)&.title || "—" %>
51 </div>
52 <div class="row_secondary">
53 <%= t(".row_meta", :date => admin_datetime(page.updated_at),
54 :rev => page.revision,
55 :editor => page.editor.try(:login) || t("admin.common.unknown")) %>
56 </div>
57 </td>
58 <td class="actions">
59 <div class="action_grid">
60 <span class="action_item">
61 <%= link_to node_revision_path(@node, page, :translation_locale => @translation_locale),
62 "aria-label" => t(".show_link"), title: t(".show_link") do %>
63 <%= icon("eye", library: "tabler", "aria-hidden": true) %>
64 <% end %>
65 </span>
66 <span class="action_item">
67 <%= button_to restore_node_revision_path(@node, page), method: :put,
68 form: { data: { confirm: t(".confirm_restore") },
69 class: 'button_to state_changing' },
70 "aria-label" => t(".restore_link"), title: t(".restore_link") do %>
71 <%= icon("arrow-back-up", library: "tabler", "aria-hidden": true) %>
72 <% end %>
73 </span>
74 </div>
75 </td>
76 </tr>
77 <% end %>
78 </tbody>
79 </table>
80</div>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 35f262cc..1bab646b 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -758,6 +758,7 @@ de:
758 last: "Bis" 758 last: "Bis"
759 diff_revisions: "Revisionen vergleichen" 759 diff_revisions: "Revisionen vergleichen"
760 diff_selection_html: "Vergleicht %{from} mit %{to}" 760 diff_selection_html: "Vergleicht %{from} mit %{to}"
761 row_meta: "%{date}, Rev %{rev}, von %{editor}"
761 show_link: "anzeigen" 762 show_link: "anzeigen"
762 restore_link: "wiederherstellen" 763 restore_link: "wiederherstellen"
763 confirm_restore: "Diese Revision wiederherstellen?" 764 confirm_restore: "Diese Revision wiederherstellen?"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 75c762a3..2acbe98f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -726,6 +726,7 @@ en:
726 last: "Last" 726 last: "Last"
727 diff_revisions: "Diff revisions" 727 diff_revisions: "Diff revisions"
728 diff_selection_html: "Comparing %{to} against %{from}" 728 diff_selection_html: "Comparing %{to} against %{from}"
729 row_meta: "%{date}, rev %{rev}, by %{editor}"
729 show_link: "show" 730 show_link: "show"
730 restore_link: "restore" 731 restore_link: "restore"
731 confirm_restore: "Restore this revision?" 732 confirm_restore: "Restore this revision?"
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css
index 8bbf7289..6471090e 100644
--- a/public/stylesheets/admin.css
+++ b/public/stylesheets/admin.css
@@ -682,6 +682,10 @@ form.button_to svg {
682 padding: 0.4rem 0.75rem; 682 padding: 0.4rem 0.75rem;
683} 683}
684 684
685.revisions_table tbody td:first-child {
686 padding-left: 0.75rem;
687}
688
685.revisions_table .diff_sticky_bar td { 689.revisions_table .diff_sticky_bar td {
686 border-bottom: 1px solid var(--hairline); 690 border-bottom: 1px solid var(--hairline);
687} 691}
@@ -737,16 +741,6 @@ form.button_to svg {
737 color: var(--text-muted); 741 color: var(--text-muted);
738} 742}
739 743
740@media (min-width: 1016px) {
741 .revisions_table td.title {
742 min-width: 28rem;
743 }
744
745 .revisions_table td.date {
746 min-width: 11rem;
747 }
748}
749
750#diffview del { 744#diffview del {
751 background: var(--diff-del-bg); 745 background: var(--diff-del-bg);
752 color: var(--diff-del-fg); 746 color: var(--diff-del-fg);
@@ -893,6 +887,7 @@ form.button_to svg {
893.node_table .action_grid { grid-template-columns: repeat(2, auto); } 887.node_table .action_grid { grid-template-columns: repeat(2, auto); }
894.events_table .action_grid { grid-template-columns: repeat(2, auto); } 888.events_table .action_grid { grid-template-columns: repeat(2, auto); }
895.assets_table .action_grid { grid-template-columns: repeat(3, auto); } 889.assets_table .action_grid { grid-template-columns: repeat(3, auto); }
890.revisions_table .action_grid { grid-template-columns: repeat(2, auto); }
896 891
897/* min-height keeps a row the same height whether or not the viewer may see 892/* min-height keeps a row the same height whether or not the viewer may see
898 the lower controls. */ 893 the lower controls. */
diff --git a/test/controllers/revisions_controller_test.rb b/test/controllers/revisions_controller_test.rb
index d9f49e58..68ef8abf 100644
--- a/test/controllers/revisions_controller_test.rb
+++ b/test/controllers/revisions_controller_test.rb
@@ -26,7 +26,7 @@ class RevisionsControllerTest < ActionController::TestCase
26 login_as :quentin 26 login_as :quentin
27 get :index, params: { :node_id => @node.id } 27 get :index, params: { :node_id => @node.id }
28 assert_response :success 28 assert_response :success
29 assert_select ".revision", 2 29 assert_select "tbody tr[data-revision]", 2
30 end 30 end
31 31
32 test "showing one revision" do 32 test "showing one revision" do