diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-22 20:03:50 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-22 20:03:50 +0200 |
| commit | 558ea7764757cfe324bdba72fc5279fa78efd1ea (patch) | |
| tree | 8482e8b90c036e7d06414754e34cfab181fa57e8 /app/views | |
| parent | 24d7f9e8255eccad9346215268e91d28c5909797 (diff) | |
Implement controller and view side of the attach logic
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/assets/edit.html.erb | 17 | ||||
| -rw-r--r-- | app/views/assets/new.html.erb | 17 | ||||
| -rw-r--r-- | app/views/nodes/show.html.erb | 18 |
3 files changed, 46 insertions, 6 deletions
diff --git a/app/views/assets/edit.html.erb b/app/views/assets/edit.html.erb index 3ef8fea5..0c1dd8fe 100644 --- a/app/views/assets/edit.html.erb +++ b/app/views/assets/edit.html.erb | |||
| @@ -31,6 +31,23 @@ | |||
| 31 | ) %> | 31 | ) %> |
| 32 | </div> | 32 | </div> |
| 33 | 33 | ||
| 34 | <div class="node_description">attach to page</div> | ||
| 35 | <div class="node_content"> | ||
| 36 | <div class="restore_picker"> | ||
| 37 | <%= text_field_tag :asset_node_search_term, @attach_node&.title, | ||
| 38 | :placeholder => "Search for a page…", :autocomplete => "off" %> | ||
| 39 | <div id="asset_node_search_results" class="search_results" style="display: none"></div> | ||
| 40 | </div> | ||
| 41 | <%= hidden_field_tag :node_id, @attach_node&.id %> | ||
| 42 | <span class="field_hint">Optional — attaches this asset to that page, all pending versions included.</span> | ||
| 43 | </div> | ||
| 44 | |||
| 45 | <div class="node_description"></div> | ||
| 46 | <div class="node_content"> | ||
| 47 | <label><%= check_box_tag :headline, "1" %> attach as the page's headline</label> | ||
| 48 | <span class="field_hint">Applies only if the page has no headline yet.</span> | ||
| 49 | </div> | ||
| 50 | |||
| 34 | <div class="node_description">Actions</div> | 51 | <div class="node_description">Actions</div> |
| 35 | <div class="node_content node_info_group"> | 52 | <div class="node_content node_info_group"> |
| 36 | <div class="node_info_group_items"> | 53 | <div class="node_info_group_items"> |
diff --git a/app/views/assets/new.html.erb b/app/views/assets/new.html.erb index 2cf88650..7bded949 100644 --- a/app/views/assets/new.html.erb +++ b/app/views/assets/new.html.erb | |||
| @@ -26,6 +26,23 @@ | |||
| 26 | ) %> | 26 | ) %> |
| 27 | </div> | 27 | </div> |
| 28 | 28 | ||
| 29 | <div class="node_description">attach to page</div> | ||
| 30 | <div class="node_content"> | ||
| 31 | <div class="restore_picker"> | ||
| 32 | <%= text_field_tag :asset_node_search_term, @attach_node&.title, | ||
| 33 | :placeholder => "Search for a page…", :autocomplete => "off" %> | ||
| 34 | <div id="asset_node_search_results" class="search_results" style="display: none"></div> | ||
| 35 | </div> | ||
| 36 | <%= hidden_field_tag :node_id, @attach_node&.id %> | ||
| 37 | <span class="field_hint">Optional — attaches this asset to that page, all pending versions included.</span> | ||
| 38 | </div> | ||
| 39 | |||
| 40 | <div class="node_description"></div> | ||
| 41 | <div class="node_content"> | ||
| 42 | <label><%= check_box_tag :headline, "1" %> attach as the page's headline</label> | ||
| 43 | <span class="field_hint">Applies only if the page has no headline yet.</span> | ||
| 44 | </div> | ||
| 45 | |||
| 29 | <div class="node_description">Actions</div> | 46 | <div class="node_description">Actions</div> |
| 30 | <div class="node_content node_info_group"> | 47 | <div class="node_content node_info_group"> |
| 31 | <div class="node_info_group_items"> | 48 | <div class="node_info_group_items"> |
diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index adf79dd8..b981e4b0 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb | |||
| @@ -253,10 +253,10 @@ | |||
| 253 | <% end %> | 253 | <% end %> |
| 254 | </div> | 254 | </div> |
| 255 | 255 | ||
| 256 | <% if @page.assets.any? %> | 256 | <div class="node_description">Attachments</div> |
| 257 | <% headline_asset_id = @page.headline_asset&.id %> | 257 | <div class="node_content node_info_group"> |
| 258 | <div class="node_description">Images</div> | 258 | <% if @page.assets.any? %> |
| 259 | <div class="node_content node_info_group"> | 259 | <% headline_asset_id = @page.headline_asset&.id %> |
| 260 | <ul class="thumbnail_list"> | 260 | <ul class="thumbnail_list"> |
| 261 | <% @page.assets.each do |asset| %> | 261 | <% @page.assets.each do |asset| %> |
| 262 | <li class="<%= "is_headline" if asset.id == headline_asset_id %>"> | 262 | <li class="<%= "is_headline" if asset.id == headline_asset_id %>"> |
| @@ -269,8 +269,14 @@ | |||
| 269 | </li> | 269 | </li> |
| 270 | <% end %> | 270 | <% end %> |
| 271 | </ul> | 271 | </ul> |
| 272 | </div> | 272 | <% end %> |
| 273 | <% end %> | 273 | <p class="add_attachments"> |
| 274 | <%= link_to new_asset_path(:node_id => @node.id), class: 'action_button' do %> | ||
| 275 | <%= icon("paperclip", library: "tabler", "aria-hidden": true) %> Upload new attachment | ||
| 276 | <% end %> | ||
| 277 | <span class="field_hint">To add or remove existing attachments, edit this node instead.</span> | ||
| 278 | </p> | ||
| 279 | </div> | ||
| 274 | 280 | ||
| 275 | <div class="node_description">Events</div> | 281 | <div class="node_description">Events</div> |
| 276 | <div class="node_content node_info_group"> | 282 | <div class="node_content node_info_group"> |
