diff options
Diffstat (limited to 'app/views/nodes')
| -rw-r--r-- | app/views/nodes/_recent_change_item.html.erb | 9 | ||||
| -rw-r--r-- | app/views/nodes/destroy.html.erb | 2 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 26 | ||||
| -rw-r--r-- | app/views/nodes/new.html.erb | 4 | ||||
| -rw-r--r-- | app/views/nodes/recent.html.erb | 6 | ||||
| -rw-r--r-- | app/views/nodes/show.html.erb | 64 | ||||
| -rw-r--r-- | app/views/nodes/trashed.html.erb | 42 |
7 files changed, 140 insertions, 13 deletions
diff --git a/app/views/nodes/_recent_change_item.html.erb b/app/views/nodes/_recent_change_item.html.erb new file mode 100644 index 0000000..754a775 --- /dev/null +++ b/app/views/nodes/_recent_change_item.html.erb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <li> | ||
| 2 | <div> | ||
| 3 | <%= link_to title_for_node(node), node_path(node) %> | ||
| 4 | <span class="field_hint"><%= link_to_path("#{node.unique_name} ↗", node.unique_name) %></span> | ||
| 5 | </div> | ||
| 6 | <span class="dashboard_widget_meta"> | ||
| 7 | <%= (editor = node_head_editor(node)) ? t("last_edited_by", editor: editor) : t("last_edited") %>, <%= relative_time_phrase(node.head.updated_at) %> | ||
| 8 | </span> | ||
| 9 | </li> | ||
diff --git a/app/views/nodes/destroy.html.erb b/app/views/nodes/destroy.html.erb deleted file mode 100644 index 065cf1d..0000000 --- a/app/views/nodes/destroy.html.erb +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | <h1>Nodes#destroy</h1> | ||
| 2 | <p>Find me in app/views/nodes/destroy.html.erb</p> | ||
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index e0e51d8..25f15c2 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -81,7 +81,10 @@ | |||
| 81 | data-create-url="<%= node_related_assets_path(@node) %>"> | 81 | data-create-url="<%= node_related_assets_path(@node) %>"> |
| 82 | <ul id="related_asset_list" class="thumbnail_list"> | 82 | <ul id="related_asset_list" class="thumbnail_list"> |
| 83 | <% @page.related_assets.includes(:asset).each do |related| %> | 83 | <% @page.related_assets.includes(:asset).each do |related| %> |
| 84 | <li data-url="<%= node_related_asset_path(@node, related) %>"> | 84 | <li data-url="<%= node_related_asset_path(@node, related) %>" |
| 85 | data-large-url="<%= related.asset.upload.url(:large) %>" | ||
| 86 | data-original-url="<%= related.asset.upload.url %>" | ||
| 87 | data-name="<%= related.asset.name %>"> | ||
| 85 | <span class="related_asset_handle"><%= icon("grip-vertical", library: "tabler", "aria-hidden": true) %></span> | 88 | <span class="related_asset_handle"><%= icon("grip-vertical", library: "tabler", "aria-hidden": true) %></span> |
| 86 | <%= image_tag related.asset.upload.url(:thumb) %> | 89 | <%= image_tag related.asset.upload.url(:thumb) %> |
| 87 | <button type="button" class="related_asset_remove" aria-label="Remove image"> | 90 | <button type="button" class="related_asset_remove" aria-label="Remove image"> |
| @@ -116,10 +119,27 @@ | |||
| 116 | <div class="node_content"><%= d.text_area :abstract %></div> | 119 | <div class="node_content"><%= d.text_area :abstract %></div> |
| 117 | 120 | ||
| 118 | <div class="node_description">Body</div> | 121 | <div class="node_description">Body</div> |
| 119 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> | 122 | <div class="body_toolbar_row"> |
| 123 | <button type="button" id="preview_toggle" class="view_toggle" aria-pressed="false" aria-label="Toggle live preview" title="Toggle live preview"> | ||
| 124 | <%= icon("layout-sidebar-right", library: "tabler", "aria-hidden": true) %> <span>Live preview</span> | ||
| 125 | </button> | ||
| 126 | <button type="button" id="preview_force_render" class="view_toggle" style="display:none" aria-label="Force preview render" title="Force preview render"> | ||
| 127 | <%= icon("refresh", library: "tabler", "aria-hidden": true) %> <span>Force refresh</span> | ||
| 128 | </button> | ||
| 129 | </div> | ||
| 130 | |||
| 131 | <div id="editor_and_preview"> | ||
| 132 | <div class="preview_content"> | ||
| 133 | <div class="node_content"><%= d.text_area :body, :class => 'with_editor' %></div> | ||
| 134 | </div> | ||
| 135 | <div id="preview_panel" style="display:none"> | ||
| 136 | <iframe id="live_preview_iframe" title="Live preview" data-src="<%= preview_page_path(@page, :locale => I18n.default_locale) %>"></iframe> | ||
| 137 | </div> | ||
| 138 | </div> | ||
| 139 | </div> | ||
| 120 | <% end %> | 140 | <% end %> |
| 121 | 141 | ||
| 122 | <div class="node_action_bar node_action_bar_save"> | 142 | <div class="node_action_bar"> |
| 123 | <%= f.submit 'Save Draft' %> | 143 | <%= f.submit 'Save Draft' %> |
| 124 | <%= f.submit 'Save + Unlock + Exit' %> | 144 | <%= f.submit 'Save + Unlock + Exit' %> |
| 125 | </div> | 145 | </div> |
diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb index b63a606..890d46e 100644 --- a/app/views/nodes/new.html.erb +++ b/app/views/nodes/new.html.erb | |||
| @@ -32,8 +32,8 @@ | |||
| 32 | <div id="parent_search_field" style="<%= @selected_kind == "generic" ? "" : "display: none;" %>"> | 32 | <div id="parent_search_field" style="<%= @selected_kind == "generic" ? "" : "display: none;" %>"> |
| 33 | <div class="node_description">Parent</div> | 33 | <div class="node_description">Parent</div> |
| 34 | <div class="node_content"> | 34 | <div class="node_content"> |
| 35 | <%= text_field_tag :parent_search_term, @parent_name %> | 35 | <%= text_field_tag :parent_search_term, @parent&.title %> |
| 36 | <%= hidden_field_tag :parent_id, @parent_id %> | 36 | <%= hidden_field_tag :parent_id, @parent&.id, data: { unique_name: @parent&.computed_unique_name } %> |
| 37 | <div id="parent_search_results" class="search_results"></div> | 37 | <div id="parent_search_results" class="search_results"></div> |
| 38 | </div> | 38 | </div> |
| 39 | </div> | 39 | </div> |
diff --git a/app/views/nodes/recent.html.erb b/app/views/nodes/recent.html.erb index 3602775..d256253 100644 --- a/app/views/nodes/recent.html.erb +++ b/app/views/nodes/recent.html.erb | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | <h1>Recently changed</h1> | 1 | <h1>Recently changed</h1> |
| 2 | 2 | ||
| 3 | <%= render 'node_list' %> | 3 | <%= will_paginate @nodes %> |
| 4 | <ul id="recent_changes_full_list"> | ||
| 5 | <%= render partial: "nodes/recent_change_item", collection: @nodes, as: :node %> | ||
| 6 | </ul> | ||
| 7 | <%= will_paginate @nodes %> | ||
diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index 66f04f9..af05778 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | <% end %> | 46 | <% end %> |
| 47 | 47 | ||
| 48 | <% unless locked_by_other %> | 48 | <% unless locked_by_other %> |
| 49 | <% if @node.draft && !@node.autosave %> | 49 | <% if @node.draft && !@node.autosave && !@node.in_trash? && !@node.trash_node? %> |
| 50 | <div class="node_info_item"> | 50 | <div class="node_info_item"> |
| 51 | <%= button_to 'Publish', publish_node_path(@node), method: :put, | 51 | <%= button_to 'Publish', publish_node_path(@node), method: :put, |
| 52 | form: { data: { confirm: "Publish this draft?" }, class: 'button_to state_changing' } %> | 52 | form: { data: { confirm: "Publish this draft?" }, class: 'button_to state_changing' } %> |
| @@ -62,6 +62,15 @@ | |||
| 62 | <% end %> | 62 | <% end %> |
| 63 | </div> | 63 | </div> |
| 64 | <% end %> | 64 | <% end %> |
| 65 | <% unless @node.trash_node? || @node.in_trash? || @node.root? %> | ||
| 66 | <div class="node_info_item"> | ||
| 67 | <%= button_to trash_node_path(@node), method: :put, | ||
| 68 | form: { data: { confirm: "Move this page and everything beneath it to the Trash? All published content in it will go offline." }, class: 'button_to destructive' } do %> | ||
| 69 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> | ||
| 70 | Move to Trash | ||
| 71 | <% end %> | ||
| 72 | </div> | ||
| 73 | <% end %> | ||
| 65 | <% end %> | 74 | <% end %> |
| 66 | </div> | 75 | </div> |
| 67 | 76 | ||
| @@ -70,6 +79,48 @@ | |||
| 70 | <% end %> | 79 | <% end %> |
| 71 | </div> | 80 | </div> |
| 72 | 81 | ||
| 82 | <% if @node.in_trash? %> | ||
| 83 | <div class="node_description">Trash</div> | ||
| 84 | <div class="node_content node_info_group"> | ||
| 85 | <div class="node_info_group_items"> | ||
| 86 | <% if (entry = @node.last_trash_entry) && entry.metadata.dig("path", "from") %> | ||
| 87 | <div class="node_info_item"> | ||
| 88 | <span class="node_info_label">Was at</span> | ||
| 89 | <%= entry.metadata.dig("path", "from") %> | ||
| 90 | </div> | ||
| 91 | <% end %> | ||
| 92 | <div class="node_info_item"> | ||
| 93 | <span class="node_info_label">Restore to</span> | ||
| 94 | <% suggestion = @node.suggested_restore_parent %> | ||
| 95 | <%= form_tag restore_from_trash_node_path(@node), :method => :put, :class => "aligned_action_row" do %> | ||
| 96 | <div class="restore_picker"> | ||
| 97 | <%= text_field_tag :restore_search_term, | ||
| 98 | suggestion && (suggestion.head&.title || suggestion.draft&.title || suggestion.slug), | ||
| 99 | :placeholder => "Search for a new parent…" %> | ||
| 100 | <div id="restore_search_results" class="search_results"></div> | ||
| 101 | </div> | ||
| 102 | <%= hidden_field_tag :parent_id, suggestion&.id %> | ||
| 103 | <%= submit_tag "Restore here", :class => "action_button action_button_no_margin_top" %> | ||
| 104 | <% end %> | ||
| 105 | <span class="field_hint">Restored pages come back unpublished. Republish each page deliberately.</span> | ||
| 106 | </div> | ||
| 107 | </div> | ||
| 108 | <div class="node_info_group_items"> | ||
| 109 | <div class="node_info_item"> | ||
| 110 | <% doomed_below = @node.descendants.count %> | ||
| 111 | <%= button_to node_path(@node), method: :delete, | ||
| 112 | form: { data: { confirm: doomed_below > 0 ? | ||
| 113 | "Delete this page and the #{doomed_below} pages beneath it permanently? This cannot be undone." : | ||
| 114 | "Delete this page permanently? This cannot be undone." }, | ||
| 115 | class: 'button_to destructive' } do %> | ||
| 116 | <%= icon("trash-x", library: "tabler", "aria-hidden": true) %> | ||
| 117 | Delete permanently<%= " (including #{doomed_below} beneath)" if doomed_below > 0 %> | ||
| 118 | <% end %> | ||
| 119 | </div> | ||
| 120 | </div> | ||
| 121 | </div> | ||
| 122 | <% end %> | ||
| 123 | |||
| 73 | <div class="node_description">Translations</div> | 124 | <div class="node_description">Translations</div> |
| 74 | <div class="node_content node_info_group"> | 125 | <div class="node_content node_info_group"> |
| 75 | <div class="node_info_group_items"> | 126 | <div class="node_info_group_items"> |
| @@ -170,19 +221,22 @@ | |||
| 170 | </div> | 221 | </div> |
| 171 | </div> | 222 | </div> |
| 172 | 223 | ||
| 173 | <div class="node_description">Revisions</div> | 224 | <div class="node_description">History</div> |
| 174 | <div class="node_content node_info_group"> | 225 | <div class="node_content node_info_group"> |
| 175 | <details> | 226 | <details> |
| 176 | <summary> | 227 | <summary> |
| 177 | <%= pluralize(@node.pages.count, 'revision', 'revisions') %> | 228 | <%= pluralize(@node.pages.count, 'published revision', 'published revisions') %> |
| 178 | </summary> | 229 | </summary> |
| 179 | <ul> | 230 | <ul> |
| 180 | <% @node.pages.order(:revision).each do |page| %> | 231 | <% @node.pages.order(:revision).each do |page| %> |
| 181 | <li><%= link_to "##{page.revision} — #{page.title} (#{page.editor.try(:login)}, #{page.updated_at})", node_revision_path(@node, page) %></li> | 232 | <li> |
| 233 | <%= link_to "##{page.revision} — #{page.title} (#{page.editor.try(:login)}, #{page.updated_at})", node_revision_path(@node, page) %> | ||
| 234 | <span class="revision_lifecycle"><%= revision_lifecycle_badges(@page_actions[page.id]) %></span> | ||
| 235 | </li> | ||
| 182 | <% end %> | 236 | <% end %> |
| 183 | </ul> | 237 | </ul> |
| 184 | </details> | 238 | </details> |
| 185 | <p class="revisions_full_history_link"><%= link_to 'Full history (diff / restore)', node_revisions_path(@node) %></p> | 239 | <p class="revisions_full_history_link"><%= link_to 'Revision history (diff / restore)', node_revisions_path(@node) %> | <%= link_to t("node_actions.heading"), admin_log_path(:node_id => @node.id) %></p> |
| 186 | </div> | 240 | </div> |
| 187 | 241 | ||
| 188 | 242 | ||
diff --git a/app/views/nodes/trashed.html.erb b/app/views/nodes/trashed.html.erb new file mode 100644 index 0000000..9a4808e --- /dev/null +++ b/app/views/nodes/trashed.html.erb | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | <h1>Trash</h1> | ||
| 2 | |||
| 3 | <% if @nodes.empty? %> | ||
| 4 | <p class="field_hint">The Trash is empty.</p> | ||
| 5 | <% else %> | ||
| 6 | <%= will_paginate @nodes %> | ||
| 7 | <table id="trashed_node_list"> | ||
| 8 | <tr> | ||
| 9 | <th>Title</th> | ||
| 10 | <th>Was at</th> | ||
| 11 | <th>Trashed</th> | ||
| 12 | <th>Actions</th> | ||
| 13 | </tr> | ||
| 14 | <% @nodes.each do |node| %> | ||
| 15 | <% entry = node.last_trash_entry %> | ||
| 16 | <tr> | ||
| 17 | <% doomed_below = node.descendants.count %> | ||
| 18 | <td> | ||
| 19 | <%= link_to (node.draft&.title || node.slug), node_path(node) %><%= " (+ #{doomed_below} beneath)" if doomed_below > 0 %> | ||
| 20 | </td> | ||
| 21 | <td><%= entry&.metadata&.dig("path", "from") %></td> | ||
| 22 | <td> | ||
| 23 | <% if entry %> | ||
| 24 | <%= entry.occurred_at.strftime("%Y-%m-%d %H:%M") %> by <%= entry.actor_name %> | ||
| 25 | <% end %> | ||
| 26 | </td> | ||
| 27 | <td> | ||
| 28 | <%= button_to node_path(node), method: :delete, | ||
| 29 | form: { data: { confirm: doomed_below > 0 ? | ||
| 30 | "Delete \"#{node.draft&.title || node.slug}\" and the #{doomed_below} pages beneath it permanently? This cannot be undone." : | ||
| 31 | "Delete \"#{node.draft&.title || node.slug}\" permanently? This cannot be undone." }, | ||
| 32 | class: 'button_to destructive' } do %> | ||
| 33 | <%= icon("trash-x", library: "tabler", "aria-hidden": true) %> | ||
| 34 | Delete permanently | ||
| 35 | <% end %> | ||
| 36 | </td> | ||
| 37 | </tr> | ||
| 38 | <% end %> | ||
| 39 | </table> | ||
| 40 | <%= will_paginate @nodes %> | ||
| 41 | <p class="field_hint">To restore a page, open it and pick a new parent in its Trash section.</p> | ||
| 42 | <% end %> | ||
