diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-08 22:52:00 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-08 22:52:00 +0200 |
| commit | 168ff3f8b6037bc3c2b5bce74adac37e48366dac (patch) | |
| tree | 3d33fa85125266f3ec827528f73da4704b948f45 /app/views/nodes/edit.html.erb | |
| parent | 9427dc462e68eb4b902cd5b2ace5607b036504ef (diff) | |
Add the Status section to nodes#show and rebuild nodes#edit's action bar
Retires content_for :subnavigation on nodes#show entirely -- Preview
was fully redundant with Links' own preview URLs in every state, and
Edit is now a permanent, always-rendered action inside the new Status
section rather than a link floating at the top, consistent with the
"action lives next to the info" pattern People already established
for Unlock. Status surfaces head/draft/autosave plainly and gates
Edit/Publish/Destroy/Discard on lock ownership specifically, not mere
lock presence -- @node.locked? alone would have blocked the lock
owner's own session, caught by the click-test and fixed here rather
than shipped.
nodes#edit's action bar is rebuilt to sit outside form_for (both
button_to calls render their own nested form, invalid HTML the
browser was silently stripping) with Save wired back in via
form="..." rather than needing to live inside the form tag at all.
Also brings the locked-and-ready-to-edit flash message, and the
visual polish from this session's click-test: consistent button
heights across the bordered and pill-shaped variants sharing a row,
spacing between Status's data and its actions, and error_messages
styling reusing the destructive-red vocabulary already established
elsewhere.
Diffstat (limited to 'app/views/nodes/edit.html.erb')
| -rw-r--r-- | app/views/nodes/edit.html.erb | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index feba92a..cdc9b36 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | <h1><%= title_for_node(@node) %></h1> | ||
| 2 | |||
| 3 | <div class="node_action_bar"> | ||
| 4 | <%= button_to 'Unlock + Back', unlock_node_path(@node), method: :put, | ||
| 5 | form: { class: 'button_to state_changing' }, | ||
| 6 | disabled: @node.autosave.present? %> | ||
| 7 | |||
| 8 | <% if @node.autosave || (@node.draft && @node.head) %> | ||
| 9 | <%= button_to (@node.draft && !@node.autosave ? 'Destroy Draft' : 'Discard changes'), | ||
| 10 | revert_node_path(@node), method: :put, | ||
| 11 | form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } %> | ||
| 12 | <% end %> | ||
| 13 | |||
| 14 | <%= submit_tag "Save Draft", form: dom_id(@node, :edit) %> | ||
| 15 | <%= submit_tag "Save + Unlock + Exit", form: dom_id(@node, :edit) %> | ||
| 16 | <%= link_to "Preview ↗", preview_page_path(@page), target: "_blank", rel: "noopener", class: "preview_link" %> | ||
| 17 | </div> | ||
| 18 | |||
| 1 | <div id="page_editor"> | 19 | <div id="page_editor"> |
| 2 | <%= form_for(@node, html: { data: { autosave_url: autosave_node_path(@node), show_url: node_path(@node) } }) do |f| %> | 20 | <%= form_for(@node, html: { data: { autosave_url: autosave_node_path(@node), show_url: node_path(@node) } }) do |f| %> |
| 3 | <% if @node.errors.any? %> | 21 | <% if @node.errors.any? %> |
| @@ -6,25 +24,6 @@ | |||
| 6 | </div> | 24 | </div> |
| 7 | <% end %> | 25 | <% end %> |
| 8 | 26 | ||
| 9 | <h1><%= title_for_node(@node) %></h1> | ||
| 10 | |||
| 11 | <div id="node_action_bar"> | ||
| 12 | <%= button_to 'Unlock + Back', unlock_node_path(@node), method: :put, | ||
| 13 | form: { class: 'button_to state_changing' }, | ||
| 14 | disabled: @node.autosave.present? %> | ||
| 15 | |||
| 16 | <% if @node.autosave || (@node.draft && @node.head) %> | ||
| 17 | <%= button_to (@node.draft && !@node.autosave ? 'Destroy Draft' : 'Discard changes'), | ||
| 18 | revert_node_path(@node), method: :put, | ||
| 19 | form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } %> | ||
| 20 | <% end %> | ||
| 21 | |||
| 22 | <%= link_to 'Preview', preview_page_path(@page) %> | ||
| 23 | |||
| 24 | <%= f.submit 'Save Draft' %> | ||
| 25 | <%= f.submit 'Save + Unlock + Exit' %> | ||
| 26 | </div> | ||
| 27 | |||
| 28 | <details id="metadata_details"> | 27 | <details id="metadata_details"> |
| 29 | <summary>Metadata (slug, parent, tags, template, author, images)</summary> | 28 | <summary>Metadata (slug, parent, tags, template, author, images)</summary> |
| 30 | <div id="metadata"> | 29 | <div id="metadata"> |
| @@ -102,9 +101,9 @@ | |||
| 102 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> | 101 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> |
| 103 | <% end %> | 102 | <% end %> |
| 104 | 103 | ||
| 105 | <div id="node_action_bar"> | 104 | <div class="node_action_bar node_action_bar_save"> |
| 106 | <%= f.submit 'Save Draft' %> | 105 | <%= f.submit 'Save Draft' %> |
| 107 | <%= f.submit 'Save + Unlock + Exit' %> | 106 | <%= f.submit 'Save + Unlock + Exit' %> |
| 108 | </div> | 107 | </div> |
| 109 | <% end %> | 108 | <% end %> |
| 110 | </div> | 109 | </div> |
