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.

Admin: Fixed theme preview dimensions on Storefront / Themes

Damian Legawiec11eccbccac00
diff --git a/admin/app/views/spree/admin/dashboard/_store_preview.html.erb b/admin/app/views/spree/admin/dashboard/_store_preview.html.erb
index 8b59a47964..e0d7c26305 100644
--- a/admin/app/views/spree/admin/dashboard/_store_preview.html.erb
+++ b/admin/app/views/spree/admin/dashboard/_store_preview.html.erb
@@ -1,5 +1,5 @@
<% if current_store.default_theme %>
- <div class="card mb-4 bg-transparent">
+ <div class="card mb-4">
<%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'd-block border rounded mx-2 mt-2 mb-0 overflow-auto bg-light position-relative store-preview-link' do %>
<div class="position-absolute w-100 h-100 align-items-center justify-content-center overlay-background store-preview-actions">
<button class="btn btn-primary">
diff --git a/admin/app/views/spree/admin/themes/_theme.html.erb b/admin/app/views/spree/admin/themes/_theme.html.erb
index 2aa3780c4a..d6091d8a26 100644
--- a/admin/app/views/spree/admin/themes/_theme.html.erb
+++ b/admin/app/views/spree/admin/themes/_theme.html.erb
@@ -1,9 +1,11 @@
<tr id="<%= spree_dom_id theme %>">
<td class="w-70 p-0">
<%= link_to theme.ready? ? spree.edit_admin_theme_path(theme) : '#', class: 'd-flex align-items-top p-3' do %>
- <%= render 'spree/admin/themes/theme_preview_image', theme: theme %>
+ <div class="w-20">
+ <%= render 'spree/admin/themes/theme_preview_image', theme: theme, css_class: 'img-thumbnail w-100' %>
+ </div>
- <div class="d-flex flex-column ml-3">
+ <div class="d-flex flex-column ml-3 w-80">
<strong><%= theme.name %></strong>
<p class="mb-0 mt-1">
<span class="text-muted">
diff --git a/admin/app/views/spree/admin/themes/_theme_preview_image.html.erb b/admin/app/views/spree/admin/themes/_theme_preview_image.html.erb
index 317d5649d7..7f28f60374 100644
--- a/admin/app/views/spree/admin/themes/_theme_preview_image.html.erb
+++ b/admin/app/views/spree/admin/themes/_theme_preview_image.html.erb
@@ -1,12 +1,13 @@
<% width ||= 120 %>
<% height ||= 72 %>
+<% css_class ||= 'img-thumbnail border-0' %>
<% if theme.screenshot.attached? && theme.screenshot.variable? %>
- <%= image_tag(spree_image_url(theme.screenshot, width: width, height: height), class: 'img-thumbnail border-0', loading: :lazy) %>
+ <%= image_tag(spree_image_url(theme.screenshot, width: width, height: height), class: css_class, loading: :lazy) %>
<% elsif theme.class.preview_image_url.present? %>
<%= image_tag(
theme.class.preview_image_url,
- class: 'img-thumbnail border-0',
+ class: css_class,
loading: :lazy
) %>
<% else %>