summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-14 17:25:37 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-14 18:30:40 +0200
commit6ddc9d73f1299cdeb90bc88ed0bb53821c4825aa (patch)
tree7672dd034ec0bacdaa1534813981a5f5de5a7650
parent8847db139bef9dd8f9465c31438f16af13593267 (diff)
Supply related-asset URLs/name and public inline-image CSS
RelatedAssetsController#create's JSON includes large_url, original_url, and name alongside thumb_url/url; the related-asset list items in both editors carry them as data-large-url, data-original-url, and data-name. ccc.css gets the public-facing .inline-image--full/--half/--left/ --right rules -- admin.css and TinyMCE's content_style cover the cockpit and in-editor renderings respectively.
-rw-r--r--app/controllers/related_assets_controller.rb2
-rw-r--r--app/views/nodes/edit.html.erb5
-rw-r--r--app/views/page_translations/edit.html.erb9
-rw-r--r--public/stylesheets/ccc.css21
4 files changed, 36 insertions, 1 deletions
diff --git a/app/controllers/related_assets_controller.rb b/app/controllers/related_assets_controller.rb
index 479ebec..5af73fc 100644
--- a/app/controllers/related_assets_controller.rb
+++ b/app/controllers/related_assets_controller.rb
@@ -27,6 +27,8 @@ class RelatedAssetsController < ApplicationController
27 asset_id: asset.id, 27 asset_id: asset.id,
28 name: asset.name, 28 name: asset.name,
29 thumb_url: asset.upload.url(:thumb), 29 thumb_url: asset.upload.url(:thumb),
30 large_url: asset.upload.url(:large),
31 original_url: asset.upload.url,
30 url: node_related_asset_path(@node, related) 32 url: node_related_asset_path(@node, related)
31 } 33 }
32 end 34 end
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb
index 9506995..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">
diff --git a/app/views/page_translations/edit.html.erb b/app/views/page_translations/edit.html.erb
index 0f64d40..00bf221 100644
--- a/app/views/page_translations/edit.html.erb
+++ b/app/views/page_translations/edit.html.erb
@@ -20,6 +20,15 @@
20</div> 20</div>
21 21
22<div id="page_editor"> 22<div id="page_editor">
23 <ul id="related_asset_list" style="display:none">
24 <% @page.related_assets.includes(:asset).each do |related| %>
25 <li data-large-url="<%= related.asset.upload.url(:large) %>"
26 data-original-url="<%= related.asset.upload.url %>"
27 data-name="<%= related.asset.name %>">
28 <%= image_tag related.asset.upload.url(:thumb) %>
29 </li>
30 <% end %>
31 </ul>
23 <%= form_with url: node_translation_path(@node, @locale), method: :patch, local: true, id: "translation_edit_form", 32 <%= form_with url: node_translation_path(@node, @locale), method: :patch, local: true, id: "translation_edit_form",
24 data: { autosave_url: autosave_node_translation_path(@node, @locale), show_url: node_path(@node) } do |f| %> 33 data: { autosave_url: autosave_node_translation_path(@node, @locale), show_url: node_path(@node) } do |f| %>
25 <div id="content"> 34 <div id="content">
diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css
index bb4f7e3..cbeea17 100644
--- a/public/stylesheets/ccc.css
+++ b/public/stylesheets/ccc.css
@@ -627,3 +627,24 @@ label[for=light-mode] {
627.chapter_partial_content { 627.chapter_partial_content {
628 min-width: 0; 628 min-width: 0;
629} 629}
630
631
632.inline-image--full {
633 width: 100%;
634 margin: 1rem 0;
635}
636
637.inline-image--half {
638 width: 48%;
639 margin-bottom: 1rem;
640}
641
642.inline-image--left {
643 float: left;
644 margin-right: 1rem;
645}
646
647.inline-image--right {
648 float: right;
649 margin-left: 1rem;
650}