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/page_translations/edit.html.erb | 2 ++ app/views/page_translations/index.html.erb | 19 ------------------- app/views/page_translations/show.html.erb | 2 ++ app/views/revisions/index.html.erb | 19 +++++++++++++++++-- app/views/revisions/show.html.erb | 11 ++++++----- 5 files changed, 27 insertions(+), 26 deletions(-) delete mode 100644 app/views/page_translations/index.html.erb (limited to 'app/views') diff --git a/app/views/page_translations/edit.html.erb b/app/views/page_translations/edit.html.erb index 89b594e..981fb74 100644 --- a/app/views/page_translations/edit.html.erb +++ b/app/views/page_translations/edit.html.erb @@ -2,6 +2,8 @@ Editing the <%= @locale.to_s.upcase %> translation of <%= title_for_node(@node) %>. +

<%= link_to 'View revision history', node_revisions_path(@node, :locale => @locale) %>

+

Metadata such as images, tags, template, and author belong to the page as a whole, not to a single translation — change those from the diff --git a/app/views/page_translations/index.html.erb b/app/views/page_translations/index.html.erb deleted file mode 100644 index a8c4f5d..0000000 --- a/app/views/page_translations/index.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -

Translations — <%= title_for_node(@node) %>

- -
-
- <% @translations.each do |t| %> -
- <%= t[:locale].to_s.upcase %> - <% if t[:exists] %> - <%= t[:title] %> — updated <%= t[:updated_at] %> - <% if t[:outdated] %>may be outdated<% end %> - <%= link_to 'Edit', edit_node_translation_path(@node, t[:locale]) %> - <% else %> - Not yet translated. - <%= link_to 'Add', edit_node_translation_path(@node, t[:locale]) %> - <% end %> -
- <% end %> -
-
diff --git a/app/views/page_translations/show.html.erb b/app/views/page_translations/show.html.erb index c5bd151..60eb7cf 100644 --- a/app/views/page_translations/show.html.erb +++ b/app/views/page_translations/show.html.erb @@ -1,5 +1,7 @@

Compare — <%= title_for_node(@node) %>

+

<%= link_to 'View revision history', node_revisions_path(@node, :locale => @locale) %>

+

<%= @locale.to_s.upcase %>

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