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.

Move logic into view helpers frontend.

Matthew Kennedy39ad92ba336a
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 6622a6f7cd..c09298d580 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,6 +9,10 @@
}
}
+.cms_section {
+ margin-bottom: 1em;
+}
+
.homepage {
&-hero-image {
display: flex;
diff --git a/frontend/app/helpers/spree/cms_pages_helper.rb b/frontend/app/helpers/spree/cms_pages_helper.rb
index c847d80936..a5f4ece7f6 100644
--- a/frontend/app/helpers/spree/cms_pages_helper.rb
+++ b/frontend/app/helpers/spree/cms_pages_helper.rb
@@ -4,44 +4,46 @@ module Spree
page.content.present? && !page.sections?
end
- def build_section(section)
- if section.full_width_on_small
- case section.width
- when 'Half'
- element = 'aside'
- css_width = 'col-12 col-md-6 cms_half_section half_section_on_md_up'
- when 'Full'
- element = 'div'
- css_width = 'col-12 cms_full_section'
- else
- element = 'div'
- css_width = ''
- 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)
else
- case section.width
- when 'Half'
- element = 'aside'
- css_width = 'col-6 cms_half_section'
- when 'Full'
- element = 'div'
- css_width = 'col-12 cms_full_section'
- else
- element = 'div'
- css_width = ''
- end
+ content_tag(:div, inner_content, class: width)
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
+ when 'Screen'
+ 'full-width '
+ else
+ ''
+ end
- render "spree/shared/cms/sections/#{spree_resource_path(section)}", section: section,
- width: css_width,
- fit: fit,
- element: element
+ section_tags(section, css_width, fit) do
+ render "spree/shared/cms/sections/#{spree_resource_path(section)}", section: section
+ end
end
end
end
diff --git a/frontend/app/views/spree/cms_pages/show.html.erb b/frontend/app/views/spree/cms_pages/show.html.erb
index e48423db99..8d19495040 100644
--- a/frontend/app/views/spree/cms_pages/show.html.erb
+++ b/frontend/app/views/spree/cms_pages/show.html.erb
@@ -1,5 +1,3 @@
-<% @body_id = 'page' %>
-
<% if @cms_page %>
<% if simple_page?(@cms_page) %>
<div class="container">
diff --git a/frontend/app/views/spree/home/index.html.erb b/frontend/app/views/spree/home/index.html.erb
index 1afebc446e..3e411fb503 100644
--- a/frontend/app/views/spree/home/index.html.erb
+++ b/frontend/app/views/spree/home/index.html.erb
@@ -1,5 +1,3 @@
-<% @body_id = 'home' %>
-
<% if @homepage %>
<div class="container">
<div id="featurePageContent" class="row">
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 06d661d0cb..800d514384 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,26 +1,22 @@
-<<%= element %> class="<%= width %> mb-3">
- <div class="<%= fit %>">
- <div class="homepage-fashion-trends-box">
- <div class="text-center">
+<div class="homepage-fashion-trends-box">
+ <div class="text-center">
- <% if section.title.present? %>
- <div class="homepage-fashion-trends-box-summer-text mb-1"><%= section.title %></div>
- <% end %>
+ <% if section.title.present? %>
+ <div class="homepage-fashion-trends-box-summer-text mb-1"><%= section.title %></div>
+ <% end %>
- <% if section.subtitle.present? %>
- <div class="homepage-fashion-trends-box-fashion-trends-text mb-2"><%= section.subtitle %></div>
- <% end %>
+ <% if section.subtitle.present? %>
+ <div class="homepage-fashion-trends-box-fashion-trends-text mb-2"><%= section.subtitle %></div>
+ <% end %>
- <div class="homepage-fashion-trends-box-description-text text-center mb-3">
- <div class="mb-3">
- <%= raw section.content %>
- </div>
-
- <% if section.button_text.present? && section.link.present? %>
- <%= link_to section.button_text, section.link, class: 'btn text-center spree-btn btn-outline-primary w-75' %>
- <% end %>
- </div>
+ <div class="homepage-fashion-trends-box-description-text text-center mb-3">
+ <div class="mb-3">
+ <%= raw section.content %>
</div>
+
+ <% if section.button_text.present? && section.link.present? %>
+ <%= link_to section.button_text, section.link, class: 'btn text-center spree-btn btn-outline-primary w-75' %>
+ <% end %>
</div>
</div>
-</<%= element %>>
+</div>
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 55e1bcbfb2..a52f46e48a 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,60 +1,57 @@
-<div class="<%= width %>">
- <div class="<%= fit %>">
- <div class="homepage-hero-image mb-3 position-relative p-0 bg-light">
- <% if section.icon.present? %>
- <!-- XS to MD -->
- <div class="d-sm-none" style="--aspect-ratio:12/5;">
- <img class="lazyload"
- data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '768x320>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '768x320>')) %>"
- alt="<%= section.icon.alt %>">
- </div>
+<div class="homepage-hero-image position-relative p-0 bg-light">
+ <% if section.icon.present? %>
+ <!-- XS to MD -->
+ <div class="d-sm-none" style="--aspect-ratio:12/5;">
+ <img class="lazyload"
+ data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '768x320>')) %>"
+ data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '768x320>')) %>"
+ alt="<%= section.icon.alt %>">
+ </div>
- <!-- 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.icon.attachment.variant(resize: '990x412>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '990x412>')) %>"
- alt="<%= section.icon.alt %>">
- </div>
+ <!-- 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.icon.attachment.variant(resize: '990x412>')) %>"
+ data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '990x412>')) %>"
+ alt="<%= section.icon.alt %>">
+ </div>
- <!-- 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.icon.attachment.variant(resize: '1200x500>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '1200x500>')) %>"
- alt="<%= section.icon.alt %>">
- </div>
+ <!-- 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.icon.attachment.variant(resize: '1200x500>')) %>"
+ data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '1200x500>')) %>"
+ alt="<%= section.icon.alt %>">
+ </div>
- <!-- XL UP -->
- <div class="d-none d-lg-block" style="--aspect-ratio:12/5;">
- <img class="lazyload"
- data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '2400x1000>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '2400x1000>')) %>"
- alt="<%= section.icon.alt %>">
- </div>
- <% else %>
- <div style="--aspect-ratio:12/5;">
- <%= icon( name: 'card-image',
- classes: 'text-black-50',
- width: 26,
- height: 26) %>
- </div>
- <% end %>
+ <!-- XL UP -->
+ <div class="d-none d-lg-block" style="--aspect-ratio:12/5;">
+ <img class="lazyload"
+ data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '2400x1000>')) %>"
+ data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '2400x1000>')) %>"
+ alt="<%= section.icon.alt %>">
+ </div>
+ <% else %>
+ <div style="--aspect-ratio:12/5;">
+ <%= icon( name: 'card-image',
+ classes: 'text-black-50',
+ width: 26,
+ height: 26) %>
+ </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 %>
+ <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>
- </div>
+ <% end %>
</div>
</div>
+
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
index 6501dd0dc2..2d98aebe1f 100644
--- 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
@@ -1,50 +1,47 @@
-<aside class="<%= width %> mb-3">
- <div class="<%= fit %>">
- <%= 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;">
+<%= 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.icon.present? %>
- <!-- XS to MD -->
- <img class="d-md-none lazyload"
- data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '387x250>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '387x250>')) %>"
- alt="<%= section.icon.alt %>">
+ <% if section.icon.present? %>
+ <!-- XS to MD -->
+ <img class="d-md-none lazyload"
+ data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '387x250>')) %>"
+ data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '387x250>')) %>"
+ alt="<%= section.icon.alt %>">
- <!-- MD to XL -->
- <img class="d-none d-md-block d-xl-none lazyload"
- data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '734x476>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '734x476>')) %>"
- alt="<%= section.icon.alt %>">
+ <!-- MD to XL -->
+ <img class="d-none d-md-block d-xl-none lazyload"
+ data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '734x476>')) %>"
+ data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '734x476>')) %>"
+ alt="<%= section.icon.alt %>">
- <!-- XL UP -->
- <img class="d-none d-xl-block lazyload"
- data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '1468x952>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '1468x952>')) %>"
- alt="<%= section.icon.alt %>">
- <% else %>
- <%= icon( name: 'card-image',
- classes: 'text-black-50',
- width: 26,
- height: 26) %>
- <% end %>
+ <!-- XL UP -->
+ <img class="d-none d-xl-block lazyload"
+ data-src="<%= main_app.url_for(section.icon.attachment.variant(resize: '1468x952>')) %>"
+ data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '1468x952>')) %>"
+ alt="<%= section.icon.alt %>">
+ <% 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 %>
+ <% 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>
-</aside>
+<% 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 ae5fbdf989..81cdc061b5 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,7 +1,3 @@
<% if section.linked_resource %>
- <div class="<%= width %>">
- <div class="<%= fit %>">
- <div data-product-carousel-taxon-id='<%= section.linked_resource.permalink %>' class="my-3"></div>
- </div>
- </div>
+ <div data-product-carousel-taxon-id='<%= section.linked_resource.permalink %>' class="my-3"></div>
<% end %>
diff --git a/frontend/app/views/spree/shared/cms/sections/_static_branding_bar.html.erb b/frontend/app/views/spree/shared/cms/sections/_static_branding_bar.html.erb
index f3807aac0e..2dac0344e9 100644
--- a/frontend/app/views/spree/shared/cms/sections/_static_branding_bar.html.erb
+++ b/frontend/app/views/spree/shared/cms/sections/_static_branding_bar.html.erb
@@ -1,36 +1,30 @@
-<div class="<%= width %> mb-3">
- <div class="<%= fit %>">
- <div class="col-12">
- <div class="row py-4">
-
- <% if section.title.present? || section.subtitle.present? %>
- <div class="col-12 mb-3 text-center">
- <% if section.title %>
- <h3 class="mb-0"><%= section.title %></h3>
- <% end %>
- <% if section.subtitle %>
- <h5 class="text-muted"><%= section.subtitle %></h5>
- <% end %>
- </div>
- <% end %>
-
- <% if spree_menu('brands').present? %>
- <% spree_menu('brands').children.each do |brand| %>
- <div class="col d-flex justify-content-center">
- <%= spree_nav_link_tag(brand, { class: "brand d-flex align-middle justify-content-center" }) do %>
- <% if brand.icon.present? %>
- <img class="lazyload"
- data-src="<%= main_app.url_for(brand.icon.attachment) %>"
- data-srcset="<%= main_app.url_for(brand.icon.attachment) %>"
- alt="<%= brand.icon.alt %>"
- title="<%= brand.name %>">
- <% end %>
- <% end %>
- </div>
- <% end %>
+<div class="col-12">
+ <div class="row py-4">
+ <% if section.title.present? || section.subtitle.present? %>
+ <div class="col-12 mb-3 text-center">
+ <% if section.title %>
+ <h3 class="mb-0"><%= section.title %></h3>
<% end %>
+ <% if section.subtitle %>
+ <h5 class="text-muted"><%= section.subtitle %></h5>
+ <% end %>
+ </div>
+ <% end %>
+ <% if spree_menu('brands').present? %>
+ <% spree_menu('brands').children.each do |brand| %>
+ <div class="col d-flex justify-content-center">
+ <%= spree_nav_link_tag(brand, { class: "brand d-flex align-middle justify-content-center" }) do %>
+ <% if brand.icon.present? %>
+ <img class="lazyload"
+ data-src="<%= main_app.url_for(brand.icon.attachment) %>"
+ data-srcset="<%= main_app.url_for(brand.icon.attachment) %>"
+ alt="<%= brand.icon.alt %>"
+ title="<%= brand.name %>">
+ <% end %>
+ <% end %>
</div>
- </div>
+ <% end %>
+ <% end %>
</div>
</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 32cdde1cf5..0d4294fd01 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,26 +1,60 @@
-<div class="col-12">
- <div class="row">
- <div class="col-6 mb-3">
- <% if section.title.present? %>
- <%= link_to spree.nested_taxons_path(section.title), class: "homepage-taxon-box mb-3 bg-light" do %>
- <% if section.image_one.attached? && section.image_one.variable? %>
+<div class="row">
+ <div class="col-6 mb-3">
+ <% if section.title.present? %>
+ <%= link_to spree.nested_taxons_path(section.title), 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 %>">
+
+ <!-- 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 %>
+ <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 %></h3>
+ </div>
+ <% end %>
+ <% end %>
+
+ <% if section.button_text.present? %>
+ <%= link_to spree.nested_taxons_path(section.button_text), 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_one.attachment.variant(resize: '387x250>')) %>"
- data-srcset="<%= main_app.url_for(section.image_one.attachment.variant(resize: '387x250>')) %>"
- alt="<%= section.title %>">
+ 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.button_text %>">
<!-- 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 %>">
+ 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.button_text %>">
<!-- 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 %>">
+ 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.button_text %>">
<% else %>
<div style="--aspect-ratio:54/35;">
<%= icon( name: 'card-image',
@@ -30,83 +64,47 @@
</div>
<% end %>
- <div class="homepage-taxon-box-text ">
- <h3 class="homepage-hpb"><%= section.title %></h3>
- </div>
- <% end %>
- <% end %>
-
- <% if section.button_text.present? %>
- <%= link_to spree.nested_taxons_path(section.button_text), 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.button_text %>">
-
- <!-- 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.button_text %>">
-
- <!-- 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.button_text %>">
- <% 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.button_text %></h3>
- </div>
- <% end %>
+ <div class="homepage-taxon-box-text" role="img" aria-label="Sportswear">
+ <h3 class="homepage-hpb"><%= section.button_text %></h3>
+ </div>
<% end %>
- </div>
+ <% end %>
+ </div>
- <div class="col-6 mb-3 d-flex flex-column">
- <% if section.button_text.present? %>
- <%= link_to spree.nested_taxons_path(section.subtitle), 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.subtitle %>">
+ <div class="col-6 mb-3 d-flex flex-column">
+ <% if section.button_text.present? %>
+ <%= link_to spree.nested_taxons_path(section.subtitle), 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.subtitle %>">
- <!-- 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.subtitle %>">
+ <!-- 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.subtitle %>">
- <!-- 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.subtitle %>">
- <% 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.subtitle %>">
+ <% 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.subtitle %></h3>
- </div>
- <% end %>
+ <div class="homepage-taxon-box-text">
+ <h3 class="homepage-hpb"><%= section.subtitle %></h3>
+ </div>
<% end %>
- </div>
+ <% end %>
</div>
</div>