summaryrefslogtreecommitdiff
path: root/app/views/assets/edit.html.erb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-20 19:45:43 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-20 19:45:43 +0200
commit836308471f8d31ccdcdd3a5bd88bc76cc1c0831b (patch)
tree821a526d4d10870654a38d07a4eb53a2180ba313 /app/views/assets/edit.html.erb
parentd89e2de48a5e16ff01ec627e79c76b833e4618cf (diff)
Make headline images explicit, add asset credits
- related_assets gains a `headline` boolean (DB-enforced: at most one per page), replacing "first image by position" as the headline rule. A rake task backfills the current first image on every live head/draft, so nothing changes visually until an editor changes it. - The image picker sidebar gets a star toggle reflecting the flag; the TinyMCE inline-image picker's badge now reads it too, instead of assuming position 0. - No headline chosen (or none attached) now falls back to the gallery-count caption itself becoming the lightbox trigger, instead of the gallery being unreachable. - Assets gain creator, source_url, and license_key (against a new config/asset_licenses.yml dictionary). asset_credit renders a degrading attribution line, reused as a hidden per-image glightbox caption so credit is one click away for every image, not only the headline's always-visible one. - Fixed: asset thumbnails rendered unconditionally regardless of whether a real variant exists on disk. Asset#has_variant? checks file existence, not content type -- some legacy PDFs have real pre-rewrite thumbnails a content-type check would have hidden. - assets#new/edit rebuilt onto the same node_description/node_content layout as assets#show, picking up the three new fields in the process.
Diffstat (limited to 'app/views/assets/edit.html.erb')
-rw-r--r--app/views/assets/edit.html.erb58
1 files changed, 39 insertions, 19 deletions
diff --git a/app/views/assets/edit.html.erb b/app/views/assets/edit.html.erb
index f1986000..3ef8fea5 100644
--- a/app/views/assets/edit.html.erb
+++ b/app/views/assets/edit.html.erb
@@ -1,24 +1,44 @@
1<h1>Editing asset</h1> 1<div id="page_editor">
2 <h1>Editing asset</h1>
2 3
3<%= form_for(@asset, html: { multipart: true }) do |f| %> 4 <%= form_for(@asset, html: { multipart: true }) do |f| %>
4 <%= form_error_messages(f) %> 5 <%= form_error_messages(f) %>
5 6
6 <% if @asset.upload.present? %> 7 <div id="content">
7 <p> 8 <div class="node_description"><%= f.label :name %></div>
8 <strong>Current file:</strong> 9 <div class="node_content"><%= f.text_field :name %></div>
9 <%= @asset.upload.url %> 10
10 (<%= number_to_human_size(@asset.upload.size) %>) 11 <% if @asset.upload.present? %>
11 </p> 12 <div class="node_description">Current File</div>
12 <% end %> 13 <div class="node_content"><%= @asset.upload.url %> (<%= number_to_human_size(@asset.upload.size) %>)</div>
14 <% end %>
15
16 <div class="node_description"><%= f.label :upload, "Replace file" %></div>
17 <div class="node_content"><%= f.file_field :upload %></div>
13 18
14 <p> 19 <div class="node_description"><%= f.label :creator %></div>
15 <label>Replace file:</label><br> 20 <div class="node_content"><%= f.text_field :creator %></div>
16 <%= f.file_field :upload %>
17 </p>
18 21
19 <p> 22 <div class="node_description"><%= f.label :source_url, "Source URL" %></div>
20 <%= f.submit 'Update' %> 23 <div class="node_content"><%= f.text_field :source_url %></div>
21 </p>
22<% end %>
23 24
24<%= link_to 'Show', @asset %> | <%= link_to 'Back', assets_path %> 25 <div class="node_description"><%= f.label :license_key, "License" %></div>
26 <div class="node_content">
27 <%= f.select :license_key,
28 options_for_select(
29 [["— none —", ""]] + AssetLicense.keys.map { |key| [t("asset_licenses.#{key}"), key] },
30 @asset.license_key
31 ) %>
32 </div>
33
34 <div class="node_description">Actions</div>
35 <div class="node_content node_info_group">
36 <div class="node_info_group_items">
37 <div class="node_info_item"><%= f.submit 'Update' %></div>
38 <div class="node_info_item"><%= link_to 'Show', @asset %></div>
39 <div class="node_info_item"><%= link_to 'Back', assets_path %></div>
40 </div>
41 </div>
42 </div>
43 <% end %>
44</div>