From 3b4e1423635fd9f33ae760312e438cc1e484662e Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 31 Jul 2026 20:41:05 +0200 Subject: Show the gate before it refuses, and check the destination nodes#show renders publish and trash as disabled_action spans with a hint naming what an editor can still do, matching how locked_by_other already reads. Editing and reverting stay live: drafting is free everywhere. --- app/views/nodes/show.html.erb | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'app/views/nodes') diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index 8b12e2eb..a6167c9e 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb @@ -1,4 +1,5 @@ <% locked_by_other = @node.locked? && @node.lock_owner != current_user %> +<% may_change_live = current_user.may_change_live?(@node) %>

<%= title_for_node(@node) %> (<%= I18n.default_locale.to_s.upcase %>)

@@ -48,8 +49,12 @@ <% unless locked_by_other %> <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %>
- <%= button_to t(".publish"), publish_node_path(@node), method: :put, - form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %> + <% if may_change_live %> + <%= button_to t(".publish"), publish_node_path(@node), method: :put, + form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %> + <% else %> + <%= t(".publish") %> + <% end %>
<% end %> <% if @node.autosave || (@node.draft && @node.head) %> @@ -64,10 +69,17 @@ <% end %> <% unless @node.trash_node? || @node.in_trash? || @node.root? %>
- <%= button_to trash_node_path(@node), method: :put, - form: { data: { confirm: t(".confirm_trash") }, class: 'button_to destructive' } do %> - <%= icon("trash", library: "tabler", "aria-hidden": true) %> - <%= t(".move_to_trash") %> + <% if may_change_live %> + <%= button_to trash_node_path(@node), method: :put, + form: { data: { confirm: t(".confirm_trash") }, class: 'button_to destructive' } do %> + <%= icon("trash", library: "tabler", "aria-hidden": true) %> + <%= t(".move_to_trash") %> + <% end %> + <% else %> + + <%= icon("trash", library: "tabler", "aria-hidden": true) %> + <%= t(".move_to_trash") %> + <% end %>
<% end %> @@ -76,6 +88,8 @@ <% if locked_by_other %> <%= t(".locked_hint") %> + <% elsif !may_change_live %> + <%= t(".restricted_hint") %> <% end %>
-- cgit v1.3