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.

Refactor Hero Image for Better Naming.

Matthew Kennedy8b3af330da40
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/_hero_image.html.erb
similarity index 99%
rename from backend/app/views/spree/admin/cms_sections/types/_full_screen_hero_image.html.erb
rename to backend/app/views/spree/admin/cms_sections/types/_hero_image.html.erb
index d8514db3ca..11fc9d0fa9 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/_hero_image.html.erb
@@ -49,7 +49,7 @@
<%= 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::FullScreenHeroImage',
+ spree_humanize_dropdown_values('Spree::Cms::Sections::HeroImage',
{ const: 'LINKED_RESOURCE_TYPE' }),
{ include_blank: false },
class: 'link_switcher') %>
diff --git a/core/app/models/spree/cms/sections/full_screen_hero_image.rb b/core/app/models/spree/cms/sections/hero_image.rb
similarity index 93%
rename from core/app/models/spree/cms/sections/full_screen_hero_image.rb
rename to core/app/models/spree/cms/sections/hero_image.rb
index 58e59bc05b..a0a1522830 100644
--- a/core/app/models/spree/cms/sections/full_screen_hero_image.rb
+++ b/core/app/models/spree/cms/sections/hero_image.rb
@@ -1,5 +1,5 @@
module Spree::Cms::Sections
- class FullScreenHeroImage < Spree::CmsSection
+ class HeroImage < Spree::CmsSection
before_save :reset_link_attributes
after_initialize :default_values
diff --git a/core/app/models/spree/cms_section.rb b/core/app/models/spree/cms_section.rb
index f80bd8cb80..24bda8e7c7 100644
--- a/core/app/models/spree/cms_section.rb
+++ b/core/app/models/spree/cms_section.rb
@@ -24,7 +24,7 @@ module Spree
LINKED_RESOURCE_TYPE = []
- TYPES = ['Spree::Cms::Sections::FullScreenHeroImage',
+ TYPES = ['Spree::Cms::Sections::HeroImage',
'Spree::Cms::Sections::FeaturedArticle',
'Spree::Cms::Sections::ProductCarousel',
'Spree::Cms::Sections::ThreeTaxonCategoriesBlock',
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index d88ac13df0..2eb947e1ee 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -560,7 +560,7 @@ en:
link_to_taxon: Link to Taxon
title: Title
fit: Fit To
- info_full_screen_hero_image_body: "<p>The Full-Screen Hero Image section adds a large image with a button and tagline text to your page.</p>
+ info_hero_image_body: "<p>The Hero Image section adds a large image with a button and tagline text to your page.</p>
<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>"
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 66bf204b89..e8f396f3f6 100644
--- a/core/lib/spree/testing_support/factories/cms_section_factory.rb
+++ b/core/lib/spree/testing_support/factories/cms_section_factory.rb
@@ -3,7 +3,7 @@ FactoryBot.define do
name { generate(:random_string) }
factory :cms_hero_section do
- type { 'Spree::Cms::Sections::FullScreenHeroImage' }
+ type { 'Spree::Cms::Sections::HeroImage' }
end
factory :cms_featured_article_section do
diff --git a/frontend/app/views/spree/shared/cms/sections/_full_screen_hero_image.html.erb b/frontend/app/views/spree/shared/cms/sections/_hero_image.html.erb
similarity index 100%
rename from frontend/app/views/spree/shared/cms/sections/_full_screen_hero_image.html.erb
rename to frontend/app/views/spree/shared/cms/sections/_hero_image.html.erb
diff --git a/sample/db/samples/cms_sections.rb b/sample/db/samples/cms_sections.rb
index 6557f1f40e..9b9a0e1eb9 100644
--- a/sample/db/samples/cms_sections.rb
+++ b/sample/db/samples/cms_sections.rb
@@ -31,7 +31,7 @@ PAGES.each do |page|
hero_section = Spree::CmsSection.where(
name: name_txt,
- type: 'Spree::Cms::Sections::FullScreenHeroImage',
+ type: 'Spree::Cms::Sections::HeroImage',
linked_resource_type: 'Spree::Taxon',
cms_page: page
).first_or_create!