diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-13 23:33:11 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-13 23:33:11 +0200 |
| commit | 8eab68f2c5a3c126e2fec2ecdfa7ace87ce0937b (patch) | |
| tree | f446ebc26a7707c7b64a937aa51a155df146c80a /app/views/nodes/edit.html.erb | |
| parent | 42714c697273a7117c6b355fab26c8c35e336ad1 (diff) | |
| parent | cdf5d9941ca866d437612d2f863eac6eb0b3db12 (diff) | |
Merge branch 'erdgeist-revive-events'
Diffstat (limited to 'app/views/nodes/edit.html.erb')
| -rw-r--r-- | app/views/nodes/edit.html.erb | 153 |
1 files changed, 95 insertions, 58 deletions
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 498fa1f..e0e51d8 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -1,79 +1,113 @@ | |||
| 1 | <% content_for :subnavigation do %> | 1 | <h1><%= title_for_node(@node) %></h1> |
| 2 | <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> | 2 | |
| 3 | <%= link_to 'Show', @node %> | 3 | <div class="node_action_bar"> |
| 4 | <%= link_to 'Preview', preview_page_path(@draft) %> | 4 | <%= button_to 'Unlock + Back', unlock_node_path(@node), method: :put, |
| 5 | <%= button_to 'Publish', publish_node_path(@node), method: :put, form: { data: { confirm: "Publish this draft?" } } %> | 5 | form: { class: 'button_to state_changing' }, |
| 6 | <%= link_to 'Revisions', node_revisions_path(@node) %> | 6 | disabled: @node.autosave.present? %> |
| 7 | <% end %> | 7 | |
| 8 | <% if @node.autosave || (@node.draft && @node.head) %> | ||
| 9 | <%= button_to revert_node_path(@node), method: :put, | ||
| 10 | form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } do %> | ||
| 11 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> | ||
| 12 | <%= @node.draft && !@node.autosave ? "Destroy Draft" : "Discard Autosave" %> | ||
| 13 | <% end %> | ||
| 14 | <% if pair = @node.available_layer_pairs.find { |p| p.include?(:autosave) } %> | ||
| 15 | <%= button_to 'What changed?', | ||
| 16 | diff_node_revisions_path(@node), | ||
| 17 | method: :get, | ||
| 18 | params: { start_revision: pair.first, end_revision: pair.last }, | ||
| 19 | form: { class: 'button_to computation' } %> | ||
| 20 | <% end %> | ||
| 21 | <% end %> | ||
| 22 | |||
| 23 | <%= submit_tag "Save Draft", form: dom_id(@node, :edit) %> | ||
| 24 | <%= submit_tag "Save + Unlock + Exit", form: dom_id(@node, :edit) %> | ||
| 25 | <%= link_to "Preview ↗", preview_page_path(@page), target: "_blank", rel: "noopener", class: "preview_link" %> | ||
| 26 | </div> | ||
| 8 | 27 | ||
| 9 | <div id="page_editor"> | 28 | <div id="page_editor"> |
| 10 | <%= form_for(@node) do |f| %> | 29 | <%= form_for(@node, html: { data: { autosave_url: autosave_node_path(@node), show_url: node_path(@node) } }) do |f| %> |
| 11 | <% if @node.errors.any? %> | 30 | <% if @node.errors.any? %> |
| 12 | <div class="error_messages"> | 31 | <div class="error_messages"> |
| 13 | <ul><% @node.errors.full_messages.each do |msg| %><li><%= msg %></li><% end %></ul> | 32 | <ul><% @node.errors.full_messages.each do |msg| %><li><%= msg %></li><% end %></ul> |
| 14 | </div> | 33 | </div> |
| 15 | <% end %> | 34 | <% end %> |
| 16 | |||
| 17 | <div id="metadata"> | ||
| 18 | <div class="node_description">Event</div> | ||
| 19 | <div class="node_content"><%= event_information %></div> | ||
| 20 | 35 | ||
| 21 | <div class="node_description">Slug</div> | 36 | <details id="metadata_details"> |
| 22 | <div class="node_content"> | 37 | <summary>Metadata (slug, parent, tags, template, author, images)</summary> |
| 23 | <%= f.text_field( | 38 | <div id="metadata"> |
| 24 | :staged_slug, :value => @node.staged_slug || @node.slug | 39 | <div class="node_description">Slug</div> |
| 25 | ) | 40 | <div class="node_content"> |
| 26 | %> | 41 | <%= f.text_field( |
| 27 | </div> | 42 | :staged_slug, :value => @node.staged_slug || @node.slug |
| 28 | 43 | ) | |
| 29 | <div class="node_description">parent</div> | 44 | %> |
| 30 | <div class="node_content"> | 45 | </div> |
| 31 | <%= text_field_tag :move_to_search_term, @node.parent.title rescue "" %> | ||
| 32 | <div id="search_results"> | ||
| 33 | 46 | ||
| 34 | </div> | 47 | <div class="node_description">parent</div> |
| 48 | <div class="node_content"> | ||
| 49 | <%= text_field_tag :move_to_search_term, @node.parent.title rescue "" %> | ||
| 50 | <div id="move_to_search_results" class="search_results"></div> | ||
| 35 | <%= f.hidden_field( | 51 | <%= f.hidden_field( |
| 36 | :staged_parent_id, | 52 | :staged_parent_id, |
| 37 | :value => @node.staged_parent_id || @node.parent_id | 53 | :value => @node.staged_parent_id || @node.parent_id |
| 38 | ) | 54 | ) |
| 39 | %> | 55 | %> |
| 40 | </div> | 56 | </div> |
| 41 | |||
| 42 | <%= fields_for @draft do |d| %> | ||
| 43 | <div class="node_description">Tags - comma seperated</div> | ||
| 44 | <div class="node_content"><%= text_field_tag :tag_list, @draft.tag_list.join(', ') %></div> | ||
| 45 | 57 | ||
| 46 | <div class="node_description">Publish at</div> | 58 | <%= fields_for @page do |d| %> |
| 47 | <div class="node_content"><%= d.datetime_select :published_at, :value => @draft.published_at %></div> | 59 | <div class="node_description">Tags - comma seperated</div> |
| 60 | <div class="node_content"><%= text_field_tag :tag_list, @page.tag_list.join(', ') %></div> | ||
| 48 | 61 | ||
| 49 | <div class="node_description">Template</div> | 62 | <div class="node_description">Publish at</div> |
| 50 | <div class="node_content"><%= d.select :template_name, custom_page_templates, {:prompt => 'Select Template'} %></div> | 63 | <div class="node_content"><%= d.datetime_select :published_at, :value => @page.published_at %></div> |
| 51 | 64 | ||
| 52 | <div class="node_description">Author</div> | 65 | <div class="node_description">Template</div> |
| 53 | <div class="node_content"><%= d.select :user_id, user_list %></div> | 66 | <div class="node_content"> |
| 67 | <%= d.select :template_name, custom_page_templates, {:prompt => 'Select Template'} %> | ||
| 68 | <span class="field_hint">Set automatically based on how this node was created - change it if needed.</span> | ||
| 69 | </div> | ||
| 54 | 70 | ||
| 55 | <div class="node_description">Images</div> | 71 | <div class="node_description">Author</div> |
| 56 | <div class="node_content"> | 72 | <div class="node_content"> |
| 57 | <ul id="image_box" rel="<%= @draft.id %>"> | 73 | <%= d.select :user_id, user_list, |
| 58 | <% @draft.assets.images.each do |image| %> | 74 | :selected => @page.user_id || @node.draft&.user_id || @node.head&.user_id %> |
| 59 | <li rel="images_<%= image.id %>"> | ||
| 60 | <%= image_tag(image.upload.url(:thumb)) %> | ||
| 61 | </li> | ||
| 62 | <% end %> | ||
| 63 | </ul> | ||
| 64 | <div class="clear_left right"> | ||
| 65 | <a id="image_browser_toggle" class="unselected" href="#">image browser</a> | ||
| 66 | </div> | 75 | </div> |
| 67 | <div id="image_browser"> | 76 | |
| 68 | <ul> | 77 | <div class="node_description">Images</div> |
| 69 | <% Asset.images.each do |image| %> | 78 | <div class="node_content"> |
| 70 | <li rel="images_<%= image.id %>"><%= image_tag(image.upload.url(:thumb)) %></li> | 79 | <div id="related_assets" |
| 71 | <% end %> | 80 | data-search-url="<%= search_node_related_assets_path(@node) %>" |
| 72 | </ul> | 81 | data-create-url="<%= node_related_assets_path(@node) %>"> |
| 82 | <ul id="related_asset_list" class="thumbnail_list"> | ||
| 83 | <% @page.related_assets.includes(:asset).each do |related| %> | ||
| 84 | <li data-url="<%= node_related_asset_path(@node, related) %>"> | ||
| 85 | <span class="related_asset_handle"><%= icon("grip-vertical", library: "tabler", "aria-hidden": true) %></span> | ||
| 86 | <%= image_tag related.asset.upload.url(:thumb) %> | ||
| 87 | <button type="button" class="related_asset_remove" aria-label="Remove image"> | ||
| 88 | <%= icon("x", library: "tabler", "aria-hidden": true) %> | ||
| 89 | </button> | ||
| 90 | </li> | ||
| 91 | <% end %> | ||
| 92 | </ul> | ||
| 93 | <%= text_field_tag nil, nil, id: "related_asset_search_term", placeholder: "Search images to attach…", autocomplete: "off" %> | ||
| 94 | <div id="related_asset_search_results" class="search_results"></div> | ||
| 95 | </div> | ||
| 73 | </div> | 96 | </div> |
| 97 | |||
| 98 | <template id="related_asset_template"> | ||
| 99 | <li> | ||
| 100 | <span class="related_asset_handle"><%= icon("grip-vertical", library: "tabler", "aria-hidden": true) %></span> | ||
| 101 | <img src=""> | ||
| 102 | <button type="button" class="related_asset_remove" aria-label="Remove image"> | ||
| 103 | <%= icon("x", library: "tabler", "aria-hidden": true) %> | ||
| 104 | </button> | ||
| 105 | </li> | ||
| 106 | </template> | ||
| 107 | |||
| 74 | </div> | 108 | </div> |
| 75 | </div> | 109 | </details> |
| 76 | 110 | ||
| 77 | <div id="content"> | 111 | <div id="content"> |
| 78 | <div class="node_description">Title</div> | 112 | <div class="node_description">Title</div> |
| 79 | <div class="node_content"><%= d.text_field :title %></div> | 113 | <div class="node_content"><%= d.text_field :title %></div> |
| @@ -83,8 +117,11 @@ | |||
| 83 | 117 | ||
| 84 | <div class="node_description">Body</div> | 118 | <div class="node_description">Body</div> |
| 85 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> | 119 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> |
| 120 | <% end %> | ||
| 86 | 121 | ||
| 87 | <div><%= d.submit 'save' %></div> | 122 | <div class="node_action_bar node_action_bar_save"> |
| 123 | <%= f.submit 'Save Draft' %> | ||
| 124 | <%= f.submit 'Save + Unlock + Exit' %> | ||
| 125 | </div> | ||
| 88 | <% end %> | 126 | <% end %> |
| 89 | <% end %> | ||
| 90 | </div> | 127 | </div> |
