From 278819cad2d2199029cc11124c95b0155f83f821 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 7 Aug 2026 20:22:37 +0200 Subject: Show a pending address in the cockpit, the diff and the publish confirm --- app/helpers/node_actions_helper.rb | 4 ++-- app/models/page.rb | 9 +++++++++ app/views/nodes/show.html.erb | 14 +++++++++++++- app/views/revisions/diff.html.erb | 10 ++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/helpers/node_actions_helper.rb b/app/helpers/node_actions_helper.rb index c4de46cc..19385543 100644 --- a/app/helpers/node_actions_helper.rb +++ b/app/helpers/node_actions_helper.rb @@ -221,8 +221,8 @@ module NodeActionsHelper end def subject_ref action - action.node ? link_to(h(action.subject_name), node_path(action.node)) - : h(action.subject_name) + name = action.subject_name.presence || t("admin.common.no_title") + action.node ? link_to(h(name), node_path(action.node)) : h(name) end def asset_ref action diff --git a/app/models/page.rb b/app/models/page.rb index 4635f1b4..bba7e6bc 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -272,6 +272,7 @@ class Page < ApplicationRecord end text_diffs.merge( + address: address_diff_against(other), tags: { added: tag_list.to_a - other.tag_list.to_a, removed: other.tag_list.to_a - tag_list.to_a }, template_name: { from: other.template_name, to: template_name, changed: template_name != other.template_name }, assets: { added: assets.to_a - other.assets.to_a, removed: other.assets.to_a - assets.to_a } @@ -417,4 +418,12 @@ class Page < ApplicationRecord self.body = doc.to_html end + + def address_diff_against other + changed = slug != other.slug || parent_node_id != other.parent_node_id + + { :from => other.prospective_unique_name, + :to => prospective_unique_name, + :changed => changed } + end end diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index 3b2d28d9..a826be37 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb @@ -50,8 +50,13 @@ <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %>
<% if may_change_live %> + <% confirm = t(".confirm_publish") %> + <% if @node.prospective_unique_name != @node.unique_name %> + <% confirm += " " + t(".confirm_publish_moves", + :path => @node.prospective_unique_name) %> + <% end %> <%= button_to t(".publish"), publish_node_path(@node), method: :put, - form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %> + form: { data: { confirm: confirm }, class: 'button_to state_changing' } %> <% else %> <%= t(".publish") %> <% end %> @@ -223,6 +228,13 @@ locale_param = ->(locale) { locale unless locale == I18n.default_locale } %> + <% if @node.prospective_unique_name != @node.unique_name %> +

+ <%= icon("arrow-move-right", library: "tabler", "aria-hidden": true) %> + <%= t(".pending_address", :path => @node.prospective_unique_name) %> +

+ <% end %> +