diff options
Diffstat (limited to 'app/views/revisions/index.html.erb')
| -rw-r--r-- | app/views/revisions/index.html.erb | 138 |
1 files changed, 75 insertions, 63 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 | <%= " · ".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 | <%= " · ".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> | ||
