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.

Rename Section for less specific use case.

Matthew Kennedy1505849a005a
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/_image_gallery.html.erb
similarity index 100%
rename from backend/app/views/spree/admin/cms_sections/types/_three_taxon_categories_block.html.erb
rename to backend/app/views/spree/admin/cms_sections/types/_image_gallery.html.erb
diff --git a/backend/app/views/spree/admin/cms_sections/types/_product_buy_bar.html.erb b/backend/app/views/spree/admin/cms_sections/types/_product_buy_bar.html.erb
deleted file mode 100644
index 1752013969..0000000000
--- a/backend/app/views/spree/admin/cms_sections/types/_product_buy_bar.html.erb
+++ /dev/null
@@ -1,30 +0,0 @@
-<div class="row">
- <div class="col-12 col-md-6">
- <%= f.field_container :overide_product_name, class: ['form-group'] do %>
- <%= f.label :overide_product_name, Spree.t('admin.cms.overide_product_name') %>
- <%= f.text_field :overide_product_name, class: 'form-control' %>
- <%= f.error_message_on :overide_product_name %>
- <% end %>
-
- <%= f.field_container :button_text, class: ['form-group'] do %>
- <%= f.label :button_text, Spree.t('admin.cms.button_text') %>
- <%= f.text_field :button_text, class: 'form-control' %>
- <%= f.error_message_on :button_text %>
- <% end %>
- </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::ProductBuyBar',
- { 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/_static_branding_bar.html.erb b/backend/app/views/spree/admin/cms_sections/types/_static_branding_bar.html.erb
deleted file mode 100644
index d2a541ebed..0000000000
--- a/backend/app/views/spree/admin/cms_sections/types/_static_branding_bar.html.erb
+++ /dev/null
@@ -1,44 +0,0 @@
-<% menu = Spree::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">
- <%= 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>
- <div class="col-6">
- <% if menu.present? %>
- <div class="pt-4">
- <%= raw Spree.t('admin.cms.brand_bar.uses_menu', menu: menu.name) %>
- <%= link_to Spree.t('admin.cms.click_here'), spree.edit_admin_menu_path(menu) %>
- <%= raw Spree.t('admin.cms.brand_bar.vist_menu_to_edit', menu: menu.name) %>
- </div>
- <% else %>
- <div class="alert alert-info mt-4">
- Create a Branding Menu with the following settings
- <span class="badge badge-secondary mx-2">
- <%= svg_icon name: "store.svg", width: '18', height: '18' %> <%= @cms_section.cms_page.store.unique_name %>
- </span>
- <span class="badge badge-secondary">
- <%= svg_icon name: "translate.svg", width: '18', height: '18' %> <%= locale_full_name(@cms_section.cms_page.locale) %>
- </span>
- </div>
- <% end %>
- </div>
-</div>
diff --git a/core/app/models/spree/cms/sections/three_taxon_categories_block.rb b/core/app/models/spree/cms/sections/image_gallery.rb
similarity index 86%
rename from core/app/models/spree/cms/sections/three_taxon_categories_block.rb
rename to core/app/models/spree/cms/sections/image_gallery.rb
index 030f599160..4bf88a21ab 100644
--- a/core/app/models/spree/cms/sections/three_taxon_categories_block.rb
+++ b/core/app/models/spree/cms/sections/image_gallery.rb
@@ -1,5 +1,5 @@
module Spree::Cms::Sections
- class ThreeTaxonCategoriesBlock < Spree::CmsSection
+ class ImageGallery < Spree::CmsSection
after_initialize :default_values
store :content, accessors: [:permalink_one, :title_one,
diff --git a/core/app/models/spree/cms/sections/product_buy_bar.rb b/core/app/models/spree/cms/sections/product_buy_bar.rb
deleted file mode 100644
index 84fd41c191..0000000000
--- a/core/app/models/spree/cms/sections/product_buy_bar.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-module Spree::Cms::Sections
- class ProductBuyBar < Spree::CmsSection
- after_initialize :default_values
-
- store :content, accessors: [:overide_product_name, :button_text], coder: JSON
- store :settings, accessors: [:show_price], coder: JSON
-
- LINKED_RESOURCE_TYPE = ['Spree::Product']
-
- def css_classes
- ['row', 'section-row', 'sticky-top'].compact
- end
-
- private
-
- def default_values
- self.fit ||= 'Screen'
- self.linked_resource_type ||= 'Spree::Product'
- 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
deleted file mode 100644
index 3acae5f6e5..0000000000
--- a/core/app/models/spree/cms/sections/static_branding_bar.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Spree::Cms::Sections
- class StaticBrandingBar < Spree::CmsSection
- after_initialize :default_values
-
- store :content, accessors: [:title, :subtitle], coder: JSON
-
- private
-
- def default_values
- self.fit ||= 'Screen'
- end
- end
-end
diff --git a/core/app/models/spree/cms_section.rb b/core/app/models/spree/cms_section.rb
index 24bda8e7c7..9e4471c433 100644
--- a/core/app/models/spree/cms_section.rb
+++ b/core/app/models/spree/cms_section.rb
@@ -27,7 +27,7 @@ module Spree
TYPES = ['Spree::Cms::Sections::HeroImage',
'Spree::Cms::Sections::FeaturedArticle',
'Spree::Cms::Sections::ProductCarousel',
- 'Spree::Cms::Sections::ThreeTaxonCategoriesBlock',
+ 'Spree::Cms::Sections::ImageGallery',
'Spree::Cms::Sections::SideBySidePromotion',
'Spree::Cms::Sections::RichTextContent']
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index 2eb947e1ee..ed30c137b6 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -564,8 +564,8 @@ en:
<p>The button can link to a Product, Taxon or Page. This section can be set to fit within the central container or to the edges of the screen.</p>
<p><b>Tip:</b> Use a hero image with no button text or title, and then set the <b>Fit:</b> to <b>Container</b> and <b>Gutters</b> to <b>Use Gutters</b> this creates an image section that looks perfect above a side-by-side promotions section or the three taxons sections.</p>
<p>Experiment with the settings, and don't be afraid to use more than one Hero Image section per page.</p>"
- info_three_taxon_categories_block_body: "<p>Three Taxon Block can be configured in several ways. For example, each image can link to a product or taxon. If you do not provide a link, you can display three images. Additionally, you can also use labels to add text to your images.</p>
- <p>There are two layout configurations for the Three Taxon Block, with the taller image used on the left or the right. You can also set this section to fit the edges of the screen or the central container to match your website's style.</p>"
+ info_image_gallery_body: "<p>The Image Gallery section can be configured in several ways. For example, each image can link to a product or taxon. If you do not provide a link, you can display three images. Additionally, you can also use labels to add text to your images.</p>
+ <p>There are two layout configurations for the Image Gallery section, with the taller image used on the left or the right. You can also set this section to fit the edges of the screen or the central container to match your website's style.</p>"
info_product_carousel_body: "<p>Product Carousel is a simple section to use. Search for the taxon you wish to display, save the changes, and the products in your chosen taxon will be displayed on your page.</p>"
info_featured_article_body: "<p>The Feature Article section allows you to add rich text to your page with a set title subtitle and linking button.</p>
<p>This section can be set to use full screen or container and also use gutters.</p>"
diff --git a/core/lib/spree/testing_support/factories/cms_section_factory.rb b/core/lib/spree/testing_support/factories/cms_section_factory.rb
index e8f396f3f6..2933113f12 100644
--- a/core/lib/spree/testing_support/factories/cms_section_factory.rb
+++ b/core/lib/spree/testing_support/factories/cms_section_factory.rb
@@ -15,7 +15,7 @@ FactoryBot.define do
end
factory :cms_three_taxon_categories_section do
- type { 'Spree::Cms::Sections::ThreeTaxonCategoriesBlock' }
+ type { 'Spree::Cms::Sections::ImageGallery' }
end
factory :cms_static_branding_bar_section do
diff --git a/frontend/app/views/spree/shared/cms/sections/_three_taxon_categories_block.html.erb b/frontend/app/views/spree/shared/cms/sections/_image_gallery.html.erb
similarity index 100%
rename from frontend/app/views/spree/shared/cms/sections/_three_taxon_categories_block.html.erb
rename to frontend/app/views/spree/shared/cms/sections/_image_gallery.html.erb
diff --git a/frontend/app/views/spree/shared/cms/sections/_product_buy_bar.html.erb b/frontend/app/views/spree/shared/cms/sections/_product_buy_bar.html.erb
deleted file mode 100644
index 3ef13182c4..0000000000
--- a/frontend/app/views/spree/shared/cms/sections/_product_buy_bar.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<div class="col-12 buy-container">
- <div class="container-fluid h-100 header-spree-fluid">
- <div class="d-flex flex-nowrap align-items-center h-100 px-2">
- <figure class="logo flex-grow-1 header-spree-fluid-logo m-0">
- <h3 class="m-0 p-0"><%= section.linked_resource.name %></h3>
- </figure>
-
- <div class="d-flex h-100">
- <% if spree_menu('demo_buy_bar').present? %>
- <ul class="d-block d-md-flex h-100 m-0 p-0">
- <% spree_menu('demo_buy_bar').children.each do |link| %>
- <li class="p-0 mx-3 d-flex buy-bar">
- <%= spree_nav_link_tag(link, { class: "d-flex align-items-center" }) %>
- </li>
- <% end %>
- </ul>
- <% end %>
- </div>
-
- <div class="d-flex ml-3 align-items-center justify-content-end navbar-right">
- <% 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>
-</div>
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
deleted file mode 100644
index 2dac0344e9..0000000000
--- a/frontend/app/views/spree/shared/cms/sections/_static_branding_bar.html.erb
+++ /dev/null
@@ -1,30 +0,0 @@
-<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 %>
- <% end %>
- </div>
-</div>
diff --git a/sample/db/samples/cms_sections.rb b/sample/db/samples/cms_sections.rb
index 9b9a0e1eb9..45bd3952b8 100644
--- a/sample/db/samples/cms_sections.rb
+++ b/sample/db/samples/cms_sections.rb
@@ -78,7 +78,7 @@ PAGES.each do |page|
three_taxon_section = Spree::CmsSection.where(
name: name_txt,
- type: 'Spree::Cms::Sections::ThreeTaxonCategoriesBlock',
+ type: 'Spree::Cms::Sections::ImageGallery',
cms_page: page
).first_or_create!