diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-31 20:41:05 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-31 20:41:05 +0200 |
| commit | 3b4e1423635fd9f33ae760312e438cc1e484662e (patch) | |
| tree | 0dd81aaf26ab5e4d7e178563f120b3e203c4dc0b /app/views | |
| parent | 683526b38442a9873d83a542b5cba1d15efc14d5 (diff) | |
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.
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/nodes/show.html.erb | 26 |
1 files changed, 20 insertions, 6 deletions
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 @@ | |||
| 1 | <% locked_by_other = @node.locked? && @node.lock_owner != current_user %> | 1 | <% locked_by_other = @node.locked? && @node.lock_owner != current_user %> |
| 2 | <% may_change_live = current_user.may_change_live?(@node) %> | ||
| 2 | <div id="admin_layout" class="show_node"> | 3 | <div id="admin_layout" class="show_node"> |
| 3 | <h1><%= title_for_node(@node) %> <small>(<%= I18n.default_locale.to_s.upcase %>)</small></h1> | 4 | <h1><%= title_for_node(@node) %> <small>(<%= I18n.default_locale.to_s.upcase %>)</small></h1> |
| 4 | <div id="content"> | 5 | <div id="content"> |
| @@ -48,8 +49,12 @@ | |||
| 48 | <% unless locked_by_other %> | 49 | <% unless locked_by_other %> |
| 49 | <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %> | 50 | <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %> |
| 50 | <div class="info_item"> | 51 | <div class="info_item"> |
| 51 | <%= button_to t(".publish"), publish_node_path(@node), method: :put, | 52 | <% if may_change_live %> |
| 52 | form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %> | 53 | <%= button_to t(".publish"), publish_node_path(@node), method: :put, |
| 54 | form: { data: { confirm: t(".confirm_publish") }, class: 'button_to state_changing' } %> | ||
| 55 | <% else %> | ||
| 56 | <span class="disabled_action"><%= t(".publish") %></span> | ||
| 57 | <% end %> | ||
| 53 | </div> | 58 | </div> |
| 54 | <% end %> | 59 | <% end %> |
| 55 | <% if @node.autosave || (@node.draft && @node.head) %> | 60 | <% if @node.autosave || (@node.draft && @node.head) %> |
| @@ -64,10 +69,17 @@ | |||
| 64 | <% end %> | 69 | <% end %> |
| 65 | <% unless @node.trash_node? || @node.in_trash? || @node.root? %> | 70 | <% unless @node.trash_node? || @node.in_trash? || @node.root? %> |
| 66 | <div class="info_item"> | 71 | <div class="info_item"> |
| 67 | <%= button_to trash_node_path(@node), method: :put, | 72 | <% if may_change_live %> |
| 68 | form: { data: { confirm: t(".confirm_trash") }, class: 'button_to destructive' } do %> | 73 | <%= button_to trash_node_path(@node), method: :put, |
| 69 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> | 74 | form: { data: { confirm: t(".confirm_trash") }, class: 'button_to destructive' } do %> |
| 70 | <%= t(".move_to_trash") %> | 75 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> |
| 76 | <%= t(".move_to_trash") %> | ||
| 77 | <% end %> | ||
| 78 | <% else %> | ||
| 79 | <span class="disabled_action"> | ||
| 80 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> | ||
| 81 | <%= t(".move_to_trash") %> | ||
| 82 | </span> | ||
| 71 | <% end %> | 83 | <% end %> |
| 72 | </div> | 84 | </div> |
| 73 | <% end %> | 85 | <% end %> |
| @@ -76,6 +88,8 @@ | |||
| 76 | 88 | ||
| 77 | <% if locked_by_other %> | 89 | <% if locked_by_other %> |
| 78 | <span class="field_hint"><%= t(".locked_hint") %></span> | 90 | <span class="field_hint"><%= t(".locked_hint") %></span> |
| 91 | <% elsif !may_change_live %> | ||
| 92 | <span class="field_hint"><%= t(".restricted_hint") %></span> | ||
| 79 | <% end %> | 93 | <% end %> |
| 80 | </div> | 94 | </div> |
| 81 | 95 | ||
