diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-08 17:33:26 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-08 17:33:26 +0200 |
| commit | 6398042d3e009d54b15ad01faf993b3d97a203c6 (patch) | |
| tree | 9cbb38eb5f2d2c8966bb0d3f371117d500e9c3f5 | |
| parent | bc03601ee5c7acd4ef012ec4a404bd7b76bceaa0 (diff) | |
Add a action bar to the node edit view. This is the first application of a proposed new layout
| -rw-r--r-- | app/views/nodes/edit.html.erb | 45 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 8 |
2 files changed, 39 insertions, 14 deletions
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 1c6cc3a..feba92a 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -1,9 +1,3 @@ | |||
| 1 | <% content_for :subnavigation do %> | ||
| 2 | <%= link_to 'Show', @node %> | ||
| 3 | <%= link_to 'Preview', preview_page_path(@draft) %> | ||
| 4 | <%= button_to 'Publish', publish_node_path(@node), method: :put, form: { data: { confirm: "Publish this draft?" }, class: 'button_to state_changing' } %> | ||
| 5 | <% end %> | ||
| 6 | |||
| 7 | <div id="page_editor"> | 1 | <div id="page_editor"> |
| 8 | <%= form_for(@node, html: { data: { autosave_url: autosave_node_path(@node), show_url: node_path(@node) } }) do |f| %> | 2 | <%= form_for(@node, html: { data: { autosave_url: autosave_node_path(@node), show_url: node_path(@node) } }) do |f| %> |
| 9 | <% if @node.errors.any? %> | 3 | <% if @node.errors.any? %> |
| @@ -14,6 +8,23 @@ | |||
| 14 | 8 | ||
| 15 | <h1><%= title_for_node(@node) %></h1> | 9 | <h1><%= title_for_node(@node) %></h1> |
| 16 | 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 | |||
| 17 | <details id="metadata_details"> | 28 | <details id="metadata_details"> |
| 18 | <summary>Metadata (slug, parent, tags, template, author, images)</summary> | 29 | <summary>Metadata (slug, parent, tags, template, author, images)</summary> |
| 19 | <div id="metadata"> | 30 | <div id="metadata"> |
| @@ -38,12 +49,12 @@ | |||
| 38 | %> | 49 | %> |
| 39 | </div> | 50 | </div> |
| 40 | 51 | ||
| 41 | <%= fields_for @draft do |d| %> | 52 | <%= fields_for @page do |d| %> |
| 42 | <div class="node_description">Tags - comma seperated</div> | 53 | <div class="node_description">Tags - comma seperated</div> |
| 43 | <div class="node_content"><%= text_field_tag :tag_list, @draft.tag_list.join(', ') %></div> | 54 | <div class="node_content"><%= text_field_tag :tag_list, @page.tag_list.join(', ') %></div> |
| 44 | 55 | ||
| 45 | <div class="node_description">Publish at</div> | 56 | <div class="node_description">Publish at</div> |
| 46 | <div class="node_content"><%= d.datetime_select :published_at, :value => @draft.published_at %></div> | 57 | <div class="node_content"><%= d.datetime_select :published_at, :value => @page.published_at %></div> |
| 47 | 58 | ||
| 48 | <div class="node_description">Template</div> | 59 | <div class="node_description">Template</div> |
| 49 | <div class="node_content"> | 60 | <div class="node_content"> |
| @@ -52,12 +63,15 @@ | |||
| 52 | </div> | 63 | </div> |
| 53 | 64 | ||
| 54 | <div class="node_description">Author</div> | 65 | <div class="node_description">Author</div> |
| 55 | <div class="node_content"><%= d.select :user_id, user_list %></div> | 66 | <div class="node_content"> |
| 67 | <%= d.select :user_id, user_list, | ||
| 68 | :selected => @page.user_id || @node.draft&.user_id || @node.head&.user_id %> | ||
| 69 | </div> | ||
| 56 | 70 | ||
| 57 | <div class="node_description">Images</div> | 71 | <div class="node_description">Images</div> |
| 58 | <div class="node_content"> | 72 | <div class="node_content"> |
| 59 | <ul id="image_box" rel="<%= @draft.id %>"> | 73 | <ul id="image_box" rel="<%= @page.id %>"> |
| 60 | <% @draft.assets.images.each do |image| %> | 74 | <% @page.assets.images.each do |image| %> |
| 61 | <li rel="images_<%= image.id %>"> | 75 | <li rel="images_<%= image.id %>"> |
| 62 | <%= image_tag(image.upload.url(:thumb)) %> | 76 | <%= image_tag(image.upload.url(:thumb)) %> |
| 63 | </li> | 77 | </li> |
| @@ -86,8 +100,11 @@ | |||
| 86 | 100 | ||
| 87 | <div class="node_description">Body</div> | 101 | <div class="node_description">Body</div> |
| 88 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> | 102 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> |
| 103 | <% end %> | ||
| 89 | 104 | ||
| 90 | <div><%= d.submit 'save' %></div> | 105 | <div id="node_action_bar"> |
| 106 | <%= f.submit 'Save Draft' %> | ||
| 107 | <%= f.submit 'Save + Unlock + Exit' %> | ||
| 108 | </div> | ||
| 91 | <% end %> | 109 | <% end %> |
| 92 | <% end %> | ||
| 93 | </div> | 110 | </div> |
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 7ae374c..ceacf17 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -165,6 +165,14 @@ input[type=radio] { | |||
| 165 | margin-bottom: 40px; | 165 | margin-bottom: 40px; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | #node_action_bar { | ||
| 169 | margin-bottom: 1rem; | ||
| 170 | } | ||
| 171 | |||
| 172 | #node_action_bar > * { | ||
| 173 | margin-right: 0.5rem; | ||
| 174 | } | ||
| 175 | |||
| 168 | /* ============================================================ | 176 | /* ============================================================ |
| 169 | Flash / notices | 177 | Flash / notices |
| 170 | ============================================================ */ | 178 | ============================================================ */ |
