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.

Refine cms_sections

Matthew Kennedyf21f945c1fd4
diff --git a/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb b/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb
index 9c7cf9a8ad..69942f5779 100644
--- a/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb
+++ b/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb
@@ -4,8 +4,7 @@ module Spree
class CmsSectionSerializer < BaseSerializer
set_type :cms_section
- attributes :name, :options, :content, :width,
- :full_width_on_small, :fit, :type, :position
+ attributes :name, :content, :settings, :link, :fit, :type, :position
attribute :image_one_path do |section|
if section.image_one_path.attached?
@@ -49,6 +48,10 @@ module Spree
end
end
+ attribute :is_fullscreen do |section|
+ section.fullscreen?
+ end
+
belongs_to :cms_page
end
end
diff --git a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
index 441fc40910..f2cf39c2ea 100644
--- a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
+++ b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss
@@ -43,7 +43,6 @@ button#cmsSectionEditorFullScreen {
overflow-x: hidden;
overflow-y: scroll;
max-height: 553px;
- padding-top: 5px !important;
.border {
border-color: #9c9c9c !important;
@@ -56,69 +55,6 @@ button#cmsSectionEditorFullScreen {
&::-webkit-scrollbar {
display: none;
}
-
- // Reduce the padding size for cols inside the
- // page sections drag and drop organizer, we need that space badly.
- .col-xl, .col-xl-auto, .col-xl-12,
- .col-xl-11, .col-xl-10, .col-xl-9,
- .col-xl-8, .col-xl-7, .col-xl-6,
- .col-xl-5, .col-xl-4, .col-xl-3,
- .col-xl-2, .col-xl-1, .col-lg,
- .col-lg-auto, .col-lg-12, .col-lg-11,
- .col-lg-10, .col-lg-9, .col-lg-8, .col-lg-7,
- .col-lg-6, .col-lg-5, .col-lg-4, .col-lg-3, .col-lg-2,
- .col-lg-1, .col-md, .col-md-auto, .col-md-12, .col-md-11,
- .col-md-10, .col-md-9, .col-md-8, .col-md-7, .col-md-6, .col-md-5,
- .col-md-4, .col-md-3, .col-md-2, .col-md-1, .col-sm, .col-sm-auto,
- .col-sm-12, .col-sm-11, .col-sm-10, .col-sm-9, .col-sm-8, .col-sm-7,
- .col-sm-6, .col-sm-5, .col-sm-4, .col-sm-3, .col-sm-2, .col-sm-1, .col,
- .col-auto, .col-12, .col-11, .col-10, .col-9, .col-8, .col-7, .col-6,
- .col-5, .col-4, .col-3, .col-2, .col-1 {
- padding-right: 7.5px;
- padding-left: 7.5px;
- }
-
- .cms_section_preview_image_holder {
- position: relative;
- border: 1px solid $border-color;
- border-radius: 7px;
- overflow: hidden;
- width: 75px;
- height: 75px;
- img {
- position: absolute;
- left: 50%;
- top: 50%;
- height: 100%;
- width: auto;
- transform: translate(-50%,-50%);
- }
- }
-
- .edge {
- padding-left: 0;
- padding-right: 0;
- }
-
- .cms_section_action_col {
- max-width: 34px;
- text-align: center;
-
- a.btn-sm {
- height: 100%;
- display: flex;
- margin: 0;
- border-radius: 0;
- svg {
- align-self: center;
- margin: 0;
- }
- }
- }
-
- .v-seperator {
- border-left: 1px solid #dee2e6;
- }
}
body[data-sections-editor-full-screen] {
diff --git a/backend/app/helpers/spree/admin/cms_helper.rb b/backend/app/helpers/spree/admin/cms_helper.rb
index b001bb7795..7dbe32a1f5 100644
--- a/backend/app/helpers/spree/admin/cms_helper.rb
+++ b/backend/app/helpers/spree/admin/cms_helper.rb
@@ -2,13 +2,6 @@ module Spree
module Admin
module CmsHelper
def build_page_section(section)
- css_width = case section.width
- when 'Half'
- 'col-6'
- else
- 'col-12'
- end
-
fit = case section.fit
when 'Screen'
'edge'
@@ -18,7 +11,6 @@ module Spree
render 'spree/admin/cms_pages/section_template',
section: section,
- width: css_width,
fit: fit
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.erb
index c9194fda67..8054f61861 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,15 +1,9 @@
-<div class="<%= width %> <%= fit %> removable-dom-element" data-section-id="<%= section.id %>">
+<div class="<%= fit %> col-12 p-0 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">
+ <div class="py-3 align-items-center overflow-hidden w-100">
<h6 class="m-0"><%= section.name %></h6>
<small class="form-text mt-0 text-muted"><%= spree_humanize_type(section.type) %></small>
- <% if section.full_width_on_small %>
- <small class="form-text mt-1">
- <%= svg_icon name: "phone.svg", width: '23', height: '23' %>
- <%= Spree.t('admin.cms.full_width') %>
- </small>
- <% end %>
</div>
</div>
<div>
diff --git a/backend/app/views/spree/admin/cms_pages/edit.html.erb b/backend/app/views/spree/admin/cms_pages/edit.html.erb
index ca025505ba..435ea6f5d2 100644
--- a/backend/app/views/spree/admin/cms_pages/edit.html.erb
+++ b/backend/app/views/spree/admin/cms_pages/edit.html.erb
@@ -39,9 +39,9 @@
</div>
</div>
<div class="row no-gutters">
- <div class="col-12 col-md-4 bg-light border border-right-0">
+ <div class="col-12 col-md-3 bg-light border border-right-0">
<% if @cms_page.cms_sections.any? %>
- <div id="cmsPagesectionsArea" class="card-body row m-0 p-0 no-gutters">
+ <div id="cmsPagesectionsArea" class="card-body row m-0 p-1 no-gutters">
<% @cms_page.cms_sections.each do |section| %>
<%= build_page_section(section) %>
<% end %>
@@ -58,7 +58,7 @@
<% end %>
</div>
- <div class="d-none d-md-block col-8 bg-secondary border">
+ <div class="d-none d-md-block col bg-secondary border">
<div id="liveViewCont" class="desktopLiveView">
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item"
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.erb
index dfa0669ff0..6fe1d59d44 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
@@ -19,12 +19,6 @@
<% end %>
<div class="row">
- <%= f.field_container :width, class: ['form-group col-6'] do %>
- <%= 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 :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') %>
@@ -33,10 +27,10 @@
</div>
</div>
<div class="col-12 col-md-8">
- <%= f.field_container :content, class: ['form-group'] do %>
- <%= f.label :width, Spree.t('content') %>
- <%= f.text_area :content, { rows: "20", class: 'form-control spree-rte' } %>
- <%= f.error_message_on :content %>
+ <%= f.field_container :rte_content, class: ['form-group'] do %>
+ <%= f.label :rte_content, Spree.t('content') %>
+ <%= f.text_area :rte_content, { rows: "20", class: 'form-control spree-rte' } %>
+ <%= f.error_message_on :rte_content %>
<% end %>
</div>
<div class="col-12"><hr></div>
diff --git a/backend/app/views/spree/admin/cms_sections/types/_half_screen_promotion_block.html.erb b/backend/app/views/spree/admin/cms_sections/types/_half_screen_promotion_block.html.erb
deleted file mode 100644
index 12fd06d6d1..0000000000
--- a/backend/app/views/spree/admin/cms_sections/types/_half_screen_promotion_block.html.erb
+++ /dev/null
@@ -1,65 +0,0 @@
-<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.text_field :title, class: 'form-control' %>
- <%= f.error_message_on :title %>
- <% end %>
-
- <%= f.field_container :subtitle, class: ['form-group'] do %>
- <%= f.label :subtitle, Spree.t(:subtitle) %>
- <%= f.text_field :subtitle, class: 'form-control' %>
- <%= f.error_message_on :subtitle %>
- <% end %>
-
- <%= 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">
- <%= f.field_container :full_width_on_small, class: ['form-group col-6'] do %>
- <div class="custom-control custom-checkbox">
- <%= f.check_box :full_width_on_small, class: 'custom-control-input' %>
- <%= f.label :full_width_on_small, Spree.t('admin.cms.full_width_on_small'), class: 'custom-control-label' %>
- <%= f.error_message_on :full_width_on_small %>
- </div>
- <% end %>
- </div>
- </div>
- <div class="col-12 col-md-6 pt-4">
- <%= f.field_container :image_one, class: ['form-group'] do %>
- <% if @cms_section.image_one.attached? && @cms_section.image_one.variable? %>
- <figure class="admin-img-holder">
- <%= image_tag main_app.url_for(@cms_section.image_one.variant(resize: '244x104>')) %>
- </figure>
- <% elsif @cms_section.image_one.attached? && @cms_section.image_one.image? %>
- <figure class="admin-img-holder">
- <%= image_tag main_app.url_for(@cms_section.image_one) %>
- </figure>
- <% end %>
- <%= f.field_container :image_one, class: ['form-group mb-0'] do %>
- <%= f.file_field :image_one %>
- <%= f.error_message_on :image_one %>
- <% end %>
- <% end %>
-
- <small class="form-text text-muted"><%= Spree.t('admin.cms.promo.aspect_ratio') %></small>
- </div>
- <div class="col-12"><hr></div>
- <div class="col-12 col-md-6">
- <%= f.field_container :linked_resource_type, class: ['form-group'] do %>
- <%= f.label :linked_resource_type, Spree.t('admin.navigation.link_to') %>
- <%= f.select(:linked_resource_type,
- spree_humanize_dropdown_values('Spree::Cms::Sections::HalfScreenPromotionBlock',
- { const: 'LINKED_RESOURCE_TYPE' }),
- { include_blank: false },
- class: 'link_switcher') %>
- <%= f.error_message_on :linked_resource_type %>
- <% end %>
- </div>
- <div class="col-12 col-md-6">
- <%= render "spree/admin/shared/link_fields", resource: @cms_section, f: f %>
- </div>
-</div>
diff --git a/backend/app/views/spree/admin/cms_sections/types/_side_by_side_promotion.html.erb b/backend/app/views/spree/admin/cms_sections/types/_side_by_side_promotion.html.erb
new file mode 100644
index 0000000000..292d252acd
--- /dev/null
+++ b/backend/app/views/spree/admin/cms_sections/types/_side_by_side_promotion.html.erb
@@ -0,0 +1,99 @@
+<div class="row pb-0">
+ <div class="col-12 col-md-6 mb-3">
+ <div class="card p-3">
+ <h5 class="border-bottom"><%= Spree.t('admin.cms.three_taxon_block.section_one') %></h5>
+ <%= f.field_container :image_one, class: ['form-group'] do %>
+ <% if @cms_section.image_one.attached? && @cms_section.image_one.variable? %>
+ <figure class="admin-img-holder">
+ <%= image_tag main_app.url_for(@cms_section.image_one.variant(resize: '244x104>')) %>
+ </figure>
+ <% elsif @cms_section.image_one.attached? && @cms_section.image_one.image? %>
+ <figure class="admin-img-holder">
+ <%= image_tag main_app.url_for(@cms_section.image_one) %>
+ </figure>
+ <% end %>
+ <%= f.field_container :image_one, class: ['form-group mb-0'] do %>
+ <%= f.file_field :image_one %>
+ <%= f.error_message_on :image_one %>
+ <% end %>
+ <% end %>
+
+ <%= f.field_container :title_one, class: ['form-group'] do %>
+ <%= f.label :title_one, Spree.t('admin.cms.title') %>
+ <%= f.text_field :title_one, class: 'form-control' %>
+ <%= f.error_message_on :title_one %>
+ <% end %>
+
+ <%= f.field_container :subtitle_one, class: ['form-group'] do %>
+ <%= f.label :subtitle_one, Spree.t('admin.cms.subtitle') %>
+ <%= f.text_field :subtitle_one, class: 'form-control' %>
+ <%= f.error_message_on :subtitle_one %>
+ <% end %>
+
+ <%= f.field_container :permalink_one, class: ['form-group'] do %>
+ <%= f.label :permalink_one, Spree.t('admin.cms.link_to_taxon') %>
+ <%= f.select :permalink_one,
+ options_from_collection_for_select([@cms_section],
+ :permalink_one, :permalink_one, @cms_section.permalink_one || nil),
+ { include_blank: true },
+ class: 'select2autocomplete',
+ data: { autocomplete_placeholder_value: Spree.t('admin.navigation.seach_for_a_taxon'),
+ autocomplete_clear_value: true,
+ autocomplete_url_value: 'taxons_api_v2',
+ autocomplete_return_attr_value: 'permalink',
+ autocomplete_custom_return_id_value: 'permalink' } %>
+ <%= f.error_message_on :permalink_ones %>
+ <% end %>
+ <small class="text-muted"><%= Spree.t('admin.cms.three_taxon_block.section_one_info') %></small>
+ </div>
+ </div>
+
+ <div class="col-12 col-md-6 mb-3">
+ <div class="card p-3">
+ <h5 class="border-bottom"><%= Spree.t('admin.cms.three_taxon_block.section_two') %></h5>
+ <%= f.field_container :image_two, class: ['form-group'] do %>
+ <% if @cms_section.image_two.attached? && @cms_section.image_two.variable? %>
+ <figure class="admin-img-holder">
+ <%= image_tag main_app.url_for(@cms_section.image_two.variant(resize: '244x104>')) %>
+ </figure>
+ <% elsif @cms_section.image_two.attached? && @cms_section.image_two.image? %>
+ <figure class="admin-img-holder">
+ <%= image_tag main_app.url_for(@cms_section.image_two) %>
+ </figure>
+ <% end %>
+ <%= f.field_container :image_two, class: ['form-group mb-0'] do %>
+ <%= f.file_field :image_two %>
+ <%= f.error_message_on :image_two %>
+ <% end %>
+ <% end %>
+
+ <%= f.field_container :title_two, class: ['form-group'] do %>
+ <%= f.label :title_two, Spree.t('admin.cms.title') %>
+ <%= f.text_field :title_two, class: 'form-control' %>
+ <%= f.error_message_on :title_two %>
+ <% end %>
+
+ <%= f.field_container :subtitle_two, class: ['form-group'] do %>
+ <%= f.label :subtitle_two, Spree.t('admin.cms.subtitle') %>
+ <%= f.text_field :subtitle_two, class: 'form-control' %>
+ <%= f.error_message_on :subtitle_two %>
+ <% end %>
+
+ <%= f.field_container :permalink_two, class: ['form-group'] do %>
+ <%= f.label :permalink_two, Spree.t('admin.cms.link_to_taxon') %>
+ <%= f.select :permalink_two,
+ options_from_collection_for_select([@cms_section],
+ :permalink_two, :permalink_two, @cms_section.permalink_two || nil),
+ { include_blank: true },
+ class: 'select2autocomplete',
+ data: { autocomplete_placeholder_value: Spree.t('admin.navigation.seach_for_a_taxon'),
+ autocomplete_clear_value: true,
+ autocomplete_url_value: 'taxons_api_v2',
+ autocomplete_return_attr_value: 'permalink',
+ autocomplete_custom_return_id_value: 'permalink' } %>
+ <%= f.error_message_on :permalink_two %>
+ <% end %>
+ <small class="text-muted"><%= Spree.t('admin.cms.three_taxon_block.section_two_info') %></small>
+ </div>
+ </div>
+</div>
diff --git a/core/app/models/spree/cms/sections/featured_article.rb b/core/app/models/spree/cms/sections/featured_article.rb
index 5134af9f5a..6e5de9746c 100644
--- a/core/app/models/spree/cms/sections/featured_article.rb
+++ b/core/app/models/spree/cms/sections/featured_article.rb
@@ -2,18 +2,13 @@ module Spree::Cms::Sections
class FeaturedArticle < Spree::CmsSection
after_initialize :default_values
- store :options, accessors: [:title, :subtitle, :button_text], coder: JSON
+ store :content, accessors: [:title, :subtitle, :button_text, :rte_content], coder: JSON
LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product', 'Spree::CmsPage']
- def widths
- ['Full', 'Half']
- end
-
private
def default_values
- self.width ||= 'Full'
self.fit ||= 'Screen'
self.linked_resource_type ||= 'Spree::Taxon'
end
diff --git a/core/app/models/spree/cms/sections/full_screen_hero_image.rb b/core/app/models/spree/cms/sections/full_screen_hero_image.rb
index 50e308c157..16d15c841e 100644
--- a/core/app/models/spree/cms/sections/full_screen_hero_image.rb
+++ b/core/app/models/spree/cms/sections/full_screen_hero_image.rb
@@ -2,18 +2,13 @@ module Spree::Cms::Sections
class FullScreenHeroImage < Spree::CmsSection
after_initialize :default_values
- store :options, accessors: [:title, :button_text], coder: JSON
+ store :content, accessors: [:title, :button_text], coder: JSON
LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product']
- def widths
- ['Full']
- end
-
private
def default_values
- self.width ||= 'Full'
self.fit ||= 'Screen'
self.linked_resource_type ||= 'Spree::Taxon'
end
diff --git a/core/app/models/spree/cms/sections/half_screen_promotion_block.rb b/core/app/models/spree/cms/sections/half_screen_promotion_block.rb
deleted file mode 100644
index 6294954b0f..0000000000
--- a/core/app/models/spree/cms/sections/half_screen_promotion_block.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-module Spree::Cms::Sections
- class HalfScreenPromotionBlock < Spree::CmsSection
- after_initialize :default_values
-
- store :options, accessors: [:title, :subtitle], coder: JSON
-
- LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product']
-
- # Overide this per section type
- def widths
- ['Half']
- end
-
- private
-
- def default_values
- self.width ||= 'Half'
- self.fit ||= 'Container'
- self.linked_resource_type ||= 'Spree::Taxon'
- end
- end
-end
diff --git a/core/app/models/spree/cms/sections/product_carousel.rb b/core/app/models/spree/cms/sections/product_carousel.rb
index 6c0d9cc3e8..4f12945856 100644
--- a/core/app/models/spree/cms/sections/product_carousel.rb
+++ b/core/app/models/spree/cms/sections/product_carousel.rb
@@ -4,14 +4,9 @@ module Spree::Cms::Sections
LINKED_RESOURCE_TYPE = ['Spree::Taxon']
- def widths
- ['Full']
- end
-
private
def default_values
- self.width ||= 'Full'
self.fit ||= 'Screen'
self.linked_resource_type ||= 'Spree::Taxon'
end
diff --git a/core/app/models/spree/cms/sections/side_by_side_promotion.rb b/core/app/models/spree/cms/sections/side_by_side_promotion.rb
new file mode 100644
index 0000000000..b5bab17bea
--- /dev/null
+++ b/core/app/models/spree/cms/sections/side_by_side_promotion.rb
@@ -0,0 +1,14 @@
+module Spree::Cms::Sections
+ class SideBySidePromotion < Spree::CmsSection
+ after_initialize :default_values
+
+ store :content, accessors: [:permalink_one, :title_one, :subtitle_one,
+ :permalink_two, :title_two, :subtitle_two], coder: JSON
+
+ private
+
+ def default_values
+ self.fit ||= 'Container'
+ end
+ end
+end
diff --git a/core/app/models/spree/cms/sections/static_branding_bar.rb b/core/app/models/spree/cms/sections/static_branding_bar.rb
index ff3e4af992..3acae5f6e5 100644
--- a/core/app/models/spree/cms/sections/static_branding_bar.rb
+++ b/core/app/models/spree/cms/sections/static_branding_bar.rb
@@ -2,16 +2,11 @@ module Spree::Cms::Sections
class StaticBrandingBar < Spree::CmsSection
after_initialize :default_values
- store :options, accessors: [:title, :subtitle], coder: JSON
-
- def widths
- ['Full']
- end
+ store :content, accessors: [:title, :subtitle], coder: JSON
private
def default_values
- self.width ||= 'Full'
self.fit ||= 'Screen'
end
end
diff --git a/core/app/models/spree/cms/sections/three_taxon_categories_block.rb b/core/app/models/spree/cms/sections/three_taxon_categories_block.rb
index dfb0840407..030f599160 100644
--- a/core/app/models/spree/cms/sections/three_taxon_categories_block.rb
+++ b/core/app/models/spree/cms/sections/three_taxon_categories_block.rb
@@ -2,18 +2,14 @@ module Spree::Cms::Sections
class ThreeTaxonCategoriesBlock < Spree::CmsSection
after_initialize :default_values
- store :options, accessors: [:permalink_one, :title_one,
+ store :content, accessors: [:permalink_one, :title_one,
:permalink_two, :title_two,
:permalink_three, :title_three], coder: JSON
- def widths
- ['Full']
- end
-
private
def default_values
- self.width ||= 'Full'
+ self.fit ||= 'Container'
end
end
end
diff --git a/core/app/models/spree/cms_section.rb b/core/app/models/spree/cms_section.rb
index 0d91eab775..65a14403e1 100644
--- a/core/app/models/spree/cms_section.rb
+++ b/core/app/models/spree/cms_section.rb
@@ -23,20 +23,18 @@ module Spree
LINKED_RESOURCE_TYPE = []
TYPES = ['Spree::Cms::Sections::FullScreenHeroImage',
- 'Spree::Cms::Sections::HalfScreenPromotionBlock',
'Spree::Cms::Sections::FeaturedArticle',
'Spree::Cms::Sections::ProductCarousel',
'Spree::Cms::Sections::ThreeTaxonCategoriesBlock',
- 'Spree::Cms::Sections::StaticBrandingBar']
+ 'Spree::Cms::Sections::StaticBrandingBar',
+ 'Spree::Cms::Sections::SideBySidePromotion']
- # Overide this per section type
def boundaries
['Container', 'Screen']
end
- # Overide this per section type
- def widths
- ['Full', 'Half']
+ def fullscreen?
+ fit == 'Screen'
end
end
end
diff --git a/core/db/migrate/20210514204251_create_spree_cms_sections.rb b/core/db/migrate/20210514204251_create_spree_cms_sections.rb
index db4d06023a..50594a154c 100644
--- a/core/db/migrate/20210514204251_create_spree_cms_sections.rb
+++ b/core/db/migrate/20210514204251_create_spree_cms_sections.rb
@@ -2,10 +2,8 @@ class CreateSpreeCmsSections < ActiveRecord::Migration[5.2]
def change
create_table :spree_cms_sections do |t|
t.column :name, :string, null: false
- t.column :options, :text
t.column :content, :text
- t.column :width, :string
- t.column :full_width_on_small, :boolean, default: false
+ t.column :settings, :text
t.column :fit, :string
t.column :destination, :string
t.column :type, :string
diff --git a/frontend/app/assets/javascripts/spree/frontend.js b/frontend/app/assets/javascripts/spree/frontend.js
index 34f24075fb..73a60d8a07 100644
--- a/frontend/app/assets/javascripts/spree/frontend.js
+++ b/frontend/app/assets/javascripts/spree/frontend.js
@@ -31,7 +31,6 @@
//= require spree/frontend/views/spree/products/modal_carousel
//= require spree/frontend/views/spree/products/price_filters
//= require spree/frontend/views/spree/shared/carousel
-//= require spree/frontend/views/spree/shared/cms_sections
//= require spree/frontend/views/spree/shared/carousel/single
//= require spree/frontend/views/spree/shared/carousel/swipes
//= require spree/frontend/views/spree/shared/carousel/thumbnails
diff --git a/frontend/app/assets/javascripts/spree/frontend/views/spree/shared/cms_sections.es6 b/frontend/app/assets/javascripts/spree/frontend/views/spree/shared/cms_sections.es6
deleted file mode 100644
index 90ab55c124..0000000000
--- a/frontend/app/assets/javascripts/spree/frontend/views/spree/shared/cms_sections.es6
+++ /dev/null
@@ -1,46 +0,0 @@
-// Fix for odd - even css targeting when user skips a half size section.
-document.addEventListener('turbolinks:load', function() {
- const featurePageContent = document.getElementById('featurePageContent')
-
- if (!featurePageContent) return
-
- const fullWidthElements = featurePageContent.querySelectorAll('.cms_full_section')
-
- fullWidthElements.forEach(function(elem) {
- if (elem.previousElementSibling && elem.previousElementSibling.classList.contains('cms_half_section')) {
- const siblings = getSiblings(elem)
-
- if (!isEven(siblings.length)) insertPlaceHolder(elem)
- }
- })
-})
-
-function insertPlaceHolder(elem) {
- const el = document.createElement('aside')
- el.classList.add('col-6', 'cms_half_section', 'd-none')
-
- elem.insertAdjacentElement('beforebegin', el)
-}
-
-function isEven(value) {
- if (value % 2 === 0) {
- return true
- } else {
- return false
- }
-}
-
-function getSiblings(elem) {
- const siblings = []
- let sibling = elem.parentNode.firstChild
-
- while (sibling) {
- if (sibling === elem) break
-
- if (sibling.nodeType === 1 && sibling !== elem && !sibling.classList.contains('cms_full_section')) {
- siblings.push(sibling)
- }
- sibling = sibling.nextElementSibling
- }
- return siblings
-}
diff --git a/frontend/app/assets/stylesheets/spree/frontend/variables/variables.scss b/frontend/app/assets/stylesheets/spree/frontend/variables/variables.scss
index 770100866d..c8378c677f 100644
--- a/frontend/app/assets/stylesheets/spree/frontend/variables/variables.scss
+++ b/frontend/app/assets/stylesheets/spree/frontend/variables/variables.scss
@@ -21,7 +21,7 @@ $spree-header-tablet-height: 75px;
$spree-header-desktop-height: 75px;
// bootstrap overrides
-$grid-gutter-width: 19px;
+$grid-gutter-width: 1rem;
$body-color: $font-color;
$theme-colors: (
// standard bootstrap colors
@@ -62,7 +62,7 @@ $container-max-widths: (
);
// helper variables
-$container-padding: 17px;
+$container-padding: $grid-gutter-width;
$photo-width-to-height-ratio: 30001/ 37500;
$photo-width-to-height-ratio-zoom: 28015 / 37500;
$thumbnails-carousel-single-height: 100% / $photo-width-to-height-ratio;
diff --git a/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss b/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss
index c09298d580..e0a27ed576 100644
--- a/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss
+++ b/frontend/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss
@@ -9,8 +9,8 @@
}
}
-.cms_section {
- margin-bottom: 1em;
+.section-row {
+ margin-bottom: #{$grid-gutter-width};
}
.homepage {
@@ -292,80 +292,3 @@
}
}
}
-
-.full-width {
- width: 100vw;
- position: relative;
- left: 50%;
- right: 50%;
- margin-left: -50vw;
- margin-right: -50vw;
-}
-
-aside.cms_half_section {
- .full-width {
- width: calc(50vw - #{$grid-gutter-width / 2});
- position: relative;
- left: 100%;
- right: 100%;
- margin-left: calc(-50vw + #{$grid-gutter-width / 2});
- margin-right: 0;
- }
-
- &:nth-of-type(even) {
- .full-width {
- width: calc(50vw - #{$grid-gutter-width / 2});
- position: relative;
- left: 0;
- right: 100%;
- margin-left: 0vw;
- margin-right: calc(-50vw + #{$grid-gutter-width / 2});
- }
- }
-}
-
-aside.half_section_on_md_up {
- .full-width { /* stylelint-disable-line no-descending-specificity */
- width: 100vw;
- position: relative;
- left: 50%;
- right: 50%;
- margin-left: -50vw;
- margin-right: -50vw;
- }
-
- &:nth-of-type(even) {
- .full-width {
- width: 100vw;
- position: relative;
- left: 50%;
- right: 50%;
- margin-left: -50vw;
- margin-right: -50vw;
- }
- }
-}
-
-@include media-breakpoint-up(md) {
- aside.half_section_on_md_up {
- .full-width {
- width: calc(50vw - #{$grid-gutter-width / 2});
- position: relative;
- left: 100%;
- right: 100%;
- margin-left: calc(-50vw + #{$grid-gutter-width / 2});
- margin-right: 0;
- }
-
- &:nth-of-type(even) {
- .full-width {
- width: calc(50vw - #{$grid-gutter-width / 2});
- position: relative;
- left: 0;
- right: 100%;
- margin-left: 0vw;
- margin-right: calc(-50vw + #{$grid-gutter-width / 2});
- }
- }
- }
-}
diff --git a/frontend/app/helpers/spree/cms_pages_helper.rb b/frontend/app/helpers/spree/cms_pages_helper.rb
index a5f4ece7f6..7bba1464de 100644
--- a/frontend/app/helpers/spree/cms_pages_helper.rb
+++ b/frontend/app/helpers/spree/cms_pages_helper.rb
@@ -4,44 +4,18 @@ module Spree
page.content.present? && !page.sections?
end
- def section_tags(section, width, fit, &block)
- inner_content = content_tag(:div, class: fit, &block)
- if section.width == 'Half'
- content_tag(:aside, inner_content, class: width)
+ def section_tags(section, &block)
+ inner_content = content_tag(:div, class: 'row section-row', &block)
+
+ if section.fullscreen?
+ inner_content
else
- content_tag(:div, inner_content, class: width)
+ content_tag(:div, inner_content, class: 'container')
end
end
def build_section(section)
- css_width = if section.full_width_on_small
- case section.width
- when 'Half'
- 'cms_section col-12 col-md-6 cms_half_section half_section_on_md_up'
- when 'Full'
- 'cms_section col-12 cms_full_section'
- else
- ''
- end
- else
- case section.width
- when 'Half'
- 'cms_section col-6 cms_half_section'
- when 'Full'
- 'cms_section col-12 cms_full_section'
- else
- ''
- end
- end
-
- fit = case section.fit
- when 'Screen'
- 'full-width '
- else
- ''
- end
-
- section_tags(section, css_width, fit) do
+ section_tags(section) do
render "spree/shared/cms/sections/#{spree_resource_path(section)}", section: section
end
end
diff --git a/frontend/app/views/spree/home/index.html.erb b/frontend/app/views/spree/home/index.html.erb
index 3e411fb503..98b825509b 100644
--- a/frontend/app/views/spree/home/index.html.erb
+++ b/frontend/app/views/spree/home/index.html.erb
@@ -1,11 +1,7 @@
<% if @homepage %>
-<div class="container">
- <div id="featurePageContent" class="row">
<% @homepage.cms_sections.each do |section| %>
<%= build_section(section) %>
<% end %>
- </div>
- </div>
<% else %>
<div id="missingHomepage" class="container my-5">
<div class="row my-5">
diff --git a/frontend/app/views/spree/layouts/spree_application.html.erb b/frontend/app/views/spree/layouts/spree_application.html.erb
index 3b30f65a49..cf0be8aadf 100644
--- a/frontend/app/views/spree/layouts/spree_application.html.erb
+++ b/frontend/app/views/spree/layouts/spree_application.html.erb
@@ -12,7 +12,7 @@
<div id="overlay" class="overlay hide-on-esc"></div>
<div data-hook>
- <main id="content" data-hook>
+ <main class="col-12" id="content" data-hook>
<%= flash_messages %>
<%= yield %>
</main>
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.erb
index 800d514384..0966b18e0a 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,4 +1,4 @@
-<div class="homepage-fashion-trends-box">
+<div class="col-12 homepage-fashion-trends-box">
<div class="text-center">
<% if section.title.present? %>
@@ -11,7 +11,7 @@
<div class="homepage-fashion-trends-box-description-text text-center mb-3">
<div class="mb-3">
- <%= raw section.content %>
+ <%= raw section.rte_content %>
</div>
<% if section.button_text.present? && section.link.present? %>
diff --git a/frontend/app/views/spree/shared/cms/sections/_full_screen_hero_image.html.erb b/frontend/app/views/spree/shared/cms/sections/_full_screen_hero_image.html.erb
index 5fb9e9a994..7202bc4ac4 100644
--- a/frontend/app/views/spree/shared/cms/sections/_full_screen_hero_image.html.erb
+++ b/frontend/app/views/spree/shared/cms/sections/_full_screen_hero_image.html.erb
@@ -1,4 +1,4 @@
-<div class="homepage-hero-image position-relative p-0 bg-light">
+<div class="col-12 homepage-hero-image position-relative p-0 bg-light">
<% if section.image_one.present? %>
<!-- XS to MD -->
<div class="d-sm-none" style="--aspect-ratio:12/5;">
diff --git a/frontend/app/views/spree/shared/cms/sections/_half_screen_promotion_block.html.erb b/frontend/app/views/spree/shared/cms/sections/_half_screen_promotion_block.html.erb
deleted file mode 100644
index 6511c397ed..0000000000
--- a/frontend/app/views/spree/shared/cms/sections/_half_screen_promotion_block.html.erb
+++ /dev/null
@@ -1,47 +0,0 @@
-<%= link_to section.link do %>
- <div class="d-flex
- align-items-end
- justify-content-center
- bg-light text-center
- overflow-hidden
- homepage-bottom-box"
- style="--aspect-ratio:54/35;">
-
- <% if section.image_one.present? %>
- <!-- XS to MD -->
- <img class="d-md-none lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
- alt="<%= section&.title %>">
-
- <!-- MD to XL -->
- <img class="d-none d-md-block d-xl-none lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
- alt="<%= section&.title %>">
-
- <!-- XL UP -->
- <img class="d-none d-xl-block lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
- alt="<%= section&.title %>">
- <% else %>
- <%= icon( name: 'card-image',
- classes: 'text-black-50',
- width: 26,
- height: 26) %>
- <% end %>
-
- <% if section.title.present? && section.subtitle.present? %>
- <div class="homepage-bottom-box-inner p-1 p-sm-2 p-md-4 homepage-hpb" role="img" aria-label="New Collection">
- <div class="homepage-bottom-box-inner-small-text">
- <%= section.title %>
- </div>
- <div class="homepage-bottom-box-inner-big-text">
- <%= section.subtitle %>
- </div>
- </div>
- <% end %>
- </div>
-<% end %>
-
diff --git a/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erb b/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erb
index 81cdc061b5..c27d3bdd5e 100644
--- a/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erb
+++ b/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erb
@@ -1,3 +1,5 @@
-<% if section.linked_resource %>
- <div data-product-carousel-taxon-id='<%= section.linked_resource.permalink %>' class="my-3"></div>
-<% end %>
+<div class="col-12">
+ <% if section.linked_resource %>
+ <div data-product-carousel-taxon-id='<%= section.linked_resource.permalink %>' class="my-3"></div>
+ <% end %>
+</div>
diff --git a/frontend/app/views/spree/shared/cms/sections/_side_by_side_promotion.html.erb b/frontend/app/views/spree/shared/cms/sections/_side_by_side_promotion.html.erb
new file mode 100644
index 0000000000..cceb24c03a
--- /dev/null
+++ b/frontend/app/views/spree/shared/cms/sections/_side_by_side_promotion.html.erb
@@ -0,0 +1,97 @@
+<div class="col-12 col-lg-6">
+ <%= link_to spree.nested_taxons_path(section.permalink_one) do %>
+ <div class="d-flex
+ align-items-end
+ justify-content-center
+ bg-light text-center
+ overflow-hidden
+ homepage-bottom-box"
+ style="--aspect-ratio:54/35;">
+
+ <% if section.image_one.present? %>
+ <!-- XS to MD -->
+ <img class="d-md-none lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
+ alt="<%= section&.title_one %>">
+
+ <!-- MD to XL -->
+ <img class="d-none d-md-block d-xl-none lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
+ alt="<%= section&.title_one %>">
+
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
+ alt="<%= section&.title_one %>">
+ <% else %>
+ <%= icon( name: 'card-image',
+ classes: 'text-black-50',
+ width: 26,
+ height: 26) %>
+ <% end %>
+
+ <% if section.title_one.present? || section.subtitle_one.present? %>
+ <div class="homepage-bottom-box-inner p-1 p-sm-2 p-md-4 homepage-hpb" role="img" aria-label="New Collection">
+ <div class="homepage-bottom-box-inner-small-text">
+ <%= section&.title_one %>
+ </div>
+ <div class="homepage-bottom-box-inner-big-text">
+ <%= section.subtitle_one %>
+ </div>
+ </div>
+ <% end %>
+ </div>
+ <% end %>
+</div>
+
+<div class="col-12 col-lg-6">
+ <%= link_to spree.nested_taxons_path(section.permalink_two) do %>
+ <div class="d-flex
+ align-items-end
+ justify-content-center
+ bg-light text-center
+ overflow-hidden
+ homepage-bottom-box"
+ style="--aspect-ratio:54/35;">
+
+ <% if section.image_two.present? %>
+ <!-- XS to MD -->
+ <img class="d-md-none lazyload"
+ data-src="<%= main_app.url_for(section.image_two.attachment.variant(resize: '387x250>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_two.attachment.variant(resize: '387x250>')) %>"
+ alt="<%= section&.title_two %>">
+
+ <!-- MD to XL -->
+ <img class="d-none d-md-block d-xl-none lazyload"
+ data-src="<%= main_app.url_for(section.image_two.attachment.variant(resize: '734x476>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_two.attachment.variant(resize: '734x476>')) %>"
+ alt="<%= section&.title_two %>">
+
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
+ data-src="<%= main_app.url_for(section.image_two.attachment.variant(resize: '1468x952>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_two.attachment.variant(resize: '1468x952>')) %>"
+ alt="<%= section&.title_two %>">
+ <% else %>
+ <%= icon( name: 'card-image',
+ classes: 'text-black-50',
+ width: 26,
+ height: 26) %>
+ <% end %>
+
+ <% if section.title_two.present? || section.subtitle_two.present? %>
+ <div class="homepage-bottom-box-inner p-1 p-sm-2 p-md-4 homepage-hpb" role="img" aria-label="New Collection">
+ <div class="homepage-bottom-box-inner-small-text">
+ <%= section&.title_two %>
+ </div>
+ <div class="homepage-bottom-box-inner-big-text">
+ <%= section.subtitle_two %>
+ </div>
+ </div>
+ <% end %>
+ </div>
+ <% end %>
+</div>
diff --git a/frontend/app/views/spree/shared/cms/sections/_three_taxon_categories_block.html.erb b/frontend/app/views/spree/shared/cms/sections/_three_taxon_categories_block.html.erb
index aed5a7d982..ed6cbe3a93 100644
--- a/frontend/app/views/spree/shared/cms/sections/_three_taxon_categories_block.html.erb
+++ b/frontend/app/views/spree/shared/cms/sections/_three_taxon_categories_block.html.erb
@@ -1,110 +1,108 @@
-<div class="row">
- <div class="col-6">
- <% if section.permalink_one.present? %>
- <%= link_to spree.nested_taxons_path(section.permalink_one), class: "homepage-taxon-box mb-3 bg-light" do %>
- <% if section.image_one.attached? && section.image_one.variable? %>
- <!-- XS to MD -->
- <img class="d-md-none lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
- alt="<%= section&.title_one %>">
+<div class="col-6">
+ <% if section.permalink_one.present? %>
+ <%= link_to spree.nested_taxons_path(section.permalink_one), class: "homepage-taxon-box mb-3 bg-light" do %>
+ <% if section.image_one.attached? && section.image_one.variable? %>
+ <!-- XS to MD -->
+ <img class="d-md-none lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
+ alt="<%= section&.title_one %>">
- <!-- MD to XL -->
- <img class="d-none d-md-block d-xl-none lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
- alt="<%= section&.title_one %>">
+ <!-- MD to XL -->
+ <img class="d-none d-md-block d-xl-none lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '734x476>')) %>"
+ alt="<%= section&.title_one %>">
- <!-- XL UP -->
- <img class="d-none d-xl-block lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
- alt="<%= section&.title_one %>">
- <% else %>
- <div style="--aspect-ratio:54/35;">
- <%= icon( name: 'card-image',
- classes: 'homepage-taxon-box text-black-50',
- width: 26,
- height: 26) %>
- </div>
- <% end %>
-
- <div class="homepage-taxon-box-text ">
- <h3 class="homepage-hpb"><%= section&.title_one %></h3>
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1468x952>')) %>"
+ alt="<%= section&.title_one %>">
+ <% else %>
+ <div style="--aspect-ratio:54/35;">
+ <%= icon( name: 'card-image',
+ classes: 'homepage-taxon-box text-black-50',
+ width: 26,
+ height: 26) %>
</div>
- <% end %>
+ <% end %>
+
+ <div class="homepage-taxon-box-text ">
+ <h3 class="homepage-hpb"><%= section&.title_one %></h3>
+ </div>
<% end %>
+ <% end %>
- <% if section.permalink_three.present? %>
- <%= link_to spree.nested_taxons_path(section.permalink_three), class: "homepage-taxon-box bg-light" do %>
- <% if section.image_three.attached? && section.image_three.variable? %>
- <!-- XS to MD -->
- <img class="d-md-none lazyload"
- data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '387x250>')) %>"
- data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '387x250>')) %>"
- alt="<%= section&.title_three %>">
+ <% if section.permalink_three.present? %>
+ <%= link_to spree.nested_taxons_path(section.permalink_three), class: "homepage-taxon-box bg-light" do %>
+ <% if section.image_three.attached? && section.image_three.variable? %>
+ <!-- XS to MD -->
+ <img class="d-md-none lazyload"
+ data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '387x250>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '387x250>')) %>"
+ alt="<%= section&.title_three %>">
- <!-- MD to XL -->
- <img class="d-none d-md-block d-xl-none lazyload"
- data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '734x476>')) %>"
- data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '734x476>')) %>"
- alt="<%= section&.title_three %>">
+ <!-- MD to XL -->
+ <img class="d-none d-md-block d-xl-none lazyload"
+ data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '734x476>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '734x476>')) %>"
+ alt="<%= section&.title_three %>">
- <!-- XL UP -->
- <img class="d-none d-xl-block lazyload"
- data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '1468x952>')) %>"
- data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '1468x952>')) %>"
- alt="<%= section&.title_three %>">
- <% else %>
- <div style="--aspect-ratio:54/35;">
- <%= icon( name: 'card-image',
- classes: 'homepage-taxon-box text-black-50',
- width: 26,
- height: 26) %>
- </div>
- <% end %>
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
+ data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '1468x952>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '1468x952>')) %>"
+ alt="<%= section&.title_three %>">
+ <% else %>
+ <div style="--aspect-ratio:54/35;">
+ <%= icon( name: 'card-image',
+ classes: 'homepage-taxon-box text-black-50',
+ width: 26,
+ height: 26) %>
+ </div>
+ <% end %>
- <div class="homepage-taxon-box-text" role="img" aria-label="Sportswear">
- <h3 class="homepage-hpb"><%= section&.title_three %></h3>
- </div>
- <% end %>
+ <div class="homepage-taxon-box-text" role="img" aria-label="Sportswear">
+ <h3 class="homepage-hpb"><%= section&.title_three %></h3>
+ </div>
<% end %>
- </div>
+ <% end %>
+</div>
- <div class="col-6 d-flex flex-column">
- <% if section.permalink_two.present? %>
- <%= link_to spree.nested_taxons_path(section.permalink_two), class: "homepage-taxon-box flex-grow-1 bg-light" do %>
- <% if section.image_two.attached? && section.image_two.variable? %>
- <!-- XS to MD -->
- <img class="d-md-none lazyload"
- data-src="<%= main_app.url_for(section.image_two.variant(resize: '387x250>')) %>"
- data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '387x250>')) %>"
- alt="<%= section&.title_two %>">
+<div class="col-6 d-flex flex-column">
+ <% if section.permalink_two.present? %>
+ <%= link_to spree.nested_taxons_path(section.permalink_two), class: "homepage-taxon-box flex-grow-1 bg-light" do %>
+ <% if section.image_two.attached? && section.image_two.variable? %>
+ <!-- XS to MD -->
+ <img class="d-md-none lazyload"
+ data-src="<%= main_app.url_for(section.image_two.variant(resize: '387x250>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '387x250>')) %>"
+ alt="<%= section&.title_two %>">
- <!-- MD to XL -->
- <img class="d-none d-md-block d-xl-none lazyload"
- data-src="<%= main_app.url_for(section.image_two.variant(resize: '734x476>')) %>"
- data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '734x476>')) %>"
- alt="<%= section&.title_two %>">
+ <!-- MD to XL -->
+ <img class="d-none d-md-block d-xl-none lazyload"
+ data-src="<%= main_app.url_for(section.image_two.variant(resize: '734x476>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '734x476>')) %>"
+ alt="<%= section&.title_two %>">
- <!-- XL UP -->
- <img class="d-none d-xl-block lazyload"
- data-src="<%= main_app.url_for(section.image_two.variant(resize: '1468x952>')) %>"
- data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '1468x952>')) %>"
- alt="<%= section&.title_two %>">
- <% else %>
- <div style="--aspect-ratio:27/40; margin: 50px;">
- <%= icon( name: 'file-image',
- classes: 'homepage-taxon-box text-black-50',
- width: 26,
- height: 26) %>
- </div>
- <% end %>
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
+ data-src="<%= main_app.url_for(section.image_two.variant(resize: '1468x952>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '1468x952>')) %>"
+ alt="<%= section&.title_two %>">
+ <% else %>
+ <div style="--aspect-ratio:27/40; margin: 50px;">
+ <%= icon( name: 'file-image',
+ classes: 'homepage-taxon-box text-black-50',
+ width: 26,
+ height: 26) %>
+ </div>
+ <% end %>
- <div class="homepage-taxon-box-text">
- <h3 class="homepage-hpb"><%= section&.title_two %></h3>
- </div>
- <% end %>
+ <div class="homepage-taxon-box-text">
+ <h3 class="homepage-hpb"><%= section&.title_two %></h3>
+ </div>
<% end %>
- </div>
+ <% end %>
</div>