diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-31 22:36:17 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-31 22:36:17 +0200 |
| commit | 529f81b28ed77c62acaa63fad957e751798f2440 (patch) | |
| tree | 9d928cbe54008b1f75c4b813182970dd0757002c /app | |
| parent | 3b4e1423635fd9f33ae760312e438cc1e484662e (diff) | |
Warn before the gate refuses, and check restore destinations
nodes#new marks the kinds that place under /updates, derived from each kind's
own path_prefix. The three parent pickers mark candidates the current user
cannot publish into; menu_search returns needs_redaktion per result, computed
per user rather than as a bare restricted flag, and the menu-item picker opts
out.
restore_from_trash! checks its destination: the restore is the move, applied
rather than staged, so no later publish would have caught it. The node
returns as a draft either way.
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/admin_controller.rb | 4 | ||||
| -rw-r--r-- | app/models/node.rb | 3 | ||||
| -rw-r--r-- | app/views/layouts/admin.html.erb | 2 | ||||
| -rw-r--r-- | app/views/nodes/new.html.erb | 6 |
4 files changed, 12 insertions, 3 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 3b8b3582..c23cec04 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb | |||
| @@ -67,7 +67,9 @@ class AdminController < ApplicationController | |||
| 67 | 67 | ||
| 68 | format.js do | 68 | format.js do |
| 69 | render( :json => @results.map do |node| | 69 | render( :json => @results.map do |node| |
| 70 | {:node_id => node.id, :title => node.title, :unique_name => node.unique_name, :node_path => node_path(node)} | 70 | { :node_id => node.id, :title => node.title, |
| 71 | :unique_name => node.unique_name, :node_path => node_path(node), | ||
| 72 | :needs_redaktion => !current_user.may_change_live?(node) } | ||
| 71 | end | 73 | end |
| 72 | ) | 74 | ) |
| 73 | 75 | ||
diff --git a/app/models/node.rb b/app/models/node.rb index 188b6c17..d6fe32ff 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -375,6 +375,9 @@ class Node < ApplicationRecord | |||
| 375 | raise ActiveRecord::RecordInvalid.new(self) | 375 | raise ActiveRecord::RecordInvalid.new(self) |
| 376 | end | 376 | end |
| 377 | 377 | ||
| 378 | guard_live_change!(current_user, | ||
| 379 | :target_path => [new_parent.unique_name.presence, slug].compact.join("/")) | ||
| 380 | |||
| 378 | ActiveRecord::Base.transaction do | 381 | ActiveRecord::Base.transaction do |
| 379 | path_before = unique_name | 382 | path_before = unique_name |
| 380 | move_to_child_of(new_parent) | 383 | move_to_child_of(new_parent) |
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 97117710..43f09b96 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | <%= javascript_tag nonce: true do %> | 18 | <%= javascript_tag nonce: true do %> |
| 19 | var ADMIN_SEARCH_URL = "<%= admin_search_path %>"; | 19 | var ADMIN_SEARCH_URL = "<%= admin_search_path %>"; |
| 20 | var ADMIN_MENU_SEARCH_URL = "<%= admin_menu_search_path %>"; | 20 | var ADMIN_MENU_SEARCH_URL = "<%= admin_menu_search_path %>"; |
| 21 | var ADMIN_STRINGS = <%= raw({ :lock_lost_prefix => t(".lock_lost_prefix"), :lock_lost_link => t(".lock_lost_link"), :insert_image => t(".insert_image"), :insert_image_tooltip => t(".insert_image_tooltip"), :copied => t(".copied") }.to_json) %>; | 21 | var ADMIN_STRINGS = <%= raw({ :lock_lost_prefix => t(".lock_lost_prefix"), :lock_lost_link => t(".lock_lost_link"), :insert_image => t(".insert_image"), :insert_image_tooltip => t(".insert_image_tooltip"), :copied => t(".copied"), :needs_redaktion => t(".needs_redaktion") }.to_json) %>; |
| 22 | var PARAMETERIZE_PREVIEW_URL = "<%= parameterize_preview_nodes_path %>"; | 22 | var PARAMETERIZE_PREVIEW_URL = "<%= parameterize_preview_nodes_path %>"; |
| 23 | var DASHBOARD_SEARCH_URL = "<%= admin_dashboard_search_path %>"; | 23 | var DASHBOARD_SEARCH_URL = "<%= admin_dashboard_search_path %>"; |
| 24 | <% end %> | 24 | <% end %> |
diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb index b56bbeed..883909a6 100644 --- a/app/views/nodes/new.html.erb +++ b/app/views/nodes/new.html.erb | |||
| @@ -12,13 +12,17 @@ | |||
| 12 | <div class="layout_row_label"><%= t(".type") %></div> | 12 | <div class="layout_row_label"><%= t(".type") %></div> |
| 13 | <div class="layout_row_content"> | 13 | <div class="layout_row_content"> |
| 14 | <% CccConventions::NODE_KINDS.each do |kind, config| %> | 14 | <% CccConventions::NODE_KINDS.each do |kind, config| %> |
| 15 | <% prefix = resolve_kind_text(config[:path_prefix]) %> | ||
| 15 | <p> | 16 | <p> |
| 16 | <%= radio_button_tag :kind, kind, kind == @selected_kind, | 17 | <%= radio_button_tag :kind, kind, kind == @selected_kind, |
| 17 | data: { path_prefix: resolve_kind_text(config[:path_prefix]) } %> | 18 | data: { path_prefix: prefix } %> |
| 18 | <%= resolve_kind_text(config[:label]) %> | 19 | <%= resolve_kind_text(config[:label]) %> |
| 19 | <% if config[:hint] %> | 20 | <% if config[:hint] %> |
| 20 | <span class="field_hint"><%= resolve_kind_text(config[:hint]) %></span> | 21 | <span class="field_hint"><%= resolve_kind_text(config[:hint]) %></span> |
| 21 | <% end %> | 22 | <% end %> |
| 23 | <% unless current_user.may_change_live_at?(prefix) %> | ||
| 24 | <span class="field_hint restricted_kind_hint"><%= t(".restricted_kind") %></span> | ||
| 25 | <% end %> | ||
| 22 | </p> | 26 | </p> |
| 23 | <% end %> | 27 | <% end %> |
| 24 | </div> | 28 | </div> |
