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.

More sections work.

Matthew Kennedya80f0cc6d6ad
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 6fe1d59d44..6382201c93 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
@@ -18,13 +18,12 @@
<%= f.error_message_on :button_text %>
<% end %>
- <div class="row">
- <%= 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>
+ <%= f.field_container :gutters, class: ['form-group'] do %>
+ <%= f.label :gutters, Spree.t('admin.cms.gutters') %>
+ <%= f.select(:gutters, @cms_section.gutters_sizes, {include_blank: false}, class: 'select2') %>
+ <%= f.error_message_on :gutters %>
+ <% end %>
+
</div>
<div class="col-12 col-md-8">
<%= f.field_container :rte_content, class: ['form-group'] do %>
diff --git a/backend/app/views/spree/admin/cms_sections/types/_full_screen_hero_image.html.erb b/backend/app/views/spree/admin/cms_sections/types/_full_screen_hero_image.html.erb
index e10eefb36c..597c9c04f1 100644
--- a/backend/app/views/spree/admin/cms_sections/types/_full_screen_hero_image.html.erb
+++ b/backend/app/views/spree/admin/cms_sections/types/_full_screen_hero_image.html.erb
@@ -12,11 +12,19 @@
<%= f.error_message_on :button_text %>
<% 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 :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 %>
+
+ <%= f.field_container :gutters, class: ['form-group col-6'] do %>
+ <%= f.label :gutters, Spree.t('admin.cms.gutters') %>
+ <%= f.select(:gutters, @cms_section.gutters_sizes, {include_blank: false}, class: 'select2') %>
+ <%= f.error_message_on :gutters %>
+ <% end %>
+ </div>
</div>
<div class="col-12 col-md-6 pt-4">
<%= f.field_container :image_one, class: ['form-group'] do %>
diff --git a/core/app/models/spree/cms/sections/featured_article.rb b/core/app/models/spree/cms/sections/featured_article.rb
index 6e5de9746c..c31af0e1e1 100644
--- a/core/app/models/spree/cms/sections/featured_article.rb
+++ b/core/app/models/spree/cms/sections/featured_article.rb
@@ -3,12 +3,22 @@ module Spree::Cms::Sections
after_initialize :default_values
store :content, accessors: [:title, :subtitle, :button_text, :rte_content], coder: JSON
+ store :settings, accessors: [:gutters], coder: JSON
LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product', 'Spree::CmsPage']
+ def gutters_sizes
+ ['Use gutters', 'No Gutters']
+ end
+
+ def gutters?
+ gutters == 'Use gutters'
+ end
+
private
def default_values
+ self.gutters ||= 'No Gutters'
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 16d15c841e..10e14677f8 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
@@ -3,9 +3,18 @@ module Spree::Cms::Sections
after_initialize :default_values
store :content, accessors: [:title, :button_text], coder: JSON
+ store :settings, accessors: [:gutters], coder: JSON
LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product']
+ def gutters_sizes
+ ['Use gutters', 'No Gutters']
+ end
+
+ def gutters?
+ gutters == 'Use gutters'
+ end
+
private
def default_values
diff --git a/frontend/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss b/frontend/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss
index 92e09de353..379ebc8290 100644
--- a/frontend/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss
+++ b/frontend/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss
@@ -51,12 +51,12 @@
}
// Aspect Ratios
-[style*="--aspect-ratio"] > :first-child {
- width: 100%;
-}
-
[style*="--aspect-ratio"] > img {
- height: auto;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
}
@supports (--custom:property) {
@@ -69,11 +69,4 @@
display: block;
padding-bottom: calc(100% / (var(--aspect-ratio)));
}
-
- [style*="--aspect-ratio"] > :first-child {
- position: absolute;
- top: 0;
- left: 0;
- height: 100%;
- }
}
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 85f99aab0f..07b48e73eb 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
@@ -127,7 +127,7 @@
padding: 30px 15px;
@include media-breakpoint-up(md) {
- padding: 60px 0px;
+ padding: 5vw 0px;
}
&-summer-text {
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 0966b18e0a..b0398a0ae6 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,6 +1,11 @@
-<div class="col-12 homepage-fashion-trends-box">
- <div class="text-center">
+<% if section.gutters? %>
+ <% section_padding = 'px-3' %>
+<% else %>
+ <% section_padding = 'px-0' %>
+<% end %>
+<div class="col-12 <%= section_padding %>">
+ <div class="text-center homepage-fashion-trends-box">
<% if section.title.present? %>
<div class="homepage-fashion-trends-box-summer-text mb-1"><%= section.title %></div>
<% end %>
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 7202bc4ac4..6cd12d7860 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,56 +1,48 @@
-<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;">
- <img class="lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '768x320>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '768x320>')) %>"
- alt="<%= section&.title %>">
- </div>
+<% if section.fullscreen? %>
+ <% if section.gutters? %>
+ <% section_padding = 'px-3' %>
+ <% else %>
+ <% section_padding = 'px-0' %>
+ <% end %>
+<% else %>
+ <% section_padding = 'px-2' %>
+<% end %>
- <!-- SM to MD -->
- <div class="d-none d-sm-block d-md-none" style="--aspect-ratio:12/5;">
- <img class="lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '990x412>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '990x412>')) %>"
- alt="<%= section&.title %>">
- </div>
+<div class="col-12 homepage-hero-image position-relative p-0 <%= section_padding %>">
+ <div class="bg-light" style="--aspect-ratio:12/5;">
+ <% if section.image_one.present? %>
- <!-- MD to LG -->
- <div class="d-none d-md-block d-lg-none" style="--aspect-ratio:12/5;">
- <img class="lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1200x500>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1200x500>')) %>"
- alt="<%= section&.title %>">
- </div>
+ <!-- XS to LG -->
+ <img class="d-lg-none lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1200x500>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1200x500>')) %>"
+ alt="<%= section&.title %>">
- <!-- XL UP -->
- <div class="d-none d-lg-block" style="--aspect-ratio:12/5;">
- <img class="lazyload"
- data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '2400x1000>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '2400x1000>')) %>"
- alt="<%= section&.title %>">
- </div>
- <% else %>
- <div style="--aspect-ratio:12/5;">
- <%= icon( name: 'card-image',
- classes: 'text-black-50',
- width: 26,
- height: 26) %>
- </div>
- <% end %>
+ <!-- LG UP -->
+ <img class="d-none d-lg-block lazyload"
+ data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '2400x1000>')) %>"
+ data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '2400x1000>')) %>"
+ alt="<%= section&.title %>">
+
+ <% else %>
+ <%= icon( name: 'card-image',
+ classes: 'text-black-50',
+ width: 26,
+ height: 26) %>
+ <% end %>
- <div class="hero-content position-absolute-y-center">
- <% if section.title.present? %>
- <div class="homepage-hero-image-text mx-auto pb-0 pb-sm-2 pb-md-3">
- <%= section.title %>
- </div>
- <% end %>
+ <div class="hero-content position-absolute-y-center">
+ <% if section.title.present? %>
+ <div class="homepage-hero-image-text mx-auto pb-0 pb-sm-2 pb-md-3">
+ <%= section.title %>
+ </div>
+ <% end %>
- <% if section.link.present? && section.button_text.present? %>
- <div>
- <%= link_to section.button_text, section.link, class: 'btn btn-primary spree-btn px-5' %>
- </div>
- <% end %>
+ <% if section.link.present? && section.button_text.present? %>
+ <div>
+ <%= link_to section.button_text, section.link, class: 'btn btn-primary spree-btn px-5' %>
+ </div>
+ <% end %>
+ </div>
</div>
</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
index faff0bffe3..fbbb4a7989 100644
--- 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
@@ -16,33 +16,28 @@
<% end %>
<div class="col-12 col-md-6 mb-3 mb-md-0 <%= section_one_padding %>">
- <%= 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;">
+ <%= link_to spree.nested_taxons_path(section.permalink_one),
+ class: 'd-flex align-items-end justify-content-center bg-light text-center overflow-hidden homepage-bottom-box',
+ style: '--aspect-ratio:54/35;' do %>
<% 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 %>">
+ <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 %>">
+ <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 %>">
+ <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',
@@ -60,19 +55,13 @@
</div>
</div>
<% end %>
- </div>
<% end %>
</div>
<div class="col-12 col-md-6 <%= section_two_padding %>">
- <%= 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;">
+ <%= link_to spree.nested_taxons_path(section.permalink_two),
+ class: 'd-flex align-items-end justify-content-center bg-light text-center overflow-hidden homepage-bottom-box',
+ style: '--aspect-ratio:54/35;' do %>
<% if section.image_two.present? %>
<!-- XS to MD -->
@@ -109,6 +98,5 @@
</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 ca3f116712..1b521fa38e 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,5 +1,12 @@
+<% if section.fullscreen? %>
+ <% section_one_padding = 'pl-3' %>
+ <% section_two_padding = 'pr-3' %>
+<% else %>
+ <% section_one_padding = '' %>
+ <% section_two_padding = '' %>
+<% end %>
<!-- Left Block -->
-<div class="col-6">
+<div class="col-6 <%= section_one_padding %>">
<!-- Top Left Block SQUARE -->
<% if section.permalink_one.present? %>
@@ -8,38 +15,31 @@
<div class="row" style="margin-bottom: 3.7%;">
<div class="col-12">
- <%= link_to spree.nested_taxons_path(section.permalink_one), class: 'homepage-taxon-box' do %>
+ <%= link_to spree.nested_taxons_path(section.permalink_one), class: 'homepage-taxon-box', style: '--aspect-ratio:18/13;' do %>
<% if section.image_one.attached? && section.image_one.variable? %>
- <!-- XS to MD -->
- <div class="d-md-none" style="--aspect-ratio:18/13;">
+
+ <!-- XS to MD -->
<img class="d-md-none lazyload"
data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '270x195>')) %>"
data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '270x195>')) %>"
alt="<%= section&.title_one %>">
- </div>
- <!-- MD to XL -->
- <div class="d-none d-md-block d-xl-none" style="--aspect-ratio:18/13;">
- <img class="lazyload"
+ <!-- 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: '540x390>')) %>"
data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '540x390>')) %>"
alt="<%= section&.title_one %>">
- </div>
- <!-- XL UP -->
- <div class="d-none d-xl-block" style="--aspect-ratio:18/13;">
- <img class="lazyload"
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
data-src="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1080x780>')) %>"
data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '1080x780>')) %>"
alt="<%= section&.title_one %>">
- </div>
<% else %>
- <div style="--aspect-ratio:18/13;">
- <%= icon( name: 'card-image',
- classes: 'homepage-taxon-box text-black-50',
- width: 26,
- height: 26) %>
- </div>
+ <%= icon( name: 'card-image',
+ classes: 'homepage-taxon-box text-black-50',
+ width: 26,
+ height: 26) %>
<% end %>
<div class="homepage-taxon-box-text" aria-label="<%= section&.title_one %>">
<h3 class="homepage-hpb"><%= section&.title_one %></h3>
@@ -55,38 +55,31 @@
<div class="row">
<div class="col-12">
- <%= link_to spree.nested_taxons_path(section.permalink_three), class: 'homepage-taxon-box' do %>
+ <%= link_to spree.nested_taxons_path(section.permalink_three), class: 'homepage-taxon-box', style: '--aspect-ratio:18/13;' do %>
<% if section.image_three.attached? && section.image_three.variable? %>
- <!-- XS to MD -->
- <div class="d-md-none" style="--aspect-ratio:18/13;">
+
+ <!-- XS to MD -->
<img class="d-md-none lazyload"
data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '270x195>')) %>"
data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '270x195>')) %>"
alt="<%= section&.title_three %>">
- </div>
- <!-- MD to XL -->
- <div class="d-none d-md-block d-xl-none" style="--aspect-ratio:18/13;">
- <img class="lazyload"
+ <!-- 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: '540x390>')) %>"
data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '540x390>')) %>"
alt="<%= section&.title_three %>">
- </div>
- <!-- XL UP -->
- <div class="d-none d-xl-block" style="--aspect-ratio:18/13;">
- <img class="lazyload"
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
data-src="<%= main_app.url_for(section.image_three.attachment.variant(resize: '1080x780>')) %>"
data-srcset="<%= main_app.url_for(section.image_three.attachment.variant(resize: '1080x780>')) %>"
alt="<%= section&.title_three %>">
- </div>
<% else %>
- <div style="--aspect-ratio:18/13;">
- <%= icon( name: 'card-image',
- classes: 'homepage-taxon-box text-black-50',
- width: 26,
- height: 26) %>
- </div>
+ <%= icon( name: 'card-image',
+ classes: 'homepage-taxon-box text-black-50',
+ width: 26,
+ height: 26) %>
<% end %>
<div class="homepage-taxon-box-text" aria-label="<%= section&.title_three %>">
<h3 class="homepage-hpb"><%= section&.title_three %></h3>
@@ -99,40 +92,33 @@
</div>
<!-- Right Block TALL -->
-<div class="col-6">
+<div class="col-6 <%= section_two_padding %>">
<% if section.permalink_two.present? %>
- <%= link_to spree.nested_taxons_path(section.permalink_two), class: 'homepage-taxon-box' do %>
+ <%= link_to spree.nested_taxons_path(section.permalink_two), class: 'homepage-taxon-box', style: '--aspect-ratio:27/40;' do %>
<% if section.image_two.attached? && section.image_two.variable? %>
- <!-- XS to MD -->
- <div class="d-md-none" style="--aspect-ratio:27/40;">
- <img class="lazyload"
+
+ <!-- XS to MD -->
+ <img class="d-md-none lazyload"
data-src="<%= main_app.url_for(section.image_two.variant(resize: '270x400>')) %>"
data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '270x400>')) %>"
alt="<%= section&.title_two %>">
- </div>
- <!-- MD to XL -->
- <div class="d-none d-md-block d-xl-none " style="--aspect-ratio:27/40;">
- <img class="lazyload"
+ <!-- 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: '540x800>')) %>"
data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '540x800>')) %>"
alt="<%= section&.title_two %>">
- </div>
- <!-- XL UP -->
- <div class="d-none d-xl-block" style="--aspect-ratio:27/40;">
- <img class="lazyload"
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
data-src="<%= main_app.url_for(section.image_two.variant(resize: '1080x1600>')) %>"
data-srcset="<%= main_app.url_for(section.image_two.variant(resize: '1080x1600>')) %>"
alt="<%= section&.title_two %>">
- </div>
<% 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>
+ <%= icon( name: 'file-image',
+ classes: 'homepage-taxon-box text-black-50',
+ width: 26,
+ height: 26) %>
<% end %>
<div class="homepage-taxon-box-text" aria-label="<%= section&.title_two %>">
<h3 class="homepage-hpb"><%= section&.title_two %></h3>