From 88ebeaac7fcf140cbab489e841bf9c197f84c4ea Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 14 Jul 2026 02:17:04 +0200 Subject: Make revisions locale aware --- app/views/revisions/index.html.erb | 19 +++++++++++++++++-- app/views/revisions/show.html.erb | 11 ++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'app/views/revisions') diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb index 4680ae2..7ea74a6 100644 --- a/app/views/revisions/index.html.erb +++ b/app/views/revisions/index.html.erb @@ -4,6 +4,20 @@ <%= link_to 'Back to node', node_path(@node) %>

+<% if Page.non_default_locales.any? %> +

+ Locale: + <% ([I18n.default_locale] + Page.non_default_locales).each_with_index do |locale, i| %> + <%= " · ".html_safe if i > 0 %> + <% if locale == @locale %> + <%= locale.to_s.upcase %> + <% else %> + <%= link_to locale.to_s.upcase, node_revisions_path(@node, :locale => locale) %> + <% end %> + <% end %> +

+<% end %> + @@ -20,6 +34,7 @@ - + - +
<%= button_to 'Diff revisions', diff_node_revisions_path(@node), method: :post, + params: { locale: @locale }, form: { id: 'diff_form', class: 'button_to computation' }, disabled: true %> @@ -35,10 +50,10 @@ <%= radio_button_tag :start_revision, page.revision, index == 1 %> <%= radio_button_tag :end_revision, page.revision, index == 0 %> <%= page.revision %><%= page.title %><%= page.translations.find_by(:locale => @locale)&.title || "—" %> <%= page.editor.try(:login) %> <%= page.updated_at %><%= link_to 'show', node_revision_path(@node, page) %><%= link_to 'show', node_revision_path(@node, page, :locale => @locale) %> <%= button_to 'restore', restore_node_revision_path(@node, page), method: :put, diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb index 92d959b..74fb51f 100644 --- a/app/views/revisions/show.html.erb +++ b/app/views/revisions/show.html.erb @@ -1,12 +1,13 @@ +<% translation = @page.translations.find_by(:locale => @locale) %>
-

Revision <%= @page.revision %>: <%= @page.title %>

+

Revision <%= @page.revision %>: <%= translation&.title %> (<%= @locale.to_s.upcase %>)

Actions
- <%= link_to 'Show all revisions', node_revisions_path(@node) %> + <%= link_to 'Show all revisions', node_revisions_path(@node, :locale => @locale) %>
@@ -27,12 +28,12 @@
<%= @page.published_at %>
Title
-
<%= @page.title %>
+
<%= translation&.title %>
Abstract
-
<%= @page.abstract %>
+
<%= translation&.abstract %>
Body
-
<%= raw @page.body %>
+
<%= raw translation&.body %>
-- cgit v1.3