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.

Improve sections.

Matthew Kennedy259e2b38b882
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 d73fdb195e..9c7cf9a8ad 100644
--- a/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb
+++ b/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb
@@ -4,9 +4,51 @@ module Spree
class CmsSectionSerializer < BaseSerializer
set_type :cms_section
- attributes :name, :title, :subtitle, :button_text, :content, :width,
+ attributes :name, :options, :content, :width,
:full_width_on_small, :fit, :type, :position
+ attribute :image_one_path do |section|
+ if section.image_one_path.attached?
+ url_helpers = Rails.application.routes.url_helpers
+ url_helpers.rails_representation_path(section.image_one_path, only_path: true)
+ end
+ end
+
+ attribute :image_two_path do |section|
+ if section.image_two_path.attached?
+ url_helpers = Rails.application.routes.url_helpers
+ url_helpers.rails_representation_path(section.image_two_path, only_path: true)
+ end
+ end
+
+ attribute :image_three_path do |section|
+ if section.image_three_path.attached?
+ url_helpers = Rails.application.routes.url_helpers
+ url_helpers.rails_representation_path(section.image_three_path, only_path: true)
+ end
+ end
+
+ attribute :image_four_path do |section|
+ if section.image_four_path.attached?
+ url_helpers = Rails.application.routes.url_helpers
+ url_helpers.rails_representation_path(section.image_four_path, only_path: true)
+ end
+ end
+
+ attribute :image_five_path do |section|
+ if section.image_five_path.attached?
+ url_helpers = Rails.application.routes.url_helpers
+ url_helpers.rails_representation_path(section.image_five_path, only_path: true)
+ end
+ end
+
+ attribute :image_six_path do |section|
+ if section.image_six_path.attached?
+ url_helpers = Rails.application.routes.url_helpers
+ url_helpers.rails_representation_path(section.image_six_path, only_path: true)
+ end
+ end
+
belongs_to :cms_page
end
end
diff --git a/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss b/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss
index 3b5157ea05..d4eedf3424 100644
--- a/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss
+++ b/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss
@@ -37,6 +37,14 @@ input[type=number].hide-number-toggle {
-moz-appearance: textfield;
}
+input[type="file"] {
+ width: fit-content;
+ max-width: 100%;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
// Remove the default 5px outlines and box-shadows
// from all inputs on focus.
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 6cb0ace79f..e10eefb36c 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
@@ -19,28 +19,22 @@
<% end %>
</div>
<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? %>
- <figure class="admin-img-holder">
- <%= image_tag(main_app.url_for(@cms_section.icon.attachment)) %>
- </figure>
- <% end %>
- <%= icon_field.file_field :attachment %>
+ <%= 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 %>
-
- <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('image_alt_text') %>
- <%= icon_field.text_field :alt, class: 'form-control' %>
- </div>
- <% 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.hero.aspect_ratio') %></small>
</div>
<div class="col-12"><hr></div>
<div class="col-12 col-md-6">
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
index 7e3657fbaa..12fd06d6d1 100644
--- 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
@@ -29,28 +29,23 @@
</div>
</div>
<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? %>
- <figure class="admin-img-holder">
- <%= image_tag(main_app.url_for(@cms_section.icon.attachment)) %>
- </figure>
- <% end %>
- <%= icon_field.file_field :attachment %>
+ <%= 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>
-
- <%= f.field_container :icon_alt do %>
- <% unless @cms_section.icon.new_record? %>
- <div class="form-group my-3">
- <%= icon_field.label :alt, Spree.t('image_alt_text') %>
- <%= icon_field.text_field :alt, class: 'form-control' %>
- </div>
- <% end %>
- <% end %>
- <% end %>
</div>
<div class="col-12"><hr></div>
<div class="col-12 col-md-6">
diff --git a/backend/app/views/spree/admin/cms_sections/types/_static_branding_bar.html.erb b/backend/app/views/spree/admin/cms_sections/types/_static_branding_bar.html.erb
index 0f6b320f3e..d2a541ebed 100644
--- a/backend/app/views/spree/admin/cms_sections/types/_static_branding_bar.html.erb
+++ b/backend/app/views/spree/admin/cms_sections/types/_static_branding_bar.html.erb
@@ -1,6 +1,6 @@
<% menu = Spree::Menu.
- by_store(@cms_section&.cms_page.store).
- for_brands(@cms_section&.cms_page.locale).menu %>
+ by_store(@cms_section&.cms_page.store)&.
+ for_brands(@cms_section&.cms_page.locale)&.menu %>
<div class="row">
<div class="col-12 col-md-6">
diff --git a/backend/app/views/spree/admin/cms_sections/types/_three_taxon_categories_block.html.erb b/backend/app/views/spree/admin/cms_sections/types/_three_taxon_categories_block.html.erb
index 2b4ce9d92d..850eaf77e7 100644
--- a/backend/app/views/spree/admin/cms_sections/types/_three_taxon_categories_block.html.erb
+++ b/backend/app/views/spree/admin/cms_sections/types/_three_taxon_categories_block.html.erb
@@ -1,89 +1,130 @@
-<div class="row">
- <div class="col-12 col-md-6">
- <%= f.field_container :image_one, class: ['form-group'] do %>
- <% if @cms_section.image_one.attached? && @cms_section.image_one.variable? %>
- <%= image_tag main_app.url_for(@cms_section.image_one.variant(resize: '244x104>')) %>
- <% elsif @cms_section.image_one.attached? && @cms_section.image_one.image? %>
- <%= image_tag main_app.url_for(@cms_section.image_one) %>
- <% end %>
+<div class="row pb-0">
+ <div class="col-12 col-md-4 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 %>
- <%= f.label :image_one, Spree.t(:image_one) %><br>
- <%= f.file_field :image_one %>
- <%= f.error_message_on :image_one %>
+ <% 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 %>
- <% end %>
- <%= f.field_container :title, class: ['form-group'] do %>
- <%= f.label :title, Spree.t('admin.cms.taxon_category.section_one') %>
- <%= f.select :title,
- options_from_collection_for_select([@cms_section],
- :title, :title, @cms_section.title || 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 :title %>
- <% end %>
- </div>
+ <%= 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 %>
- <div class="col-12 col-md-6">
- <%= f.field_container :image_two, class: ['form-group'] do %>
- <% if @cms_section.image_two.attached? && @cms_section.image_two.variable? %>
- <%= image_tag main_app.url_for(@cms_section.image_two.variant(resize: '244x104>')) %>
- <% elsif @cms_section.image_two.attached? && @cms_section.image_two.image? %>
- <%= image_tag main_app.url_for(@cms_section.image_two) %>
+ <%= 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-4 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 %>
- <%= f.label :image_two, Spree.t(:image_two) %><br>
- <%= f.file_field :image_two %>
- <%= f.error_message_on :image_two %>
+ <% 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 %>
- <% end %>
- <%= f.field_container :subtitle, class: ['form-group'] do %>
- <%= f.label :subtitle, Spree.t('admin.cms.taxon_category.section_two') %>
- <%= f.select :subtitle,
- options_from_collection_for_select([@cms_section],
- :subtitle, :subtitle, @cms_section.subtitle || 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 :subtitle %>
- <% end %>
- </div>
- <div class="col-12 col-md-6">
- <%= f.field_container :image_three, class: ['form-group'] do %>
- <% if @cms_section.image_three.attached? && @cms_section.image_three.variable? %>
- <%= image_tag main_app.url_for(@cms_section.image_three.variant(resize: '244x104>')) %>
- <% elsif @cms_section.image_three.attached? && @cms_section.image_three.image? %>
- <%= image_tag main_app.url_for(@cms_section.image_three) %>
+ <%= 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 class="col-12 col-md-4 mb-3">
+ <div class="card p-3">
+ <h5 class="border-bottom"><%= Spree.t('admin.cms.three_taxon_block.section_three') %></h5>
<%= f.field_container :image_three, class: ['form-group'] do %>
- <%= f.label :image_three, Spree.t(:image_three) %><br>
- <%= f.file_field :image_three %>
- <%= f.error_message_on :image_three %>
+ <% if @cms_section.image_three.attached? && @cms_section.image_three.variable? %>
+ <figure class="admin-img-holder">
+ <%= image_tag main_app.url_for(@cms_section.image_three.variant(resize: '244x104>')) %>
+ </figure>
+ <% elsif @cms_section.image_three.attached? && @cms_section.image_three.image? %>
+ <figure class="admin-img-holder">
+ <%= image_tag main_app.url_for(@cms_section.image_three) %>
+ </figure>
+ <% end %>
+ <%= f.field_container :image_three, class: ['form-group mb-0'] do %>
+ <%= f.file_field :image_three %>
+ <%= f.error_message_on :image_three %>
+ <% end %>
+ <% end %>
+
+ <%= f.field_container :title_three, class: ['form-group'] do %>
+ <%= f.label :title_three, Spree.t('admin.cms.title') %>
+ <%= f.text_field :title_three, class: 'form-control' %>
+ <%= f.error_message_on :title_three %>
+ <% end %>
+
+ <%= f.field_container :permalink_three, class: ['form-group'] do %>
+ <%= f.label :permalink_three, Spree.t('admin.cms.link_to_taxon') %>
+ <%= f.select :permalink_three,
+ options_from_collection_for_select([@cms_section],
+ :permalink_three, :permalink_three, @cms_section.permalink_three || 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_three %>
<% end %>
- <% end %>
- <%= f.field_container :button_text, class: ['form-group'] do %>
- <%= f.label :button_text, Spree.t('admin.cms.taxon_category.section_three') %>
- <%= f.select :button_text,
- options_from_collection_for_select([@cms_section],
- :button_text, :button_text, @cms_section.button_text || 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 :button_text %>
- <% end %>
+ <small class="text-muted"><%= Spree.t('admin.cms.three_taxon_block.section_three_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 2572b8eb67..5134af9f5a 100644
--- a/core/app/models/spree/cms/sections/featured_article.rb
+++ b/core/app/models/spree/cms/sections/featured_article.rb
@@ -2,6 +2,8 @@ module Spree::Cms::Sections
class FeaturedArticle < Spree::CmsSection
after_initialize :default_values
+ store :options, accessors: [:title, :subtitle, :button_text], coder: JSON
+
LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product', 'Spree::CmsPage']
def widths
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 b255ed0dae..50e308c157 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,8 +2,7 @@ module Spree::Cms::Sections
class FullScreenHeroImage < Spree::CmsSection
after_initialize :default_values
- has_one :icon, as: :viewable, dependent: :destroy, class_name: 'Spree::Icon'
- accepts_nested_attributes_for :icon, reject_if: :all_blank
+ store :options, accessors: [:title, :button_text], coder: JSON
LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product']
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
index ffe5c8ae8b..6294954b0f 100644
--- a/core/app/models/spree/cms/sections/half_screen_promotion_block.rb
+++ b/core/app/models/spree/cms/sections/half_screen_promotion_block.rb
@@ -2,8 +2,7 @@ module Spree::Cms::Sections
class HalfScreenPromotionBlock < Spree::CmsSection
after_initialize :default_values
- has_one :icon, as: :viewable, dependent: :destroy, class_name: 'Spree::Icon'
- accepts_nested_attributes_for :icon, reject_if: :all_blank
+ store :options, accessors: [:title, :subtitle], coder: JSON
LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product']
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 f65c7dcefc..ff3e4af992 100644
--- a/core/app/models/spree/cms/sections/static_branding_bar.rb
+++ b/core/app/models/spree/cms/sections/static_branding_bar.rb
@@ -2,6 +2,8 @@ module Spree::Cms::Sections
class StaticBrandingBar < Spree::CmsSection
after_initialize :default_values
+ store :options, accessors: [:title, :subtitle], coder: JSON
+
def widths
['Full']
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 c70722d639..dfb0840407 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,9 +2,9 @@ module Spree::Cms::Sections
class ThreeTaxonCategoriesBlock < Spree::CmsSection
after_initialize :default_values
- has_one_attached :image_one
- has_one_attached :image_two
- has_one_attached :image_three
+ store :options, accessors: [:permalink_one, :title_one,
+ :permalink_two, :title_two,
+ :permalink_three, :title_three], coder: JSON
def widths
['Full']
diff --git a/core/app/models/spree/cms_section.rb b/core/app/models/spree/cms_section.rb
index 9569db90c2..0d91eab775 100644
--- a/core/app/models/spree/cms_section.rb
+++ b/core/app/models/spree/cms_section.rb
@@ -5,6 +5,17 @@ module Spree
acts_as_list scope: :cms_page
belongs_to :cms_page, touch: true
+ # Six images in one section should cover a large number of potential use cases.
+ # The standardization of putting them here means we can offer them up through
+ # the API serializer vs hoping they get added per section basis and the naming
+ # matches those used in the API serializer attributes.
+ has_one_attached :image_one
+ has_one_attached :image_two
+ has_one_attached :image_three
+ has_one_attached :image_four
+ has_one_attached :image_five
+ has_one_attached :image_six
+
belongs_to :linked_resource, polymorphic: true
default_scope { order(position: :asc) }
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index ff9aa80e3c..e356105c46 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -557,6 +557,7 @@ en:
click_here: click here
draft_mode: Draft Mode
full_width: Full width
+ link_to_taxon: Link to Taxon
title: Title
fit: Fit To
brand_bar:
@@ -583,10 +584,17 @@ en:
no_sections_found_please_add_one: Add your first section to this page by clicking the <b>+ Add New Section</b> button above.
click_create_to_load_new_link: 'Click the <b>Create</b> button below to save your new page section, and load the section settings.'
click_update_to_load_new_link: 'Click the <b>Update</b> button below to load the new section settings.'
- settings_for: 'Options For: <b>%{section} Section</b>'
+ settings_for: 'Options For: <b>%{section}</b>'
page_sections: '%{page_name} Sections'
page_sections_info: 'The area below represents your %{page_type} displayed in %{store}, add sections and drag them into position'
visible: Visible
+ three_taxon_block:
+ section_one: Section One
+ section_one_info: This section is displayed in the top left of the three image block. Please use an image with an aspect ratio of 5/9.
+ section_two: Section Two
+ section_two_info: This section is displayed on the right as the tall banner. Please use an image with an aspect ratio of 5/9.
+ section_three: Section Three
+ section_three_info: This section is displayed on the left below section one. Please use an image with an aspect ratio of 5/9.
linkable:
seach_for_a_page: Search for a page
tab:
diff --git a/core/db/migrate/20210514204251_create_spree_cms_sections.rb b/core/db/migrate/20210514204251_create_spree_cms_sections.rb
index 876a9fde0e..db4d06023a 100644
--- a/core/db/migrate/20210514204251_create_spree_cms_sections.rb
+++ b/core/db/migrate/20210514204251_create_spree_cms_sections.rb
@@ -2,9 +2,7 @@ class CreateSpreeCmsSections < ActiveRecord::Migration[5.2]
def change
create_table :spree_cms_sections do |t|
t.column :name, :string, null: false
- t.column :title, :string
- t.column :subtitle, :string
- t.column :button_text, :string
+ t.column :options, :text
t.column :content, :text
t.column :width, :string
t.column :full_width_on_small, :boolean, default: false
diff --git a/frontend/app/helpers/spree/navigation_helper.rb b/frontend/app/helpers/spree/navigation_helper.rb
index ebe6ab9734..49ebedb528 100644
--- a/frontend/app/helpers/spree/navigation_helper.rb
+++ b/frontend/app/helpers/spree/navigation_helper.rb
@@ -43,7 +43,7 @@ module Spree
end
def main_nav_image(image_path, title = '')
- image_url = asset_path(asset_exists?(image_path) ? image_path : 'noimage/plp.png')
+ image_url = asset_path(asset_exists?(image_path) ? image_path : 'noimage/plp.svg')
lazy_image(
src: image_url,
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 a52f46e48a..5fb9e9a994 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,35 +1,35 @@
<div class="homepage-hero-image position-relative p-0 bg-light">
- <% if section.icon.present? %>
+ <% 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.icon.attachment.variant(resize: '768x320>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '768x320>')) %>"
- alt="<%= section.icon.alt %>">
+ 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>
<!-- 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 %>">
+ 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>
<!-- 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 %>">
+ 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>
<!-- 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 %>">
+ 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;">
@@ -54,4 +54,3 @@
<% 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 2d98aebe1f..6511c397ed 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
@@ -7,24 +7,24 @@
homepage-bottom-box"
style="--aspect-ratio:54/35;">
- <% if section.icon.present? %>
+ <% if section.image_one.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 %>">
+ 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.icon.attachment.variant(resize: '734x476>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '734x476>')) %>"
- alt="<%= section.icon.alt %>">
+ 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.icon.attachment.variant(resize: '1468x952>')) %>"
- data-srcset="<%= main_app.url_for(section.icon.attachment.variant(resize: '1468x952>')) %>"
- alt="<%= section.icon.alt %>">
+ 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',
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 0d4294fd01..aed5a7d982 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,60 +1,60 @@
<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 %>">
+ <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 %>">
+ <!-- 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 %>">
- <% 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_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 %></h3>
- </div>
+ <div class="homepage-taxon-box-text ">
+ <h3 class="homepage-hpb"><%= section&.title_one %></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.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.button_text %>">
+ 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.button_text %>">
+ 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.button_text %>">
+ alt="<%= section&.title_three %>">
<% else %>
<div style="--aspect-ratio:54/35;">
<%= icon( name: 'card-image',
@@ -65,33 +65,33 @@
<% end %>
<div class="homepage-taxon-box-text" role="img" aria-label="Sportswear">
- <h3 class="homepage-hpb"><%= section.button_text %></h3>
+ <h3 class="homepage-hpb"><%= section&.title_three %></h3>
</div>
<% end %>
<% 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 %>
+ <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.subtitle %>">
+ 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.subtitle %>">
+ 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.subtitle %>">
+ alt="<%= section&.title_two %>">
<% else %>
<div style="--aspect-ratio:27/40; margin: 50px;">
<%= icon( name: 'file-image',
@@ -102,7 +102,7 @@
<% end %>
<div class="homepage-taxon-box-text">
- <h3 class="homepage-hpb"><%= section.subtitle %></h3>
+ <h3 class="homepage-hpb"><%= section&.title_two %></h3>
</div>
<% end %>
<% end %>