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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix up css for hero.
Matthew Kennedy4c57ca3a4abc
diff --git a/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb b/api/app/serializers/spree/v2/storefront/cms_section_serializer.rbindex cc1a93bf56..d73fdb195e 100644--- a/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb+++ b/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb@@ -5,7 +5,7 @@ module Spreeset_type :cms_sectionattributes :name, :title, :subtitle, :button_text, :content, :width,- :full_width_on_small, :boundary, :type, :position+ :full_width_on_small, :fit, :type, :positionbelongs_to :cms_pageenddiff --git a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss b/backend/app/assets/stylesheets/spree/backend/shared/_base.scssindex 5644b91e9a..abc44df6f7 100644--- a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss+++ b/backend/app/assets/stylesheets/spree/backend/shared/_base.scss@@ -15,10 +15,17 @@z-index: $zindex-dropdown;}-// No-margin and no-padding helper classes-@each $side in top bottom left right {- .no-margin-#{$side} { margin-#{side}: 0; }- .no-padding-#{$side} { padding-#{side}: 0; }+figure.admin-img-holder {+ max-width: 200px;+ border: 2px dashed grey;+ border-radius: $border-radius;+ overflow: hidden;+ display: inline-block;++ img {+ max-width: 100%;+ height: auto;+ }}.js-remove-promo-rule-option-value {diff --git a/backend/app/helpers/spree/admin/cms_helper.rb b/backend/app/helpers/spree/admin/cms_helper.rbindex 61c4cf0a6f..5dae3912eb 100644--- a/backend/app/helpers/spree/admin/cms_helper.rb+++ b/backend/app/helpers/spree/admin/cms_helper.rb@@ -9,7 +9,7 @@ module Spree'col-12'end- boundary = case section.boundary+ fit = case section.fitwhen 'Screen''edge'else@@ -19,7 +19,7 @@ module Spreerender 'spree/admin/cms_pages/section_template',section: section,width: css_width,- boundary: boundary+ fit: fitenddef page_preview_link(page)diff --git a/backend/app/views/spree/admin/cms_pages/_form.html.erb b/backend/app/views/spree/admin/cms_pages/_form.html.erbindex 73c0b29c0f..2879754474 100644--- a/backend/app/views/spree/admin/cms_pages/_form.html.erb+++ b/backend/app/views/spree/admin/cms_pages/_form.html.erb@@ -26,7 +26,7 @@<div class="row pb-0"><%= f.field_container :title, class: ['form-group col-6'] do %>- <%= f.label :title, raw(Spree.t('admin.cms.name') + required_span_tag) %>+ <%= f.label :title, raw(Spree.t('admin.cms.title') + required_span_tag) %><%= f.text_field :title, class: 'form-control', required: true %><%= f.error_message_on :title %><% end %>diff --git a/backend/app/views/spree/admin/cms_pages/_section_template.html.erb b/backend/app/views/spree/admin/cms_pages/_section_template.html.erbindex d7a402f8e0..1f4235f7e7 100644--- a/backend/app/views/spree/admin/cms_pages/_section_template.html.erb+++ b/backend/app/views/spree/admin/cms_pages/_section_template.html.erb@@ -1,4 +1,4 @@-<div class="<%= width %> <%= boundary %> removable-dom-element" data-section-id="<%= section.id %>">+<div class="<%= width %> <%= fit %> removable-dom-element" data-section-id="<%= section.id %>"><div class="row m-0 mb-1 pb-0 border border-secondary bg-white"><div class="col move-handle d-flex pr-0 truncate"><div class="<% if section.full_width_on_small %>py-2<% else %>py-3<% end %> align-items-center overflow-hidden w-100">diff --git a/backend/app/views/spree/admin/cms_sections/_form.html.erb b/backend/app/views/spree/admin/cms_sections/_form.html.erbindex b5b1145731..ca0c890ef9 100644--- a/backend/app/views/spree/admin/cms_sections/_form.html.erb+++ b/backend/app/views/spree/admin/cms_sections/_form.html.erb@@ -3,7 +3,7 @@<div class="col-12"><div class="card mb-3"><div class="card-header">- <h5 class="mb-0"><%= Spree.t('admin.cms_section.settings') %></h5>+ <h5 class="mb-0"><%= Spree.t('settings') %></h5></div><div class="card-body"><div class="row">@@ -16,7 +16,7 @@</div><div class="col-12 col-md-6"><%= f.field_container :type, class: ['form-group'] do %>- <%= f.label :type, Spree.t('admin.navigation.section_type') %>+ <%= f.label :type, Spree.t('admin.cms.section_type') %><%= f.select(:type, spree_humanize_dropdown_values('Spree::CmsSection', {const: 'TYPES'}), {include_blank: false}) %><%= f.error_message_on :type %><% end %>diff --git a/backend/app/views/spree/admin/cms_sections/edit.html.erb b/backend/app/views/spree/admin/cms_sections/edit.html.erbindex a9e1c140e5..30ddf237f2 100644--- a/backend/app/views/spree/admin/cms_sections/edit.html.erb+++ b/backend/app/views/spree/admin/cms_sections/edit.html.erb@@ -1,13 +1,13 @@<% content_for :page_title do %>- <%= link_to Spree.t('admin.cms_section.all_pages'), spree.admin_cms_pages_path %> /+ <%= link_to Spree.t('admin.cms.all_pages'), spree.admin_cms_pages_path %> /<%= link_to @cms_page.title, spree.edit_admin_cms_page_path(@cms_page) %> / <%= @cms_section.name %><% end %><% content_for :page_actions do %><%= button_link_to(- Spree.t('admin.cms.back_to_full_screen_mode'),+ Spree.t('admin.cms.exit_to_full_screen_mode'),spree.edit_admin_cms_page_path(@cms_page) + '?section_editor_full_screen_mode=true',- class: 'btn-outline-secondary', icon: 'view.svg', id: 'admin_preview_product'+ class: 'btn-outline-secondary', icon: 'move.svg', id: 'admin_preview_product') %><% end %>diff --git a/backend/app/views/spree/admin/cms_sections/new.html.erb b/backend/app/views/spree/admin/cms_sections/new.html.erbindex 45fba15236..126d39c2a1 100644--- a/backend/app/views/spree/admin/cms_sections/new.html.erb+++ b/backend/app/views/spree/admin/cms_sections/new.html.erb@@ -1,5 +1,5 @@<% content_for :page_title do %>- <%= link_to Spree.t('admin.cms_section.all_pages'), spree.admin_cms_pages_path %> /+ <%= link_to Spree.t('admin.cms.all_pages'), spree.admin_cms_pages_path %> /<%= link_to @cms_page.title, spree.edit_admin_cms_page_path(@cms_page) %> / <%= Spree.t('admin.cms.new_section') %><% end %>diff --git a/backend/app/views/spree/admin/cms_sections/types/_featured_article.html.erb b/backend/app/views/spree/admin/cms_sections/types/_featured_article.html.erbindex 5d4b7937eb..dfa0669ff0 100644--- a/backend/app/views/spree/admin/cms_sections/types/_featured_article.html.erb+++ b/backend/app/views/spree/admin/cms_sections/types/_featured_article.html.erb@@ -20,15 +20,15 @@<div class="row"><%= f.field_container :width, class: ['form-group col-6'] do %>- <%= f.label :width, Spree.t('admin.navigation.width') %>+ <%= f.label :width, Spree.t('admin.cms.width') %><%= f.select(:width, @cms_section.widths, {include_blank: false}, class: 'select2') %><%= f.error_message_on :width %><% end %>- <%= f.field_container :boundary, class: ['form-group col-6'] do %>- <%= f.label :boundary, Spree.t('admin.navigation.boundary') %>- <%= f.select(:boundary, @cms_section.boundaries, {include_blank: false}, class: 'select2') %>- <%= f.error_message_on :boundary %>+ <%= f.field_container :fit, class: ['form-group col-6'] do %>+ <%= f.label :fit, Spree.t('admin.cms.fit') %>+ <%= f.select(:fit, @cms_section.boundaries, {include_blank: false}, class: 'select2') %>+ <%= f.error_message_on :fit %><% end %></div></div>diff --git a/backend/app/views/spree/admin/cms_sections/types/_hero.html.erb b/backend/app/views/spree/admin/cms_sections/types/_hero.html.erbindex d87b1b9ee0..a8b6bc8500 100644--- a/backend/app/views/spree/admin/cms_sections/types/_hero.html.erb+++ b/backend/app/views/spree/admin/cms_sections/types/_hero.html.erb@@ -1,42 +1,40 @@<div class="row"><div class="col-12 col-md-6"><%= f.field_container :title, class: ['form-group'] do %>- <%= f.label :title, Spree.t(:title) %>+ <%= f.label :title, Spree.t('admin.cms.title') %><%= f.text_field :title, class: 'form-control' %><%= f.error_message_on :title %><% end %><%= f.field_container :button_text, class: ['form-group'] do %>- <%= f.label :button_text, Spree.t(:button_text) %>+ <%= f.label :button_text, Spree.t('admin.cms.button_text') %><%= f.text_field :button_text, class: 'form-control' %><%= f.error_message_on :button_text %><% end %>- <%= f.field_container :boundary, class: ['form-group'] do %>- <%= f.label :boundary, Spree.t('admin.navigation.boundary') %>- <%= f.select(:boundary, @cms_section.boundaries, {include_blank: false}, class: 'select2') %>- <%= f.error_message_on :boundary %>+ <%= f.field_container :fit, class: ['form-group'] do %>+ <%= f.label :fit, Spree.t('admin.cms.fit') %>+ <%= f.select(:fit, @cms_section.boundaries, {include_blank: false}, class: 'select2') %>+ <%= f.error_message_on :fit %><% end %></div>- <div class="col-12 col-md-6">+ <div class="col-12 col-md-6 pt-4"><% @cms_section.build_icon unless @cms_section.icon %><%= f.fields_for :icon do |icon_field| %><%= f.field_container :icon_attachment do %><% unless @cms_section.icon.new_record? %>- <div id="menuItemImgContainer" class="my-3 ">+ <figure class="admin-img-holder"><%= image_tag(main_app.url_for(@cms_section.icon.attachment)) %>- </div>+ </figure><% end %>- <div id="<% unless @cms_section.icon.new_record? %>MenuItemImageButton<% end %>"><%= icon_field.file_field :attachment %>- </div><% end %><small class="form-text text-muted"><%= Spree.t('admin.cms.hero.aspect_ratio') %></small><%= f.field_container :icon_alt do %><% unless @cms_section.icon.new_record? %><div class="form-group my-3">- <%= icon_field.label :alt, Spree.t('admin.navigation.image_alt_text') %>+ <%= icon_field.label :alt, Spree.t('image_alt_text') %><%= icon_field.text_field :alt, class: 'form-control' %></div><% end %>diff --git a/backend/app/views/spree/admin/cms_sections/types/_promo.html.erb b/backend/app/views/spree/admin/cms_sections/types/_promo.html.erbindex 93302175cb..a2550c1166 100644--- a/backend/app/views/spree/admin/cms_sections/types/_promo.html.erb+++ b/backend/app/views/spree/admin/cms_sections/types/_promo.html.erb@@ -12,10 +12,10 @@<%= f.error_message_on :subtitle %><% end %>- <%= f.field_container :boundary, class: ['form-group'] do %>- <%= f.label :boundary, Spree.t('admin.navigation.boundary') %>- <%= f.select(:boundary, @cms_section.boundaries, {include_blank: false}, class: 'select2') %>- <%= f.error_message_on :boundary %>+ <%= f.field_container :fit, class: ['form-group'] do %>+ <%= f.label :fit, Spree.t('admin.cms.fit') %>+ <%= f.select(:fit, @cms_section.boundaries, {include_blank: false}, class: 'select2') %>+ <%= f.error_message_on :fit %><% end %><div class="row">@@ -46,7 +46,7 @@<%= f.field_container :icon_alt do %><% unless @cms_section.icon.new_record? %><div class="form-group my-3">- <%= icon_field.label :alt, Spree.t('admin.navigation.image_alt_text') %>+ <%= icon_field.label :alt, Spree.t('image_alt_text') %><%= icon_field.text_field :alt, class: 'form-control' %></div><% end %>diff --git a/core/app/models/spree/cms/sections/brands.rb b/core/app/models/spree/cms/sections/brands.rbindex 86911ddef3..ad076b6fc4 100644--- a/core/app/models/spree/cms/sections/brands.rb+++ b/core/app/models/spree/cms/sections/brands.rb@@ -10,7 +10,7 @@ module Spree::Cms::Sectionsdef default_valuesself.width ||= 'Full'- self.boundary ||= 'Screen'+ self.fit ||= 'Screen'endendenddiff --git a/core/app/models/spree/cms/sections/carousel.rb b/core/app/models/spree/cms/sections/carousel.rbindex aa8194a50f..0473f9cd55 100644--- a/core/app/models/spree/cms/sections/carousel.rb+++ b/core/app/models/spree/cms/sections/carousel.rb@@ -12,7 +12,7 @@ module Spree::Cms::Sectionsdef default_valuesself.width ||= 'Full'- self.boundary ||= 'Screen'+ self.fit ||= 'Screen'self.linked_resource_type ||= 'Spree::Taxon'endenddiff --git a/core/app/models/spree/cms/sections/featured_article.rb b/core/app/models/spree/cms/sections/featured_article.rbindex a2911121c7..2572b8eb67 100644--- a/core/app/models/spree/cms/sections/featured_article.rb+++ b/core/app/models/spree/cms/sections/featured_article.rb@@ -12,7 +12,7 @@ module Spree::Cms::Sectionsdef default_valuesself.width ||= 'Full'- self.boundary ||= 'Screen'+ self.fit ||= 'Screen'self.linked_resource_type ||= 'Spree::Taxon'endenddiff --git a/core/app/models/spree/cms/sections/hero.rb b/core/app/models/spree/cms/sections/hero.rbindex b076b192ef..9295f11a49 100644--- a/core/app/models/spree/cms/sections/hero.rb+++ b/core/app/models/spree/cms/sections/hero.rb@@ -15,7 +15,7 @@ module Spree::Cms::Sectionsdef default_valuesself.width ||= 'Full'- self.boundary ||= 'Screen'+ self.fit ||= 'Screen'self.linked_resource_type ||= 'Spree::Taxon'endenddiff --git a/core/app/models/spree/cms/sections/promo.rb b/core/app/models/spree/cms/sections/promo.rbindex 65e6418a9c..ffb30c16a5 100644--- a/core/app/models/spree/cms/sections/promo.rb+++ b/core/app/models/spree/cms/sections/promo.rb@@ -16,7 +16,7 @@ module Spree::Cms::Sectionsdef default_valuesself.width ||= 'Half'- self.boundary ||= 'Container'+ self.fit ||= 'Container'self.linked_resource_type ||= 'Spree::Taxon'endenddiff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 0ffc43927d..cdec448cf9 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -557,6 +557,9 @@ en:draft_mode: Draft Modefull_width: Full widthtitle: Title+ fit: Fit To+ button_text: Button Text+ exit_to_full_screen_mode: Exit To Full Screenpage_type: Page Typeyou_have_no_pages: You have no pages, click the Add New Page button to get started.new_page: New Page@@ -566,8 +569,9 @@ en:preview_page: Preview Pagefull_screen_mode: '<span class="exit">Exit </span>Full Screen Mode'hero:- aspect_ratio: Please use an image with the aspext ratio of 12:5 (2400px x 1000px)+ aspect_ratio: Please use an image with the aspect ratio of 12:5 (2400px x 1000px)select_page_type: Select a page type+ section_type: Section Typeclick_button_to_change_page_type: Click the <b>%{button_type}</b> button to load the options for this page type.more_page_settings: '<span class="more">More</span><span class="less">Less</span> Page Settings'seo_settings: SEO Settings@@ -1015,6 +1019,7 @@ en:icon: Iconimage: Imageimages: Images+ image_alt_text: Add Alt text to your imageimplement_eligible_for_return: "Must implement #eligible_for_return? for your EligibilityValidator."implement_requires_manual_intervention: "Must implement #requires_manual_intervention? for your EligibilityValidator."in_stock: In Stockdiff --git a/core/db/migrate/20210512191732_create_spree_cms_pages.rb b/core/db/migrate/20210512191732_create_spree_cms_pages.rbindex e086b2443a..894783e83e 100644--- a/core/db/migrate/20210512191732_create_spree_cms_pages.rb+++ b/core/db/migrate/20210512191732_create_spree_cms_pages.rb@@ -5,7 +5,7 @@ class CreateSpreeCmsPages < ActiveRecord::Migration[5.2]t.column :meta_title, :stringt.column :content, :textt.column :meta_description, :text- t.column :visible, :boolean, default: false+ t.column :visible, :boolean, default: truet.column :slug, :stringt.column :type, :stringt.column :locale, :stringdiff --git a/core/db/migrate/20210514204251_create_spree_cms_sections.rb b/core/db/migrate/20210514204251_create_spree_cms_sections.rbindex dd2888cee6..876a9fde0e 100644--- a/core/db/migrate/20210514204251_create_spree_cms_sections.rb+++ b/core/db/migrate/20210514204251_create_spree_cms_sections.rb@@ -8,7 +8,8 @@ class CreateSpreeCmsSections < ActiveRecord::Migration[5.2]t.column :content, :textt.column :width, :stringt.column :full_width_on_small, :boolean, default: false- t.column :boundary, :string+ t.column :fit, :string+ t.column :destination, :stringt.column :type, :stringt.column :position, :integerdiff --git a/frontend/app/helpers/spree/cms_pages_helper.rb b/frontend/app/helpers/spree/cms_pages_helper.rbindex 7fbd07aaaf..c847d80936 100644--- a/frontend/app/helpers/spree/cms_pages_helper.rb+++ b/frontend/app/helpers/spree/cms_pages_helper.rb@@ -31,7 +31,7 @@ module Spreeendend- boundary = case section.boundary+ fit = case section.fitwhen 'Screen''full-width 'else@@ -40,7 +40,7 @@ module Spreerender "spree/shared/cms/sections/#{spree_resource_path(section)}", section: section,width: css_width,- boundary: boundary,+ fit: fit,element: elementendenddiff --git a/frontend/app/views/spree/shared/_carousel_4_products.html.erb b/frontend/app/views/spree/shared/_carousel_4_products.html.erbindex 029d764d23..0ab75af08e 100644--- a/frontend/app/views/spree/shared/_carousel_4_products.html.erb+++ b/frontend/app/views/spree/shared/_carousel_4_products.html.erb@@ -1,4 +1,4 @@-<% cache [common_product_cache_keys, products&.maximum(:updated_at).to_i, id, products&.ids&.join(',')] do %>+<% cache [common_product_cache_keys, products&.pluck(:updated_at)&.last&.to_i, id, products&.ids&.join(',')] do %><div id="<%= id %>-mobile" class="carousel slide d-md-none homepage-carousel" data-interval="false"><div class="carousel-inner"><% products.each_slice(2).with_index do |sliced_items, index| %>diff --git a/frontend/app/views/spree/shared/cms/sections/_brands.html.erb b/frontend/app/views/spree/shared/cms/sections/_brands.html.erbindex 21fa688cb2..9da6f2997a 100644--- a/frontend/app/views/spree/shared/cms/sections/_brands.html.erb+++ b/frontend/app/views/spree/shared/cms/sections/_brands.html.erb@@ -1,5 +1,5 @@<div class="<%= width %> mb-3">- <div class="<%= boundary %>">+ <div class="<%= fit %>"><div class="row py-4"><% if section.title.present? || section.subtitle.present? %><div class="col-12 mb-3 text-center">diff --git a/frontend/app/views/spree/shared/cms/sections/_carousel.html.erb b/frontend/app/views/spree/shared/cms/sections/_carousel.html.erbindex 587304a065..af31c4ce18 100644--- a/frontend/app/views/spree/shared/cms/sections/_carousel.html.erb+++ b/frontend/app/views/spree/shared/cms/sections/_carousel.html.erb@@ -1,5 +1,5 @@<div class="<%= width %>">- <div class="<%= boundary %>">+ <div class="<%= fit %>"><div data-product-carousel-taxon-id='<%= section.linked_resource.permalink %>' class="my-3"></div></div></div>diff --git a/frontend/app/views/spree/shared/cms/sections/_featured_article.html.erb b/frontend/app/views/spree/shared/cms/sections/_featured_article.html.erbindex 74a038a709..06d661d0cb 100644--- a/frontend/app/views/spree/shared/cms/sections/_featured_article.html.erb+++ b/frontend/app/views/spree/shared/cms/sections/_featured_article.html.erb@@ -1,5 +1,5 @@<<%= element %> class="<%= width %> mb-3">- <div class="<%= boundary %>">+ <div class="<%= fit %>"><div class="homepage-fashion-trends-box"><div class="text-center">diff --git a/frontend/app/views/spree/shared/cms/sections/_hero.html.erb b/frontend/app/views/spree/shared/cms/sections/_hero.html.erbindex 78c87a8379..08b53943d8 100644--- a/frontend/app/views/spree/shared/cms/sections/_hero.html.erb+++ b/frontend/app/views/spree/shared/cms/sections/_hero.html.erb@@ -1,5 +1,5 @@<div class="<%= width %>">- <div class="<%= boundary %>">+ <div class="<%= fit %>"><div class="homepage-hero-image mb-3 position-relative p-0"><% if section.icon.present? %><!-- XS to MD -->diff --git a/frontend/app/views/spree/shared/cms/sections/_promo.html.erb b/frontend/app/views/spree/shared/cms/sections/_promo.html.erbindex 1fc9e1078c..efad183307 100644--- a/frontend/app/views/spree/shared/cms/sections/_promo.html.erb+++ b/frontend/app/views/spree/shared/cms/sections/_promo.html.erb@@ -1,5 +1,5 @@<aside class="<%= width %> mb-3">- <div class="<%= boundary %>">+ <div class="<%= fit %>"><%= link_to section.link do %><div class="d-flexalign-items-end