Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add active_storage/action_text views (#12586)

Damian Kaczmarczykf7476f13b7b9
diff --git a/core/app/views/active_storage/blobs/_blob.html.erb b/core/app/views/active_storage/blobs/_blob.html.erb
new file mode 100644
index 0000000000..b4655324a9
--- /dev/null
+++ b/core/app/views/active_storage/blobs/_blob.html.erb
@@ -0,0 +1,20 @@
+<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
+ <% if blob.representable? %>
+ <%= image_tag main_app.cdn_image_url(
+ blob.variant(
+ spree_image_variant_options(
+ resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]
+ )
+ )
+ ) %>
+ <% end %>
+
+ <figcaption class="attachment__caption">
+ <% if caption = blob.try(:caption) %>
+ <%= caption %>
+ <% else %>
+ <span class="attachment__name"><%= blob.filename %></span>
+ <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
+ <% end %>
+ </figcaption>
+</figure>
diff --git a/core/app/views/layouts/action_text/contents/_content.html.erb b/core/app/views/layouts/action_text/contents/_content.html.erb
new file mode 100644
index 0000000000..9e3c0d0dff
--- /dev/null
+++ b/core/app/views/layouts/action_text/contents/_content.html.erb
@@ -0,0 +1,3 @@
+<div class="trix-content">
+ <%= yield -%>
+</div>