diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-07 20:22:37 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-07 20:22:37 +0200 |
| commit | 278819cad2d2199029cc11124c95b0155f83f821 (patch) | |
| tree | c98cada36cbec18a5e0c2bc1e17ef3370a9adbe8 | |
| parent | e7b12a7e50e6bdb64ccaa1180d606465485a8439 (diff) | |
Show a pending address in the cockpit, the diff and the publish confirm
| -rw-r--r-- | app/helpers/node_actions_helper.rb | 4 | ||||
| -rw-r--r-- | app/models/page.rb | 9 | ||||
| -rw-r--r-- | app/views/nodes/show.html.erb | 14 | ||||
| -rw-r--r-- | app/views/revisions/diff.html.erb | 10 | ||||
| -rw-r--r-- | config/locales/de.yml | 3 | ||||
| -rw-r--r-- | config/locales/en.yml | 3 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 18 |
7 files changed, 58 insertions, 3 deletions
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 | |||
| 221 | end | 221 | end |
| 222 | 222 | ||
| 223 | def subject_ref action | 223 | def subject_ref action |
| 224 | action.node ? link_to(h(action.subject_name), node_path(action.node)) | 224 | name = action.subject_name.presence || t("admin.common.no_title") |
| 225 | : h(action.subject_name) | 225 | action.node ? link_to(h(name), node_path(action.node)) : h(name) |
| 226 | end | 226 | end |
| 227 | 227 | ||
| 228 | def asset_ref action | 228 | 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 | |||
| 272 | end | 272 | end |
| 273 | 273 | ||
| 274 | text_diffs.merge( | 274 | text_diffs.merge( |
| 275 | address: address_diff_against(other), | ||
| 275 | tags: { added: tag_list.to_a - other.tag_list.to_a, removed: other.tag_list.to_a - tag_list.to_a }, | 276 | tags: { added: tag_list.to_a - other.tag_list.to_a, removed: other.tag_list.to_a - tag_list.to_a }, |
| 276 | template_name: { from: other.template_name, to: template_name, changed: template_name != other.template_name }, | 277 | template_name: { from: other.template_name, to: template_name, changed: template_name != other.template_name }, |
| 277 | assets: { added: assets.to_a - other.assets.to_a, removed: other.assets.to_a - assets.to_a } | 278 | assets: { added: assets.to_a - other.assets.to_a, removed: other.assets.to_a - assets.to_a } |
| @@ -417,4 +418,12 @@ class Page < ApplicationRecord | |||
| 417 | 418 | ||
| 418 | self.body = doc.to_html | 419 | self.body = doc.to_html |
| 419 | end | 420 | end |
| 421 | |||
| 422 | def address_diff_against other | ||
| 423 | changed = slug != other.slug || parent_node_id != other.parent_node_id | ||
| 424 | |||
| 425 | { :from => other.prospective_unique_name, | ||
| 426 | :to => prospective_unique_name, | ||
| 427 | :changed => changed } | ||
| 428 | end | ||
| 420 | end | 429 | 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 @@ | |||
| 50 | <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %> | 50 | <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %> |
| 51 | <div class="info_item"> | 51 | <div class="info_item"> |
| 52 | <% if may_change_live %> | 52 | <% if may_change_live %> |
| 53 | <% confirm = t(".confirm_publish") %> | ||
| 54 | <% if @node.prospective_unique_name != @node.unique_name %> | ||
| 55 | <% confirm += " " + t(".confirm_publish_moves", | ||
| 56 | :path => @node.prospective_unique_name) %> | ||
| 57 | <% end %> | ||
| 53 | <%= button_to t(".publish"), publish_node_path(@node), method: :put, | 58 | <%= button_to t(".publish"), publish_node_path(@node), method: :put, |
| 54 | form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %> | 59 | form: { data: { confirm: confirm }, class: 'button_to state_changing' } %> |
| 55 | <% else %> | 60 | <% else %> |
| 56 | <span class="disabled_action"><%= t(".publish") %></span> | 61 | <span class="disabled_action"><%= t(".publish") %></span> |
| 57 | <% end %> | 62 | <% end %> |
| @@ -223,6 +228,13 @@ | |||
| 223 | locale_param = ->(locale) { locale unless locale == I18n.default_locale } | 228 | locale_param = ->(locale) { locale unless locale == I18n.default_locale } |
| 224 | %> | 229 | %> |
| 225 | 230 | ||
| 231 | <% if @node.prospective_unique_name != @node.unique_name %> | ||
| 232 | <p class="pending_address"> | ||
| 233 | <%= icon("arrow-move-right", library: "tabler", "aria-hidden": true) %> | ||
| 234 | <%= t(".pending_address", :path => @node.prospective_unique_name) %> | ||
| 235 | </p> | ||
| 236 | <% end %> | ||
| 237 | |||
| 226 | <div class="link_matrix link_matrix_<%= link_locales.size %>"> | 238 | <div class="link_matrix link_matrix_<%= link_locales.size %>"> |
| 227 | <div class="link_matrix_head"> | 239 | <div class="link_matrix_head"> |
| 228 | <span></span> | 240 | <span></span> |
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb index 5c881f24..0fd9ccb9 100644 --- a/app/views/revisions/diff.html.erb +++ b/app/views/revisions/diff.html.erb | |||
| @@ -115,6 +115,16 @@ | |||
| 115 | <%= raw @diff[:body] %> | 115 | <%= raw @diff[:body] %> |
| 116 | <% end %> | 116 | <% end %> |
| 117 | 117 | ||
| 118 | <h3><%= t(".address") %></h3> | ||
| 119 | <% if @diff[:address][:changed] %> | ||
| 120 | <p> | ||
| 121 | <del><%= @diff[:address][:from] || t(".none_marker") %></del> | ||
| 122 | <ins><%= @diff[:address][:to] || t(".none_marker") %></ins> | ||
| 123 | </p> | ||
| 124 | <% else %> | ||
| 125 | <p class="diff_unchanged"><%= t(".no_change") %></p> | ||
| 126 | <% end %> | ||
| 127 | |||
| 118 | <h3><%= Page.human_attribute_name(:tag_list) %></h3> | 128 | <h3><%= Page.human_attribute_name(:tag_list) %></h3> |
| 119 | <% if @diff[:tags][:added].empty? && @diff[:tags][:removed].empty? %> | 129 | <% if @diff[:tags][:added].empty? && @diff[:tags][:removed].empty? %> |
| 120 | <p class="diff_unchanged"><%= t(".no_change") %></p> | 130 | <p class="diff_unchanged"><%= t(".no_change") %></p> |
diff --git a/config/locales/de.yml b/config/locales/de.yml index 6068d4c4..032d7647 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml | |||
| @@ -477,6 +477,7 @@ de: | |||
| 477 | layer_autosave: "Autosave" | 477 | layer_autosave: "Autosave" |
| 478 | publish: "Veröffentlichen" | 478 | publish: "Veröffentlichen" |
| 479 | confirm_publish: "Diesen Entwurf veröffentlichen?" | 479 | confirm_publish: "Diesen Entwurf veröffentlichen?" |
| 480 | confirm_publish_moves: "Dabei wird die Seite nach %{path} verschoben." | ||
| 480 | destroy_draft: "Entwurf löschen" | 481 | destroy_draft: "Entwurf löschen" |
| 481 | discard_autosave: "Autosave verwerfen" | 482 | discard_autosave: "Autosave verwerfen" |
| 482 | confirm_trash: "Diese Seite und alles darunter in den Papierkorb verschieben? Alle veröffentlichten Inhalte darin gehen offline." | 483 | confirm_trash: "Diese Seite und alles darunter in den Papierkorb verschieben? Alle veröffentlichten Inhalte darin gehen offline." |
| @@ -512,6 +513,7 @@ de: | |||
| 512 | will_publish_at: "Wird veröffentlicht am" | 513 | will_publish_at: "Wird veröffentlicht am" |
| 513 | links: "Links" | 514 | links: "Links" |
| 514 | public: "Öffentlich" | 515 | public: "Öffentlich" |
| 516 | pending_address: "Beim Veröffentlichen wird diese Seite nach %{path} verschoben" | ||
| 515 | admin_preview: "Admin-Vorschau" | 517 | admin_preview: "Admin-Vorschau" |
| 516 | public_preview: "Öffentliche Vorschau" | 518 | public_preview: "Öffentliche Vorschau" |
| 517 | revoke: "Zurückziehen" | 519 | revoke: "Zurückziehen" |
| @@ -747,6 +749,7 @@ de: | |||
| 747 | no_change: "Keine Änderung." | 749 | no_change: "Keine Änderung." |
| 748 | unchanged_here_html: "Keine Änderung in der Übersetzung %{lang} zwischen diesen Revisionen — geändert wurde %{others}." | 750 | unchanged_here_html: "Keine Änderung in der Übersetzung %{lang} zwischen diesen Revisionen — geändert wurde %{others}." |
| 749 | unchanged_anywhere: "Zwischen diesen Revisionen wurde keine Übersetzung geändert." | 751 | unchanged_anywhere: "Zwischen diesen Revisionen wurde keine Übersetzung geändert." |
| 752 | address: "Adresse" | ||
| 750 | index: | 753 | index: |
| 751 | title: "Revisionen für Node: %{path}" | 754 | title: "Revisionen für Node: %{path}" |
| 752 | back_to_node: "Zurück zum Node" | 755 | back_to_node: "Zurück zum Node" |
diff --git a/config/locales/en.yml b/config/locales/en.yml index 524d07d0..e75000bc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml | |||
| @@ -424,6 +424,7 @@ en: | |||
| 424 | layer_autosave: "Autosave" | 424 | layer_autosave: "Autosave" |
| 425 | publish: "Publish" | 425 | publish: "Publish" |
| 426 | confirm_publish: "Publish this draft?" | 426 | confirm_publish: "Publish this draft?" |
| 427 | confirm_publish_moves: "This will also move the page to %{path}." | ||
| 427 | destroy_draft: "Destroy Draft" | 428 | destroy_draft: "Destroy Draft" |
| 428 | discard_autosave: "Discard Autosave" | 429 | discard_autosave: "Discard Autosave" |
| 429 | confirm_trash: "Move this page and everything beneath it to the Trash? All published content in it will go offline." | 430 | confirm_trash: "Move this page and everything beneath it to the Trash? All published content in it will go offline." |
| @@ -459,6 +460,7 @@ en: | |||
| 459 | will_publish_at: "Will publish at" | 460 | will_publish_at: "Will publish at" |
| 460 | links: "Links" | 461 | links: "Links" |
| 461 | public: "Public" | 462 | public: "Public" |
| 463 | pending_address: "Beim Veröffentlichen wird diese Seite nach %{path} verschoben" | ||
| 462 | admin_preview: "Admin Preview" | 464 | admin_preview: "Admin Preview" |
| 463 | public_preview: "Public Preview" | 465 | public_preview: "Public Preview" |
| 464 | revoke: "Revoke" | 466 | revoke: "Revoke" |
| @@ -710,6 +712,7 @@ en: | |||
| 710 | no_change: "No change." | 712 | no_change: "No change." |
| 711 | unchanged_here_html: "No change in the %{lang} translation between these revisions — %{others} changed." | 713 | unchanged_here_html: "No change in the %{lang} translation between these revisions — %{others} changed." |
| 712 | unchanged_anywhere: "No translation changed between these revisions." | 714 | unchanged_anywhere: "No translation changed between these revisions." |
| 715 | address: "Address" | ||
| 713 | index: | 716 | index: |
| 714 | title: "Revisions for Node: %{path}" | 717 | title: "Revisions for Node: %{path}" |
| 715 | back_to_node: "Back to node" | 718 | back_to_node: "Back to node" |
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 889a5729..9d287dc7 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -1424,6 +1424,20 @@ form.button_to button[type="submit"] { | |||
| 1424 | } | 1424 | } |
| 1425 | } | 1425 | } |
| 1426 | 1426 | ||
| 1427 | .pending_address { | ||
| 1428 | display: flex; | ||
| 1429 | align-items: center; | ||
| 1430 | gap: 0.4rem; | ||
| 1431 | margin: 0 0 0.75rem; | ||
| 1432 | font-weight: bold; | ||
| 1433 | } | ||
| 1434 | |||
| 1435 | .pending_address svg { | ||
| 1436 | width: 1.25rem; | ||
| 1437 | height: 1.25rem; | ||
| 1438 | flex-shrink: 0; | ||
| 1439 | } | ||
| 1440 | |||
| 1427 | /* Layout only -- the at-rest visibility (wavy underline) for these | 1441 | /* Layout only -- the at-rest visibility (wavy underline) for these |
| 1428 | links comes from the scoped rule in Base elements above. */ | 1442 | links comes from the scoped rule in Base elements above. */ |
| 1429 | .add_events, | 1443 | .add_events, |
| @@ -2348,6 +2362,10 @@ input#menu_item_title { | |||
| 2348 | overflow-y: auto; | 2362 | overflow-y: auto; |
| 2349 | } | 2363 | } |
| 2350 | 2364 | ||
| 2365 | .restore_picker .search_results:empty { | ||
| 2366 | display: none; | ||
| 2367 | } | ||
| 2368 | |||
| 2351 | /* ============================================================ | 2369 | /* ============================================================ |
| 2352 | User section | 2370 | User section |
| 2353 | ============================================================ */ | 2371 | ============================================================ */ |
