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.

Remove legacy Spree 4.x CMS (#12326)

Damian Legawiec6f6b4f756e64
diff --git a/admin/config/locales/en.yml b/admin/config/locales/en.yml
index 23c48437d3..e07957346a 100644
--- a/admin/config/locales/en.yml
+++ b/admin/config/locales/en.yml
@@ -187,55 +187,6 @@ en:
store_credits: Store Credits
no_store_credit: User has no Store Credit available.
available_store_credit: User has %{amount} in Store Credit available.
- navigation:
- all_menus: All Menus
- add_new_menu: Add New Menu
- add_new_item: 'Add New Item'
- code: Code
- default_menus_info:
- title: Default Menus
- body: "Default menus are menus whose language matches the associated store's default language.<br><br>
- <h5>Example</h5>If you have a store that uses Spanish as the default language but also offers the options of German and French; your default header menu for this store would be set to use <b>Español (es)</b> for the language and <b>Header</b> as the location.<br><br>
- <h5>Why Are Default Menus Important?</h5> Default menus are displayed to your visitor if no menu is available in the current language they are browsing. It is recommended that you create a default menu for each menu location within each store.<br><br>
- <h5>More Information</h5>To learn more about menus, view the official Spree user documentation by <a href='https://guides.spreecommerce.org/user/navigation/building_the_main_menu.html' target='_blank' class='alert-link'>clicking here</a>."
- allow_this_menu_item_to_contain_nested_menu_items: Allow this Menu Item to contain nested items
- back_to_all_menus: Back To All Menus
- click_create_to_load_new_link: 'Click the <b>Create</b> button below to change the link field.'
- click_update_to_load_new_link: 'Click the <b>Update</b> button below to change the link field.'
- give_your_menu_a_unique_name: 'Use the unique code to identify your menu: spree-eu-main'
- link_settings: Link Settings
- link_to: Link To
- image_alt_text: Add alt text to your image
- image_asset: Add a Promotion image or Link icon.
- move_could_not_be_saved: 'ERROR: This move could not be saved.'
- managing_by_store_title: 'Managing Menus By Store'
- managing_by_store: <p>You are managing the menus for <b>%{store}</b>. To manage menus for other stores, change the global store using the drop-down in the main navbar found at the top of the screen.</p>
- new_menu_item: New Menu Item
- new_menu: New Menu
- nested_under: Nested under
- no_menu_items: '<b>%{menu}</b> has no items. Click the <b>Add New Item</b> button to begin adding links to this menu.'
- nested_under_info: Quickly nest your Menu Item if you already know where it needs to be.
- item_type: Item Type
- image_info: '<b>NOTE:</b> You can attach an image to any menu item, but your image will only be displayed in the main menu when nested inside a container with the code <b>promo</b>.<br><br> For best results use images with a width of 540px and height of 350px.'
- open_link_in_new_window: Open this link in a new window
- menu_item_type_container_message: "Containers are menu items that do not link to a destination. If you are building the Spree Main Menu
- create containers with the code: <b>category</b> or <b>promo</b>, and then nest your links inside these containers build out your menu.
- <br><br> For an indepth guide to building the main menu see the documenttation page <a href='https://guides.spreecommerce.org/user/navigation/building_the_main_menu.html' target='_blank' class='alert-link'>Building The Main Menu</a>"
- menus: Menus
- menu_items: '%{menu_name} Items'
- public_details: Public Details
- subtitle: Subtitle
- url_info: 'The URL field can link to an external website using <b>https://example.com</b>, link to an otherwise unreachable internal path using <b>/policies/privacy</b>,
- launch an email client using <b>mailto:[email protected]</b> or used to create a clickable phone number with <b>tel:123456789</b>'
- search_for_a_product: Search for a Product
- search_for_a_taxon: Search for a Taxon
- settings: Settings
- set_a_code: "Adding a code is optional but can be useful if you need to identify this menu item. When building
- the Spree main menu use the code <b>category</b> or <b>promo</b> to create the containers that organize links and promotions appropriately. To learn more view the documentation by <a href='https://guides.spreecommerce.org/user/navigation/add_menu_items.html' target='_blank' class='alert-link'>clicking here</a>."
- type: Type
- used_in: Used In
- you_have_no_menus: You have no Menus, click the Add New Menu button to create your first Menu.
- this_link_takes_you_to_your_stores_home_page: This link takes you to your stores home page.
settings: Settings
stock_transfers:
add_products_tip: You need to select a destination location first
@@ -253,15 +204,12 @@ en:
select_events: Select events
addresses: Addresses
assets: Assets
- cms_pages: Cms Pages
credit_cards: Credit Cards
customer_returns: Customer Returns
digital_links: Digital Links
digitals: Digitals
inventory_units: Inventory Units
line_items: Line Items
- menu_items: Menu Items
- menus: Menus
option_types: Option Types
option_values: Option Values
orders: Orders
diff --git a/api/app/controllers/spree/api/v2/platform/cms_pages_controller.rb b/api/app/controllers/spree/api/v2/platform/cms_pages_controller.rb
deleted file mode 100644
index bdccc7d38e..0000000000
--- a/api/app/controllers/spree/api/v2/platform/cms_pages_controller.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class CmsPagesController < ResourceController
- private
-
- def model_class
- Spree::CmsPage
- end
-
- def scope_includes
- [:cms_sections]
- end
- end
- end
- end
- end
-end
diff --git a/api/app/controllers/spree/api/v2/platform/cms_sections_controller.rb b/api/app/controllers/spree/api/v2/platform/cms_sections_controller.rb
deleted file mode 100644
index 34e7c83b49..0000000000
--- a/api/app/controllers/spree/api/v2/platform/cms_sections_controller.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class CmsSectionsController < ResourceController
- private
-
- def model_class
- Spree::CmsSection
- end
-
- def spree_permitted_attributes
- stored_attributes = []
-
- Spree::CmsSection::TYPES.each do |type|
- type.constantize.stored_attributes.each do |_name, values|
- values.each do |value|
- stored_attributes << value
- end
- end
- end
-
- super + stored_attributes.compact.uniq!
- end
- end
- end
- end
- end
-end
diff --git a/api/app/controllers/spree/api/v2/platform/menu_items_controller.rb b/api/app/controllers/spree/api/v2/platform/menu_items_controller.rb
deleted file mode 100644
index 8c32441116..0000000000
--- a/api/app/controllers/spree/api/v2/platform/menu_items_controller.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class MenuItemsController < ResourceController
- include ::Spree::Api::V2::Platform::NestedSetRepositionConcern
-
- private
-
- def model_class
- Spree::MenuItem
- end
-
- def spree_permitted_attributes
- super + [:new_parent_id, :new_position_idx]
- end
- end
- end
- end
- end
-end
diff --git a/api/app/controllers/spree/api/v2/platform/menus_controller.rb b/api/app/controllers/spree/api/v2/platform/menus_controller.rb
deleted file mode 100644
index e568dd4fab..0000000000
--- a/api/app/controllers/spree/api/v2/platform/menus_controller.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class MenusController < ResourceController
- private
-
- def model_class
- Spree::Menu
- end
-
- def scope_includes
- [:menu_items]
- end
- end
- end
- end
- end
-end
diff --git a/api/app/controllers/spree/api/v2/storefront/cms_pages_controller.rb b/api/app/controllers/spree/api/v2/storefront/cms_pages_controller.rb
deleted file mode 100644
index ec9ca5e0d9..0000000000
--- a/api/app/controllers/spree/api/v2/storefront/cms_pages_controller.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-module Spree
- module Api
- module V2
- module Storefront
- class CmsPagesController < ::Spree::Api::V2::ResourceController
- private
-
- def model_class
- Spree::CmsPage
- end
-
- def resource
- @resource ||= scope.find_by(slug: params[:id]) || scope.find(params[:id])
- end
-
- def resource_serializer
- Spree::Api::Dependencies.storefront_cms_page_serializer.constantize
- end
-
- def collection_serializer
- Spree::Api::Dependencies.storefront_cms_page_serializer.constantize
- end
-
- def collection_finder
- Spree::Api::Dependencies.storefront_cms_page_finder.constantize
- end
-
- def scope
- super.by_locale(I18n.locale)
- end
-
- def scope_includes
- {
- cms_sections: :linked_resource
- }
- end
- end
- end
- end
- end
-end
diff --git a/api/app/controllers/spree/api/v2/storefront/menus_controller.rb b/api/app/controllers/spree/api/v2/storefront/menus_controller.rb
deleted file mode 100644
index 15a34c8047..0000000000
--- a/api/app/controllers/spree/api/v2/storefront/menus_controller.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-module Spree
- module Api
- module V2
- module Storefront
- class MenusController < ::Spree::Api::V2::ResourceController
- private
-
- def resource_serializer
- Spree::Api::Dependencies.storefront_menu_serializer.constantize
- end
-
- def collection_serializer
- Spree::Api::Dependencies.storefront_menu_serializer.constantize
- end
-
- def collection_finder
- Spree::Api::Dependencies.storefront_menu_finder.constantize
- end
-
- def model_class
- Spree::Menu
- end
-
- def scope
- super.by_locale(I18n.locale)
- end
-
- def scope_includes
- { menu_items: [:children, :parent, :icon] }
- end
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/cms_page_serializer.rb b/api/app/serializers/spree/api/v2/platform/cms_page_serializer.rb
deleted file mode 100644
index 2a5a57cc44..0000000000
--- a/api/app/serializers/spree/api/v2/platform/cms_page_serializer.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class CmsPageSerializer < BaseSerializer
- include ResourceSerializerConcern
-
- has_many :cms_sections, serializer: :cms_section
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/cms_section_image_one_serializer.rb b/api/app/serializers/spree/api/v2/platform/cms_section_image_one_serializer.rb
deleted file mode 100644
index 7e15fe97be..0000000000
--- a/api/app/serializers/spree/api/v2/platform/cms_section_image_one_serializer.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class CmsSectionImageOneSerializer < AssetSerializer; end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/cms_section_image_three_serializer.rb b/api/app/serializers/spree/api/v2/platform/cms_section_image_three_serializer.rb
deleted file mode 100644
index bf2d2bb904..0000000000
--- a/api/app/serializers/spree/api/v2/platform/cms_section_image_three_serializer.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class CmsSectionImageThreeSerializer < AssetSerializer; end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/cms_section_image_two_serializer.rb b/api/app/serializers/spree/api/v2/platform/cms_section_image_two_serializer.rb
deleted file mode 100644
index 3fec349251..0000000000
--- a/api/app/serializers/spree/api/v2/platform/cms_section_image_two_serializer.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class CmsSectionImageTwoSerializer < AssetSerializer; end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/cms_section_serializer.rb b/api/app/serializers/spree/api/v2/platform/cms_section_serializer.rb
deleted file mode 100644
index 4a69956176..0000000000
--- a/api/app/serializers/spree/api/v2/platform/cms_section_serializer.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class CmsSectionSerializer < BaseSerializer
- include ResourceSerializerConcern
-
- belongs_to :cms_page, serializer: :cms_page
- belongs_to :linked_resource, polymorphic: {
- Spree::Cms::Pages::StandardPage => :cms_page,
- Spree::Cms::Pages::FeaturePage => :cms_page,
- Spree::Cms::Pages::Homepage => :cms_page
- }
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/feature_page_serializer.rb b/api/app/serializers/spree/api/v2/platform/feature_page_serializer.rb
deleted file mode 100644
index b7d6b56afd..0000000000
--- a/api/app/serializers/spree/api/v2/platform/feature_page_serializer.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class FeaturePageSerializer < CmsPageSerializer
- # Place holder serializer for Webhooks.
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/hero_image_serializer.rb b/api/app/serializers/spree/api/v2/platform/hero_image_serializer.rb
deleted file mode 100644
index fe876d0ccb..0000000000
--- a/api/app/serializers/spree/api/v2/platform/hero_image_serializer.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class HeroImageSerializer < CmsSectionSerializer
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/homepage_serializer.rb b/api/app/serializers/spree/api/v2/platform/homepage_serializer.rb
deleted file mode 100644
index 7bbd2bc928..0000000000
--- a/api/app/serializers/spree/api/v2/platform/homepage_serializer.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class HomepageSerializer < CmsPageSerializer
- # Place holder serializer for Webhooks.
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/icon_serializer.rb b/api/app/serializers/spree/api/v2/platform/icon_serializer.rb
deleted file mode 100644
index d8e616496e..0000000000
--- a/api/app/serializers/spree/api/v2/platform/icon_serializer.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class IconSerializer < BaseSerializer
- set_type :icon
-
- attribute :url do |icon|
- url_helpers = Rails.application.routes.url_helpers
- url_helpers.polymorphic_url(icon.attachment, only_path: true)
- end
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/image_gallery_serializer.rb b/api/app/serializers/spree/api/v2/platform/image_gallery_serializer.rb
deleted file mode 100644
index 7e78532d71..0000000000
--- a/api/app/serializers/spree/api/v2/platform/image_gallery_serializer.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class ImageGallerySerializer < CmsSectionSerializer
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/menu_item_serializer.rb b/api/app/serializers/spree/api/v2/platform/menu_item_serializer.rb
deleted file mode 100644
index 889290d671..0000000000
--- a/api/app/serializers/spree/api/v2/platform/menu_item_serializer.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class MenuItemSerializer < BaseSerializer
- include ResourceSerializerConcern
-
- attributes :link
-
- attribute :is_container do |menu_item|
- menu_item.container?
- end
-
- attribute :is_root do |menu_item|
- menu_item.root?
- end
-
- attribute :is_child do |menu_item|
- menu_item.child?
- end
-
- attribute :is_leaf do |menu_item|
- menu_item.leaf?
- end
-
- has_one :icon,
- object_method_name: :icon,
- id_method_name: :icon_id,
- record_type: :icon,
- serializer: :icon
-
- belongs_to :menu, serializer: :menu
- belongs_to :parent, record_type: :menu_item, serializer: :menu_item
- belongs_to :linked_resource, polymorphic: {
- Spree::Cms::Pages::StandardPage => :cms_page,
- Spree::Cms::Pages::FeaturePage => :cms_page,
- Spree::Cms::Pages::Homepage => :cms_page
- }
-
- has_many :children, record_type: :menu_item, serializer: :menu_item
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/menu_serializer.rb b/api/app/serializers/spree/api/v2/platform/menu_serializer.rb
deleted file mode 100644
index 69ec4c8f56..0000000000
--- a/api/app/serializers/spree/api/v2/platform/menu_serializer.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class MenuSerializer < BaseSerializer
- include ResourceSerializerConcern
-
- has_many :menu_items
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/side_by_side_image_serializer.rb b/api/app/serializers/spree/api/v2/platform/side_by_side_image_serializer.rb
deleted file mode 100644
index fb9d194504..0000000000
--- a/api/app/serializers/spree/api/v2/platform/side_by_side_image_serializer.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class SideBySideImageSerializer < CmsSectionSerializer
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/standard_page_serializer.rb b/api/app/serializers/spree/api/v2/platform/standard_page_serializer.rb
deleted file mode 100644
index fec82ff7e9..0000000000
--- a/api/app/serializers/spree/api/v2/platform/standard_page_serializer.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module Spree
- module Api
- module V2
- module Platform
- class StandardPageSerializer < CmsPageSerializer
- # Place holder serializer for Webhooks.
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/api/v2/platform/store_serializer.rb b/api/app/serializers/spree/api/v2/platform/store_serializer.rb
index cc29ca5fbe..9a2d25646a 100644
--- a/api/app/serializers/spree/api/v2/platform/store_serializer.rb
+++ b/api/app/serializers/spree/api/v2/platform/store_serializer.rb
@@ -6,7 +6,6 @@ module Spree
include ResourceSerializerConcern
include StoreMediaSerializerImagesConcern
- has_many :menus
has_one :default_country, serializer: :country, record_type: :country, id_method_name: :default_country_id
end
end
diff --git a/api/app/serializers/spree/v2/storefront/cms_page_serializer.rb b/api/app/serializers/spree/v2/storefront/cms_page_serializer.rb
deleted file mode 100644
index 756dc2d1d0..0000000000
--- a/api/app/serializers/spree/v2/storefront/cms_page_serializer.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Spree
- module V2
- module Storefront
- class CmsPageSerializer < BaseSerializer
- set_type :cms_page
-
- attributes :title, :content, :locale, :meta_description, :meta_title,
- :slug, :type
-
- has_many :cms_sections, serializer: :cms_section
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb b/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb
deleted file mode 100644
index 84a413d213..0000000000
--- a/api/app/serializers/spree/v2/storefront/cms_section_serializer.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-module Spree
- module V2
- module Storefront
- class CmsSectionSerializer < BaseSerializer
- set_type :cms_section
-
- attributes :name, :content, :settings, :link, :fit, :type, :position
-
- Spree::CmsSectionImage::IMAGE_COUNT.each do |count|
- Spree::CmsSectionImage::IMAGE_SIZE.each do |size|
- attribute "img_#{count}_#{size}".to_sym do |section|
- if section.send("image_#{count}")&.attachment&.attached? && section.send("img_#{count}_#{size}").present?
- url_helpers = Rails.application.routes.url_helpers
- url_helpers.rails_representation_path(section.send("img_#{count}_#{size}"), only_path: true)
- end
- end
- end
- end
-
- attribute :is_fullscreen do |section|
- section.fullscreen?
- end
-
- belongs_to :linked_resource, polymorphic: {
- Spree::Cms::Pages::StandardPage => :cms_page,
- Spree::Cms::Pages::FeaturePage => :cms_page,
- Spree::Cms::Pages::Homepage => :cms_page
- }
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/v2/storefront/icon_serializer.rb b/api/app/serializers/spree/v2/storefront/icon_serializer.rb
deleted file mode 100644
index c191ca9530..0000000000
--- a/api/app/serializers/spree/v2/storefront/icon_serializer.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Spree
- module V2
- module Storefront
- class IconSerializer < BaseSerializer
- set_type :icon
-
- attribute :url do |icon|
- url_helpers = Rails.application.routes.url_helpers
- url_helpers.polymorphic_url(icon.attachment, only_path: true)
- end
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/v2/storefront/menu_item_serializer.rb b/api/app/serializers/spree/v2/storefront/menu_item_serializer.rb
deleted file mode 100644
index 6c3ec3564d..0000000000
--- a/api/app/serializers/spree/v2/storefront/menu_item_serializer.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-module Spree
- module V2
- module Storefront
- class MenuItemSerializer < BaseSerializer
- set_type :menu_item
-
- attributes :code, :name, :subtitle, :link, :destination, :item_type, :new_window, :lft, :rgt, :depth
-
- attribute :is_container do |menu_item|
- menu_item.container?
- end
-
- attribute :is_root do |menu_item|
- menu_item.root?
- end
-
- attribute :is_child do |menu_item|
- menu_item.child?
- end
-
- attribute :is_leaf do |menu_item|
- menu_item.leaf?
- end
-
- has_one :icon,
- object_method_name: :icon,
- id_method_name: :icon_id,
- record_type: :icon,
- serializer: :icon
-
- belongs_to :menu, serializer: :menu
- belongs_to :parent, record_type: :menu_item, serializer: :menu_item
- belongs_to :linked_resource, polymorphic: {
- Spree::Cms::Pages::StandardPage => :cms_page,
- Spree::Cms::Pages::FeaturePage => :cms_page,
- Spree::Cms::Pages::Homepage => :cms_page
- }
-
- has_many :children, record_type: :menu_item, serializer: :menu_item
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/v2/storefront/menu_serializer.rb b/api/app/serializers/spree/v2/storefront/menu_serializer.rb
deleted file mode 100644
index 7ab9791485..0000000000
--- a/api/app/serializers/spree/v2/storefront/menu_serializer.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Spree
- module V2
- module Storefront
- class MenuSerializer < BaseSerializer
- set_type :menu
-
- attributes :name, :location, :locale
-
- has_many :menu_items
- end
- end
- end
-end
diff --git a/api/app/serializers/spree/v2/storefront/store_serializer.rb b/api/app/serializers/spree/v2/storefront/store_serializer.rb
index ed5b16aca1..26a425a16a 100644
--- a/api/app/serializers/spree/v2/storefront/store_serializer.rb
+++ b/api/app/serializers/spree/v2/storefront/store_serializer.rb
@@ -10,9 +10,6 @@ module Spree
:default, :supported_currencies, :facebook, :twitter, :instagram, :default_locale,
:customer_support_email, :description, :address, :contact_phone, :supported_locales
- has_many :menus
- has_many :cms_pages
-
has_one :default_country, serializer: :country, record_type: :country, id_method_name: :default_country_id
end
end
diff --git a/api/config/routes.rb b/api/config/routes.rb
index e3cc9b30ea..3d86986391 100644
--- a/api/config/routes.rb
+++ b/api/config/routes.rb
@@ -173,14 +173,6 @@ Spree::Core::Engine.add_routes do
resources :roles
- # Menu API
- resources :menus
- resources :menu_items do
- member do
- patch :reposition
- end
- end
-
# CMS
resources :cms_pages
resources :cms_sections
diff --git a/api/lib/spree/api/dependencies.rb b/api/lib/spree/api/dependencies.rb
index a160e757bc..7ce51ba47c 100644
--- a/api/lib/spree/api/dependencies.rb
+++ b/api/lib/spree/api/dependencies.rb
@@ -49,10 +49,10 @@ module Spree
# serializers
storefront_address_serializer: 'Spree::V2::Storefront::AddressSerializer',
storefront_cart_serializer: 'Spree::V2::Storefront::CartSerializer',
- storefront_cms_page_serializer: 'Spree::V2::Storefront::CmsPageSerializer',
+ storefront_cms_page_serializer: 'Spree::V2::Storefront::CmsPageSerializer', # LEGACY
storefront_credit_card_serializer: 'Spree::V2::Storefront::CreditCardSerializer',
storefront_country_serializer: 'Spree::V2::Storefront::CountrySerializer',
- storefront_menu_serializer: 'Spree::V2::Storefront::MenuSerializer',
+ storefront_menu_serializer: 'Spree::V2::Storefront::MenuSerializer', # LEGACY
storefront_user_serializer: 'Spree::V2::Storefront::UserSerializer',
storefront_shipment_serializer: 'Spree::V2::Storefront::ShipmentSerializer',
storefront_taxon_serializer: 'Spree::V2::Storefront::TaxonSerializer',
diff --git a/api/spec/integration/api/v2/platform/cms_pages_spec.rb b/api/spec/integration/api/v2/platform/cms_pages_spec.rb
deleted file mode 100644
index 323d8b6f0b..0000000000
--- a/api/spec/integration/api/v2/platform/cms_pages_spec.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'swagger_helper'
-
-describe 'CMS Pages API', swagger: true do
- include_context 'Platform API v2'
-
- resource_name = 'CMS Page'
- options = {
- include_example: 'cms_sections',
- filter_examples: [{ name: 'filter[type_eq]', example: 'Spree::Cms::Pages::FeaturePage' },
- { name: 'filter[locale_eq]', example: 'en' },
- { name: 'filter[title_cont]', example: 'About Us' }],
- custom_create_params: {
- oneOf: [
- { '$ref' => '#/components/schemas/create_standard_cms_page_params' },
- { '$ref' => '#/components/schemas/create_homepage_cms_page_params' },
- { '$ref' => '#/components/schemas/create_feature_cms_page_params' }
- ]
- },
- custom_update_params: {
- oneOf: [
- { '$ref' => '#/components/schemas/update_standard_cms_page_params' },
- { '$ref' => '#/components/schemas/update_homepage_cms_page_params' },
- { '$ref' => '#/components/schemas/update_feature_cms_page_params' }
- ]
- }
- }
-
- let(:store) { Spree::Store.default }
-
- let(:id) { create(:cms_standard_page, store: store).id }
- let(:records_list) { create_list(:cms_standard_page, 2, store: store) }
- let(:valid_create_param_value) { build(:cms_standard_page).attributes }
- let(:valid_update_param_value) do
- {
- title: 'My Super Page'
- }
- end
- let(:invalid_param_value) do
- {
- title: ''
- }
- end
-
- include_examples 'CRUD examples', resource_name, options
-end
diff --git a/api/spec/integration/api/v2/platform/cms_sections_spec.rb b/api/spec/integration/api/v2/platform/cms_sections_spec.rb
deleted file mode 100644
index f4542e159a..0000000000
--- a/api/spec/integration/api/v2/platform/cms_sections_spec.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-require 'swagger_helper'
-
-describe 'CMS Section API', swagger: true do
- include_context 'Platform API v2'
-
- resource_name = 'CMS Section'
- options = {
- include_example: 'product',
- filter_examples: [{ name: 'filter[name_eq]', example: 'Hero' }],
- custom_create_params: {
- oneOf: [
- { '$ref' => '#/components/schemas/create_hero_image_cms_section_params' },
- { '$ref' => '#/components/schemas/create_product_carousel_cms_section_params' },
- { '$ref' => '#/components/schemas/create_side_by_side_images_cms_section_params' },
- { '$ref' => '#/components/schemas/create_featured_article_cms_section_params' },
- { '$ref' => '#/components/schemas/create_image_gallery_cms_section_params' },
- { '$ref' => '#/components/schemas/create_rich_text_cms_section_params' }
- ]
- },
- custom_update_params: {
- oneOf: [
- { '$ref' => '#/components/schemas/update_hero_image_cms_section_params' },
- { '$ref' => '#/components/schemas/update_product_carousel_cms_section_params' },
- { '$ref' => '#/components/schemas/update_side_by_side_images_cms_section_params' },
- { '$ref' => '#/components/schemas/update_featured_article_cms_section_params' },
- { '$ref' => '#/components/schemas/update_image_gallery_cms_section_params' },
- { '$ref' => '#/components/schemas/update_rich_text_cms_section_params' }
- ]
- }
- }
-
- let!(:store) { Spree::Store.default }
- let!(:product) { create(:product) }
- let!(:cms_page) { create(:cms_feature_page, store: store) }
- let!(:cms_section) { create(:cms_hero_image_section, cms_page: cms_page) }
- let!(:cms_image_gallery_section) { create(:cms_image_gallery_section, cms_page: cms_page) }
- let!(:cms_featured_article_section) { create(:cms_featured_article_section, cms_page: cms_page) }
-
- let(:id) { create(:cms_hero_image_section, cms_page: cms_page, linked_resource: product).id }
- let(:records_list) { create_list(:cms_hero_image_section, 2, cms_page: cms_page, linked_resource: product) }
-
- let(:valid_create_param_value) { build(:cms_hero_image_section, cms_page: cms_page, linked_resource: product).attributes }
- let(:valid_update_param_value) do
- {
- name: 'Super Hero',
- position: 1,
- type: 'Spree::Cms::Sections::HeroImage'
- }
- end
-
- let(:invalid_param_value) do
- {
- name: ''
- }
- end
-
- include_examples 'CRUD examples', resource_name, options
-end
diff --git a/api/spec/integration/api/v2/platform/menu_items_spec.rb b/api/spec/integration/api/v2/platform/menu_items_spec.rb
deleted file mode 100644
index 28f247a4bd..0000000000
--- a/api/spec/integration/api/v2/platform/menu_items_spec.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-require 'swagger_helper'
-
-describe 'Menu Items API', swagger: true do
- include_context 'Platform API v2'
-
- resource_name = 'Menu Item'
- options = {
- include_example: 'menu,icon,parent,children,linked_resource',
- filter_examples: [{ name: 'filter[name_eq]', example: 'T-Shirts' }]
- }
-
- let(:menu) { create(:menu, store: store) }
- let(:id) { create(:menu_item, menu: menu).id }
- let!(:menu_item_one) { create(:menu_item, menu: menu) }
- let!(:menu_item_two) { create(:menu_item, menu: menu) }
- let!(:menu_item_three) { create(:menu_item, menu: menu) }
-
- let(:records_list) { create_list(:menu_item, 4, menu: menu) }
- let(:valid_create_param_value) { build(:menu_item, menu: menu).attributes }
- let(:valid_update_param_value) do
- {
- menu_item: {
- name: 'Menu Item One'
- }
- }
- end
- let(:invalid_param_value) do
- {
- menu_item: {
- name: ''
- }
- }
- end
- let(:valid_update_position_param_value) do
- {
- menu_item: {
- new_parent_id: menu_item_two.id,
- new_position_idx: 0
- }
- }
- end
-
- include_examples 'CRUD examples', resource_name, options
-
- path '/api/v2/platform/menu_items/{id}/reposition' do
- patch 'Reposition a Menu Item' do
- tags resource_name.pluralize
- security [ bearer_auth: [] ]
- operationId 'reposition-menu-item'
- description 'Reposition a Menu Item'
- consumes 'application/json'
- parameter name: :id, in: :path, type: :string
- parameter name: :menu_item, in: :body, schema: { '$ref' => '#/components/schemas/menu_item_reposition' }
-
- let(:menu_item) { valid_update_position_param_value }
-
- it_behaves_like 'record updated'
- it_behaves_like 'record not found', :menu_item
- it_behaves_like 'authentication failed'
- end
- end
-end
diff --git a/api/spec/integration/api/v2/platform/menus_spec.rb b/api/spec/integration/api/v2/platform/menus_spec.rb
deleted file mode 100644
index 700c699d6d..0000000000
--- a/api/spec/integration/api/v2/platform/menus_spec.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-require 'swagger_helper'
-
-describe 'Menus API', swagger: true do
- include_context 'Platform API v2'
-
- resource_name = 'Menu'
- options = {
- include_example: 'menu_items',
- filter_examples: [{ name: 'filter[name_eq]', example: 'Main Menu' },
- { name: 'filter[location_eq]', example: 'header' }]
- }
-
- let(:id) { create(:menu, name: 'Main Menu').id }
- let(:records_list) do
- build_list(:menu, 2) do |record, i|
- if i == 0
- record.name = 'Main Menu'
- record.location = 'header'
- else
- record.name = 'Footer Menu'
- record.location = 'footer'
- end
- record.store = store
- record.locale = 'en'
-
- record.save!
- end
-
- menu_1 = Spree::Menu.first
- menu_2 = Spree::Menu.last
- create(:menu_item, menu: menu_1)
- create(:menu_item, menu: menu_1)
- create(:menu_item, menu: menu_2)
- create(:menu_item, menu: menu_2)
- end
- let(:valid_create_param_value) { build(:menu, name: 'Main Menu').attributes }
- let(:valid_update_param_value) do
- {
- name: 'Main Menu',
- location: 'header',
- locale: 'en'
- }
- end
- let(:invalid_param_value) do
- {
- name: '',
- locale: '',
- location: ''
- }
- end
-
- include_examples 'CRUD examples', resource_name, options
-end
diff --git a/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb b/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb
index 924d735e3d..43af5a7329 100644
--- a/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb
+++ b/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb
@@ -111,7 +111,7 @@ describe Spree::Webhooks::HasWebhooks do
context 'on touch events from callbacks' do
let!(:store2) { create(:store) }
- let!(:cms_page) { create(:cms_homepage, store: store2, locale: 'en') }
+ let!(:taxonomy) { create(:taxonomy, store: store2) }
let(:body) do
Spree::Api::V2::Platform::StoreSerializer.new(
store2,
@@ -122,7 +122,7 @@ describe Spree::Webhooks::HasWebhooks do
before { store2.changes_applied }
it 'does not emit the touched model\'s update event' do
- expect { cms_page.update(title: 'Homepage #1') }.not_to emit_webhook_event('store.update')
+ expect { taxonomy.update(name: 'Updated Taxonomy') }.not_to emit_webhook_event('store.update')
end
end
diff --git a/api/spec/requests/spree/api/v2/platform/cms_sections_spec.rb b/api/spec/requests/spree/api/v2/platform/cms_sections_spec.rb
deleted file mode 100644
index fb43ea0821..0000000000
--- a/api/spec/requests/spree/api/v2/platform/cms_sections_spec.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'spec_helper'
-
-describe 'Platform API v2 CmsSections', type: :request do
- include_context 'API v2 tokens'
- include_context 'Platform API v2'
-
- let!(:store) { Spree::Store.default }
- let!(:page) { create(:cms_homepage, store: store) }
-
- let!(:resource_a) { create(:cms_hero_image_section, cms_page: page) }
- let!(:resource_b) { create(:cms_featured_article_section, cms_page: page) }
- let!(:resource_c) { create(:cms_product_carousel_section, cms_page: page) }
- let!(:resource_d) { create(:cms_image_gallery_section, cms_page: page) }
- let!(:resource_e) { create(:cms_side_by_side_images_section, cms_page: page) }
- let!(:resource_f) { create(:cms_rich_text_content_section, cms_page: page) }
-
- let(:bearer_token) { { 'Authorization' => valid_authorization } }
-
- describe 'cms_sections#update' do
- context 'move resource_a from position 1 down to position 5' do
- let(:params) do
- {
- cms_section: { position: 5 }
- }
- end
-
- before do
- patch "/api/v2/platform/cms_sections/#{resource_a.id}", headers: bearer_token, params: params
- end
-
- it 'moves resource_a from position 1 to position 5 and updates the positions of its siblings accordingly' do
- reload_sections
-
- expect(resource_b.position).to eq(1)
- expect(resource_c.position).to eq(2)
- expect(resource_d.position).to eq(3)
- expect(resource_e.position).to eq(4)
- expect(resource_a.position).to eq(5)
- expect(resource_f.position).to eq(6)
- end
- end
-
- context 'can move position and update other attribute' do
- let(:params) do
- {
- cms_section: {
- name: 'Rename resource and update Position!',
- position: 1
- }
- }
- end
-
- before do
- patch "/api/v2/platform/cms_sections/#{resource_d.id}", headers: bearer_token, params: params
- end
-
- it 'moves resource_d from position 4 to position 1, and updates the name' do
- reload_sections
- expect(resource_d.position).to eq(1)
- expect(resource_d.name).to eq('Rename resource and update Position!')
- end
- end
-
- def reload_sections
- resource_a.reload
- resource_b.reload
- resource_c.reload
- resource_d.reload
- resource_e.reload
- resource_f.reload
- end
- end
-end
diff --git a/api/spec/requests/spree/api/v2/platform/menu_items_spec.rb b/api/spec/requests/spree/api/v2/platform/menu_items_spec.rb
deleted file mode 100644
index ce1608a055..0000000000
--- a/api/spec/requests/spree/api/v2/platform/menu_items_spec.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-require 'spec_helper'
-
-describe 'Platform API v2 Menu Items spec', type: :request do
- include_context 'API v2 tokens'
- include_context 'Platform API v2'
-
- let!(:menu) { create(:menu, store: store) }
- let!(:menu_item_a) { create(:menu_item, menu: menu) }
- let!(:menu_item_b) { create(:menu_item, menu: menu) }
- let!(:menu_item_c) { create(:menu_item, menu: menu, parent: menu_item_b) }
- let(:bearer_token) { { 'Authorization' => valid_authorization } }
-
- describe 'menu_item#reposition' do
- context 'with no params' do
- let(:params) do
- {
- menu_item: {
- new_parent_id: nil,
- new_position_idx: nil
- }
- }
- end
-
- before do
- patch "/api/v2/platform/menu_items/#{menu_item_a.id}/reposition", headers: bearer_token, params: params
- end
-
- it_behaves_like 'returns 404 HTTP status'
- end
-
- context 'with none existing parent ID' do
- let(:params) do
- {
- menu_item: {
- new_parent_id: 999129192192,
- new_position_idx: 0
- }
- }
- end
-
- before do
- patch "/api/v2/platform/menu_items/#{menu_item_a.id}/reposition", headers: bearer_token, params: params
- end
-
- it_behaves_like 'returns 404 HTTP status'
- end
-
- context 'with correct params' do
- let(:params) do
- {
- menu_item: {
- new_parent_id: menu_item_b.id,
- new_position_idx: 0
- }
- }
- end
-
- before do
- patch "/api/v2/platform/menu_items/#{menu_item_a.id}/reposition", headers: bearer_token, params: params
- end
-
- it_behaves_like 'returns 200 HTTP status'
-
- it 'can be nested inside another item' do
- reload_items
-
- expect(menu_item_a.parent_id).to eq(menu_item_b.id)
-
- # Root depth = 0
- # Menu Item B depth = 1 (created inside menu.root)
- # Menu Item A depth = 2 (now moved inside Menu Item B)
- expect(menu_item_a.depth).to eq(2)
- end
- end
-
- context 'with correct params moving within the same item' do
- let(:params) do
- {
- menu_item: {
- new_parent_id: menu_item_b.id,
- new_position_idx: 1
- }
- }
- end
-
- before do
- patch "/api/v2/platform/menu_items/#{menu_item_a.id}/reposition", headers: bearer_token, params: params
- end
-
- it_behaves_like 'returns 200 HTTP status'
-
- it 're-indexes the item' do
- reload_items
-
- expect(menu_item_a.parent_id).to eq(menu_item_b.id)
- expect(menu_item_a.lft).to eq(menu_item_c.rgt + 1)
- end
- end
-
- def reload_items
- menu_item_a.reload
- menu_item_b.reload
- menu_item_c.reload
- end
- end
-end
diff --git a/api/spec/requests/spree/api/v2/platform/resources_spec.rb b/api/spec/requests/spree/api/v2/platform/resources_spec.rb
index 0cc5a411dc..c4ad798f5c 100644
--- a/api/spec/requests/spree/api/v2/platform/resources_spec.rb
+++ b/api/spec/requests/spree/api/v2/platform/resources_spec.rb
@@ -313,16 +313,16 @@ describe 'Platform API v2 Resources spec', type: :request do
context '#ensure_current_store' do
context 'single store resource' do
- let(:execute) { post '/api/v2/platform/menus', params: menu_resource_params, headers: bearer_token }
- let(:menu_resource_params) { { menu: build(:menu, name: 'Ensure-MenuTest', location: 'Header', locale: 'en').attributes.symbolize_keys } }
+ let(:execute) { post '/api/v2/platform/taxonomies', params: taxonomy_resource_params, headers: bearer_token }
+ let(:taxonomy_resource_params) { { taxonomy: build(:taxonomy, name: 'Ensure-TaxonomyTest', store: nil).attributes.symbolize_keys } }
before { execute }
it_behaves_like 'returns 201 HTTP status'
it 'adds the current store to the newly created resource' do
- new_menu = Spree::Menu.find_by(name: 'Ensure-MenuTest')
- expect(new_menu.store).to eql(store)
+ new_taxonomy = Spree::Taxonomy.find_by(name: 'Ensure-TaxonomyTest')
+ expect(new_taxonomy.store).to eql(store)
end
end
diff --git a/api/spec/requests/spree/api/v2/storefront/cms_pages_spec.rb b/api/spec/requests/spree/api/v2/storefront/cms_pages_spec.rb
deleted file mode 100644
index a7a06d6007..0000000000
--- a/api/spec/requests/spree/api/v2/storefront/cms_pages_spec.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-require 'spec_helper'
-
-describe 'Storefront API v2 CMS Pages spec', type: :request do
- let(:store) { Spree::Store.default }
-
- before do
- store.update(supported_locales: 'en,fr')
- end
-
- describe 'cms_pages#index' do
- let!(:home_en) { create(:cms_homepage, store: store) }
- let!(:standard_en) { create(:cms_standard_page, store: store, title: 'About us') }
- let!(:home_fr) { create(:cms_homepage, store: store, locale: 'fr') }
- let!(:standard_fr) { create(:cms_standard_page, store: store, locale: 'fr') }
- let!(:home_store_2) { create(:cms_homepage, store: create(:store)) }
- let(:page) { home_en }
-
- shared_examples 'returns proper JSON structure' do
- it 'with page attributes and relationships' do
- page.reload
-
- expect(json_response['data'][0]).to have_type('cms_page')
- expect(json_response['data'][0]).to have_relationships(:cms_sections)
- expect(json_response['data'][0]['id']).to eq(page.id.to_s)
- expect(json_response['data'][0]['attributes']['title']).to eq page.title
- expect(json_response['data'][0]['attributes']['locale']).to eq page.locale
- expect(json_response['data'][0]['attributes']['content']).to eq page.content
- expect(json_response['data'][0]['attributes']['meta_description']).to eq page.meta_description
- expect(json_response['data'][0]['attributes']['meta_title']).to eq page.meta_title
- expect(json_response['data'][0]['attributes']['slug']).to eq page.slug
- expect(json_response['data'][0]['attributes']['type']).to eq page.type
- end
- end
-
- context 'with no params' do
- before { get '/api/v2/storefront/cms_pages' }
-
- it_behaves_like 'returns proper JSON structure'
-
- it 'returns all pages for the current store and locale' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(home_en.id.to_s, standard_en.id.to_s)
- end
- end
-
- context 'with locale param' do
- let(:page) { home_fr }
-
- before { get '/api/v2/storefront/cms_pages?locale=fr' }
-
- it_behaves_like 'returns proper JSON structure'
-
- it 'returns all pages for the current store and specified locale' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(home_fr.id.to_s, standard_fr.id.to_s)
- end
- end
-
- context 'filtering by type' do
- shared_examples 'returns proper records' do
- before { get "/api/v2/storefront/cms_pages?filter[type]=#{kind}" }
-
- it 'returns pages for the current store and specified kind' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(page.id.to_s)
- end
- end
-
- context 'homepage' do
- let(:kind) { 'home' }
- let(:page) { home_en }
-
- it_behaves_like 'returns proper records'
- end
-
- context 'standard' do
- let(:kind) { 'standard' }
- let(:page) { standard_en }
-
- it_behaves_like 'returns proper records'
- end
-
- context 'feature' do
- let(:kind) { 'feature' }
- let!(:page) { create(:cms_feature_page, store: store) }
-
- it_behaves_like 'returns proper records'
- end
-
- context 'non-existing type' do
- before { get '/api/v2/storefront/cms_pages?filter[type]=non-existing' }
-
- it 'returns all records' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(home_en.id.to_s, standard_en.id.to_s)
- end
- end
- end
-
- context 'filtering by title' do
- before { get '/api/v2/storefront/cms_pages?filter[title]=about' }
-
- it 'returns page with title containing the query' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(standard_en.id.to_s)
- end
- end
-
- context 'including cms sections with linked resources' do
- let(:taxonomy) { create(:taxonomy, store: store) }
- let(:taxon) { create(:taxon, taxonomy: taxonomy) }
- let!(:cms_section) { create(:cms_hero_image_section, cms_page: home_en, linked_resource: taxon) }
-
- before { get '/api/v2/storefront/cms_pages?include=cms_sections.linked_resource' }
-
- it_behaves_like 'returns proper JSON structure'
-
- it 'returns sections and their associations' do
- page.reload
-
- expect(json_response['included']).to include(have_type('taxon').and(have_id(taxon.id.to_s)))
- expect(json_response['included']).to include(
- have_type('cms_section').
- and(
- have_id(cms_section.id.to_s).
- and(have_relationship(:linked_resource)).
- and(have_jsonapi_attributes(
- :name, :content, :settings, :link, :fit, :type, :position, :is_fullscreen,
- :img_one_sm, :img_one_md, :img_one_lg, :img_two_sm, :img_two_md, :img_two_lg,
- :img_three_sm, :img_three_md, :img_three_lg
- ))
- )
- )
- end
- end
- end
-
- describe 'cms_pages#show' do
- context 'with valid page ID' do
- let!(:page) { create(:cms_standard_page, store: store) }
- let(:taxonomy) { create(:taxonomy, store: store) }
- let(:taxon) { create(:taxon, taxonomy: taxonomy) }
- let!(:page_item) { create(:cms_hero_image_section, cms_page: page, linked_resource: taxon) }
-
- before { get "/api/v2/storefront/cms_pages/#{page.id}?include=cms_sections.linked_resource" }
-
- it 'returns page attributes and relationships' do
- expect(json_response['data']['id']).to eq(page.id.to_s)
- expect(json_response['data']['attributes']['title']).to eq page.title
-
- expect(json_response['included']).to include(have_type('taxon').and(have_id(taxon.id.to_s)))
- expect(json_response['included']).to include(have_type('cms_section').and(have_id(page_item.id.to_s).and(have_relationship(:linked_resource))))
- end
- end
-
- context 'with valid slug' do
- let!(:page) { create(:cms_standard_page, store: store) }
-
- before { get "/api/v2/storefront/cms_pages/#{page.slug}" }
-
- it_behaves_like 'returns 200 HTTP status'
- end
-
- context 'with page from different store' do
- let!(:page) { create(:cms_standard_page, store: create(:store)) }
-
- before { get "/api/v2/storefront/cms_pages/#{page.id}" }
-
- it_behaves_like 'returns 404 HTTP status'
- end
-
- context 'with non-existing page ID' do
- before { get '/api/v2/storefront/cms_pages/0' }
-
- it_behaves_like 'returns 404 HTTP status'
- end
- end
-end
diff --git a/api/spec/requests/spree/api/v2/storefront/menus_spec.rb b/api/spec/requests/spree/api/v2/storefront/menus_spec.rb
deleted file mode 100644
index 997b1c267a..0000000000
--- a/api/spec/requests/spree/api/v2/storefront/menus_spec.rb
+++ /dev/null
@@ -1,125 +0,0 @@
-require 'spec_helper'
-
-describe 'Storefront API v2 Menus spec', type: :request do
- let(:store) { Spree::Store.default }
-
- before do
- store.update(supported_locales: 'en,fr')
- end
-
- describe 'menus#index' do
- let!(:header_en) { create(:menu, store: store, location: 'Header') }
- let!(:footer_en) { create(:menu, store: store, location: 'Footer') }
- let!(:header_fr) { create(:menu, store: store, location: 'Header', locale: 'fr') }
- let!(:footer_fr) { create(:menu, store: store, location: 'Footer', locale: 'fr') }
- let!(:header_store_2) { create(:menu, store: create(:store), location: 'Header') }
- let(:menu) { header_en }
-
- shared_examples 'returns proper JSON structure' do
- it 'with menu attributes and relationships' do
- expect(json_response['data'][0]).to have_type('menu')
- expect(json_response['data'][0]).to have_relationships(:menu_items)
- expect(json_response['data'][0]['id']).to eq(menu.id.to_s)
- expect(json_response['data'][0]['attributes']['name']).to eq menu.name
- expect(json_response['data'][0]['attributes']['location']).to eq menu.location
- expect(json_response['data'][0]['attributes']['locale']).to eq menu.locale
- end
- end
-
- context 'with no params' do
- before { get '/api/v2/storefront/menus' }
-
- it_behaves_like 'returns proper JSON structure'
-
- it 'returns all menus for the current store and locale' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(header_en.id.to_s, footer_en.id.to_s)
- end
- end
-
- context 'with locale param' do
- let(:menu) { header_fr }
-
- before { get '/api/v2/storefront/menus?locale=fr' }
-
- it_behaves_like 'returns proper JSON structure'
-
- it 'returns all menus for the current store and specified locale' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(header_fr.id.to_s, footer_fr.id.to_s)
- end
- end
-
- context 'including menu items with linked resources' do
- let(:product) { create(:product, stores: [store]) }
- let(:taxonomy) { create(:taxonomy, store: store) }
- let(:taxon) { create(:taxon, taxonomy: taxonomy) }
- let(:standard_page) { create(:cms_standard_page, store: store) }
- let(:feature_page) { create(:cms_feature_page, store: store) }
- let(:homepage) { create(:cms_homepage, store: store) }
-
- let!(:menu_item) { create(:menu_item, menu: header_en, linked_resource: taxon) }
- let!(:menu_item_product) { create(:menu_item, menu: header_en, linked_resource: product) }
- let!(:menu_item_standard_page) { create(:menu_item, menu: header_en, linked_resource: standard_page) }
- let!(:menu_item_feature_page) { create(:menu_item, menu: header_en, linked_resource: feature_page) }
- let!(:menu_item_homepage) { create(:menu_item, menu: header_en, linked_resource: homepage) }
-
- before { get '/api/v2/storefront/menus?include=menu_items.linked_resource' }
-
- it_behaves_like 'returns proper JSON structure'
-
- it 'returns menu items and their associations' do
- expect(json_response['included']).to include(have_type('taxon').and(have_id(taxon.id.to_s)))
- expect(json_response['included']).to include(
- have_type('menu_item').
- and(
- have_id(menu_item.id.to_s).
- and(have_relationship(:icon, :menu, :parent, :children, :linked_resource)).
- and(have_jsonapi_attributes(:name, :code, :subtitle, :link, :new_window, :lft, :rgt, :depth, :is_container, :is_root, :is_child, :is_leaf))
- )
- )
- end
-
- context 'filtering by location' do
- before { get '/api/v2/storefront/menus?filter[location]=header' }
-
- it 'returns menus for the current store and specified location' do
- expect(json_response['data'].pluck(:id)).to contain_exactly(header_en.id.to_s)
- end
- end
- end
- end
-
- describe 'menus#show' do
- context 'with valid menu ID' do
- let!(:menu) { create(:menu, store: store) }
- let(:taxonomy) { create(:taxonomy, store: store) }
- let(:taxon) { create(:taxon, taxonomy: taxonomy) }
- let!(:menu_item) { create(:menu_item, menu: menu, linked_resource: taxon) }
-
- before { get "/api/v2/storefront/menus/#{menu.id}?include=menu_items.linked_resource" }
-
- it 'returns menu attributes and relationships' do
- expect(json_response['data']['id']).to eq(menu.id.to_s)
- expect(json_response['data']['attributes']['name']).to eq menu.name
- expect(json_response['data']['attributes']['location']).to eq menu.location
- expect(json_response['data']['attributes']['locale']).to eq menu.locale
-
- expect(json_response['included']).to include(have_type('taxon').and(have_id(taxon.id.to_s)))
- expect(json_response['included']).to include(have_type('menu_item').and(have_id(menu_item.id.to_s).and(have_relationship(:icon, :menu, :parent, :children, :linked_resource))))
- end
- end
-
- context 'with menu from different store' do
- let!(:menu) { create(:menu, store: create(:store)) }
-
- before { get "/api/v2/storefront/menus/#{menu.id}" }
-
- it_behaves_like 'returns 404 HTTP status'
- end
-
- context 'with non-existing menu ID' do
- before { get '/api/v2/storefront/menus/0' }
-
- it_behaves_like 'returns 404 HTTP status'
- end
- end
-end
diff --git a/api/spec/serializers/spree/api/v2/platform/cms_page_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/cms_page_serializer_spec.rb
deleted file mode 100644
index a63a99108b..0000000000
--- a/api/spec/serializers/spree/api/v2/platform/cms_page_serializer_spec.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Api::V2::Platform::CmsPageSerializer do
- subject { described_class.new(cms_page).serializable_hash }
-
- let(:cms_page) { create(:cms_feature_page, cms_sections: create_list(:cms_hero_image_section, 2)) }
-
- it do
- expect(subject).to eq(
- {
- data: {
- id: cms_page.id.to_s,
- type: :cms_page,
- attributes: {
- title: cms_page.title,
- meta_title: cms_page.meta_title,
- content: cms_page.content,
- meta_description: cms_page.meta_description,
- visible: cms_page.visible,
- slug: cms_page.slug,
- type: cms_page.type,
- locale: cms_page.locale,
- deleted_at: cms_page.deleted_at,
- created_at: cms_page.created_at,
- updated_at: cms_page.updated_at
- },
- relationships: {
- cms_sections: {
- data: [
- {
- id: cms_page.cms_sections.first.id.to_s,
- type: :cms_section
- },
- {
- id: cms_page.cms_sections.second.id.to_s,
- type: :cms_section
- }
- ]
- }
- }
- }
- }
- )
- end
-
- it_behaves_like 'an ActiveJob serializable hash'
-end
diff --git a/api/spec/serializers/spree/api/v2/platform/cms_section_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/cms_section_serializer_spec.rb
deleted file mode 100644
index a6a8e3b0c9..0000000000
--- a/api/spec/serializers/spree/api/v2/platform/cms_section_serializer_spec.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Api::V2::Platform::CmsSectionSerializer do
- subject { described_class.new(cms_section) }
-
- let(:product) { create(:product) }
- let(:cms_page) { create(:cms_feature_page) }
- let(:cms_section) { create(:cms_hero_image_section, cms_page: cms_page, linked_resource: product) }
-
- it { expect(subject.serializable_hash).to be_kind_of(Hash) }
-
- it do
- # Reload to get STI in the results.
- cms_section.reload
-
- expect(subject.serializable_hash).to eq(
- {
- data: {
- id: cms_section.id.to_s,
- type: :cms_section,
- attributes: {
- name: cms_section.name,
- content: cms_section.content,
- settings: cms_section.settings,
- fit: cms_section.fit,
- destination: cms_section.destination,
- type: cms_section.type,
- position: cms_section.position,
- linked_resource_type: cms_section.linked_resource_type,
- created_at: cms_section.created_at,
- updated_at: cms_section.updated_at
- },
- relationships: {
- cms_page: {
- data: {
- id: cms_section.cms_page.id.to_s,
- type: :cms_page
- }
- },
- linked_resource: {
- data: {
- id: product.id.to_s,
- type: :product
- }
- }
- }
- },
- }
- )
- end
-end
diff --git a/api/spec/serializers/spree/api/v2/platform/icon_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/icon_serializer_spec.rb
deleted file mode 100644
index cce569c914..0000000000
--- a/api/spec/serializers/spree/api/v2/platform/icon_serializer_spec.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Api::V2::Platform::IconSerializer do
- subject { described_class.new(icon) }
-
- let(:menu) { create(:menu) }
- let(:menu_item) { create(:menu_item, menu: menu) }
- let(:icon) { create(:icon, viewable: menu_item) }
-
- it { expect(subject.serializable_hash).to be_kind_of(Hash) }
-
- it do
- expect(subject.serializable_hash).to eq(
- {
- data: {
- id: icon.id.to_s,
- type: :icon,
- attributes: {
- url: Rails.application.routes.url_helpers.polymorphic_url(icon.attachment, only_path: true)
- }
- }
- }
- )
- end
-
- it { expect(subject.serializable_hash[:data][:id]).to be_kind_of(String) }
- it { expect(subject.serializable_hash[:data][:type]).to be(:icon) }
- it { expect(subject.serializable_hash[:data][:attributes][:url]).to include('thinking-cat.jpg') }
-end
diff --git a/api/spec/serializers/spree/api/v2/platform/menu_item_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/menu_item_serializer_spec.rb
deleted file mode 100644
index 1bd0b20853..0000000000
--- a/api/spec/serializers/spree/api/v2/platform/menu_item_serializer_spec.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Api::V2::Platform::MenuItemSerializer do
- subject { described_class.new(menu_item).serializable_hash }
-
- let(:menu) { create(:menu) }
- let(:menu_item) { create(:menu_item, menu: menu, linked_resource: create(:taxon)) }
- let!(:children) do
- [
- create(:menu_item, parent_id: menu_item.id, menu: menu),
- create(:menu_item, parent_id: menu_item.id, menu: menu)
- ]
- end
-
- it do
- expect(subject).to eq(
- {
- data: {
- id: menu_item.id.to_s,
- type: :menu_item,
- attributes: {
- code: nil,
- name: menu_item.name,
- subtitle: menu_item.subtitle,
- destination: menu_item.destination,
- new_window: menu_item.new_window,
- item_type: menu_item.item_type,
- is_child: menu_item.child?,
- is_container: menu_item.container?,
- is_leaf: menu_item.leaf?,
- is_root: menu_item.root?,
- link: menu_item.link,
- linked_resource_type: menu_item.linked_resource_type,
- lft: menu_item.lft,
- rgt: menu_item.rgt,
- depth: menu_item.depth,
- created_at: menu_item.created_at,
- updated_at: menu_item.updated_at
- },
- relationships: {
- icon: {
- data: {
- id: menu_item.icon.id.to_s,
- type: :icon
- }
- },
- menu: {
- data: {
- id: menu_item.menu.id.to_s,
- type: :menu
- }
- },
- parent: {
- data: {
- id: menu_item.menu.root.id.to_s,
- type: :menu_item
- }
- },
- linked_resource: {
- data: {
- id: menu_item.linked_resource.id.to_s,
- type: :taxon
- }
- },
- children: {
- data: [
- {
- id: menu_item.children.first.id.to_s,
- type: :menu_item
- },
- {
- id: menu_item.children.second.id.to_s,
- type: :menu_item
- }
- ]
- }
- }
- }
- }
- )
- end
-
- it_behaves_like 'an ActiveJob serializable hash'
-end
diff --git a/api/spec/serializers/spree/api/v2/platform/menu_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/menu_serializer_spec.rb
deleted file mode 100644
index d199b75e72..0000000000
--- a/api/spec/serializers/spree/api/v2/platform/menu_serializer_spec.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Api::V2::Platform::MenuSerializer do
- subject { described_class.new(menu).serializable_hash }
-
- let(:menu) { create(:menu) }
-
- it do
- expect(subject).to eq(
- {
- data: {
- id: menu.id.to_s,
- type: :menu,
- attributes: {
- name: menu.name,
- location: menu.location,
- locale: menu.locale,
- created_at: menu.created_at,
- updated_at: menu.updated_at
- },
- relationships: {
- menu_items: {
- data: [
- {
- id: menu.menu_items.first.id.to_s,
- type: :menu_item
- }
- ]
- }
- }
- }
- }
- )
- end
-
- it_behaves_like 'an ActiveJob serializable hash'
-end
diff --git a/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb
index 2be4657bd7..c715e5efea 100644
--- a/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb
+++ b/api/spec/serializers/spree/api/v2/platform/store_serializer_spec.rb
@@ -4,7 +4,6 @@ describe Spree::Api::V2::Platform::StoreSerializer do
subject { described_class.new(store).serializable_hash }
let!(:store) { Spree::Store.default }
- let!(:menus) { [create(:menu, store: store), create(:menu, location: 'Footer', store: store)] }
let!(:logo) do
store.logo.attach(io: File.new(Spree::Core::Engine.root + 'spec/fixtures' + 'thinking-cat.jpg'), filename: 'thinking-cat.jpg')
store.save
@@ -56,18 +55,6 @@ describe Spree::Api::V2::Platform::StoreSerializer do
id: store.default_country.id.to_s,
type: :country
}
- },
- menus: {
- data: [
- {
- id: store.menus.first.id.to_s,
- type: :menu
- },
- {
- id: store.menus.second.id.to_s,
- type: :menu
- }
- ]
}
},
}
diff --git a/api/spec/serializers/spree/v2/storefront/cms_section_serializer_spec.rb b/api/spec/serializers/spree/v2/storefront/cms_section_serializer_spec.rb
deleted file mode 100644
index 318d1aed1e..0000000000
--- a/api/spec/serializers/spree/v2/storefront/cms_section_serializer_spec.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-require 'spec_helper'
-
-describe Spree::V2::Storefront::CmsSectionSerializer do
- subject { described_class.new(cms_section) }
-
- let(:cms_section) { create(:cms_section) }
-
- shared_examples 'returns proper hash' do
- it { expect(subject.serializable_hash).to be_kind_of(Hash) }
-
- it do
- expect(subject.serializable_hash).to eq(
- {
- data: {
- id: cms_section.id.to_s,
- type: :cms_section,
- attributes: {
- name: cms_section.name,
- content: cms_section.content,
- settings: cms_section.settings,
- link: cms_section.link,
- fit: cms_section.fit,
- type: cms_section.type,
- position: cms_section.position,
- img_one_sm: cms_section.img_one_sm,
- img_one_md: cms_section.img_one_md,
- img_one_lg: cms_section.img_one_lg,
- img_one_xl: cms_section.img_one_xl,
- img_two_sm: cms_section.img_two_sm,
- img_two_md: cms_section.img_two_md,
- img_two_lg: cms_section.img_two_lg,
- img_two_xl: cms_section.img_two_xl,
- img_three_sm: cms_section.img_three_sm,
- img_three_md: cms_section.img_three_md,
- img_three_lg: cms_section.img_three_lg,
- img_three_xl: cms_section.img_three_xl,
- is_fullscreen: false
- },
- relationships: {
- linked_resource: {
- data: cms_section.linked_resource
- }
- }
- }
- }
- )
- end
- end
-
- context 'cms_hero_image_section' do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
- let!(:cms_section) do
- section = create(:cms_hero_image_section, cms_page: homepage)
- section.build_image_one
- section.image_one.attachment.attach(io: file, filename: 't-shirt.png')
- section
- end
- let(:file) { File.open(file_fixture('icon_256x256.jpg')) }
-
- it_behaves_like 'returns proper hash'
- end
-
- context 'cms_featured_article_section' do
- let(:homepage) { create(:cms_homepage) }
- let(:cms_section) { create(:cms_featured_article_section, name: 'Test', linked_resource_type: 'Spree::Taxon', cms_page: homepage) }
-
- it_behaves_like 'returns proper hash'
- end
-
- context 'cms_side_by_side_images_section' do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
- let!(:cms_section) do
- section = create(:cms_side_by_side_images_section, cms_page: homepage)
- section.build_image_one
- section.image_one.attachment.attach(io: file, filename: 't-shirt.png')
- section
- end
- let(:file) { File.open(file_fixture('icon_256x256.jpg')) }
-
- it_behaves_like 'returns proper hash'
- end
-
- context 'cms_image_gallery_section' do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
- let!(:cms_section) do
- section = create(:cms_image_gallery_section, cms_page: homepage)
- section.build_image_one
- section.image_one.attachment.attach(io: file, filename: 't-shirt.png')
- section
- end
- let(:file) { File.open(file_fixture('icon_256x256.jpg')) }
-
- it_behaves_like 'returns proper hash'
- end
-
- context 'cms_product_carousel_section' do
- let(:homepage) { create(:cms_homepage) }
- let(:cms_section) { create(:cms_product_carousel_section, name: 'Test', linked_resource_type: 'Spree::Taxon', cms_page: homepage) }
-
- it_behaves_like 'returns proper hash'
- end
-
- context 'cms_rich_text_content_section' do
- let(:homepage) { create(:cms_homepage) }
- let(:cms_section) { create(:cms_rich_text_content_section, cms_page: homepage) }
-
- it_behaves_like 'returns proper hash'
- end
-end
diff --git a/api/spec/serializers/spree/v2/storefront/icon_serializer_spec.rb b/api/spec/serializers/spree/v2/storefront/icon_serializer_spec.rb
deleted file mode 100644
index fc546f07a4..0000000000
--- a/api/spec/serializers/spree/v2/storefront/icon_serializer_spec.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require 'spec_helper'
-
-describe Spree::V2::Storefront::IconSerializer do
- subject { described_class.new(icon) }
-
- let(:menu) { create(:menu) }
- let(:menu_item) { create(:menu_item, menu: menu) }
- let(:icon) { create(:icon, viewable: menu_item) }
-
- it { expect(subject.serializable_hash).to be_kind_of(Hash) }
-
- it do
- expect(subject.serializable_hash).to eq(
- {
- data: {
- id: icon.id.to_s,
- type: :icon,
- attributes: {
- url: Rails.application.routes.url_helpers.polymorphic_url(icon.attachment, only_path: true)
- }
- }
- }
- )
- end
-
- it { expect(subject.serializable_hash[:data][:id]).to be_kind_of(String) }
- it { expect(subject.serializable_hash[:data][:type]).to be(:icon) }
- it { expect(subject.serializable_hash[:data][:attributes][:url]).to include('thinking-cat.jpg') }
-end
diff --git a/api/spec/serializers/spree/v2/storefront/menu_item_serializer_spec.rb b/api/spec/serializers/spree/v2/storefront/menu_item_serializer_spec.rb
deleted file mode 100644
index bf7b8087ba..0000000000
--- a/api/spec/serializers/spree/v2/storefront/menu_item_serializer_spec.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-require 'spec_helper'
-
-describe Spree::V2::Storefront::MenuItemSerializer do
- subject { described_class.new(menu_item) }
-
- let(:menu) { create(:menu) }
- let(:menu_item) { create(:menu_item, menu: menu, linked_resource: create(:taxon)) }
- let!(:children) { create(:menu_item, parent_id: menu_item.id, menu: menu) }
-
- it { expect(subject.serializable_hash).to be_kind_of(Hash) }
-
- it do
- expect(subject.serializable_hash).to eq(
- {
- data: {
- id: menu_item.id.to_s,
- type: :menu_item,
- attributes: {
- code: menu_item.code,
- name: menu_item.name,
- subtitle: menu_item.subtitle,
- link: menu_item.link,
- new_window: menu_item.new_window,
- lft: menu_item.lft,
- rgt: menu_item.rgt,
- depth: menu_item.depth,
- is_container: false,
- is_root: false,
- is_child: true,
- destination: menu_item.destination,
- is_leaf: true,
- item_type: menu_item.item_type
- },
- relationships: {
- icon: {
- data: {
- id: menu_item.icon.id.to_s,
- type: :icon
- }
- },
- menu: {
- data: {
- id: menu_item.menu.id.to_s,
- type: :menu
- }
- },
- parent: {
- data: {
- id: menu_item.menu.root.id.to_s,
- type: :menu_item
- }
- },
- linked_resource: {
- data: {
- id: menu_item.linked_resource.id.to_s,
- type: :taxon
- }
- },
- children: {
- data: [
- {
- id: menu_item.children.first.id.to_s,
- type: :menu_item
- }
- ]
- }
- }
- }
- }
- )
- end
-end
diff --git a/api/spec/serializers/spree/v2/storefront/menu_serializer_spec.rb b/api/spec/serializers/spree/v2/storefront/menu_serializer_spec.rb
deleted file mode 100644
index 763d8b561e..0000000000
--- a/api/spec/serializers/spree/v2/storefront/menu_serializer_spec.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-require 'spec_helper'
-
-describe Spree::V2::Storefront::MenuSerializer do
- subject { described_class.new(menu) }
-
- let(:menu) { create(:menu) }
-
- it { expect(subject.serializable_hash).to be_kind_of(Hash) }
-
- it do
- expect(subject.serializable_hash).to eq(
- {
- data: {
- id: menu.id.to_s,
- type: :menu,
- attributes: {
- name: menu.name,
- location: menu.location,
- locale: menu.locale
- },
- relationships: {
- menu_items: {
- data: [
- {
- id: menu.menu_items.first.id.to_s,
- type: :menu_item
- }
- ]
- }
- }
- }
- }
- )
- end
-end
diff --git a/api/spec/swagger_helper.rb b/api/spec/swagger_helper.rb
index 17b06c3752..f02331b07c 100644
--- a/api/spec/swagger_helper.rb
+++ b/api/spec/swagger_helper.rb
@@ -44,13 +44,9 @@ RSpec.configure do |config|
{ name: 'Adjustments' },
{ name: 'Classifications' },
{ name: 'Countries' },
- { name: 'CMS Pages' },
- { name: 'CMS Sections' },
{ name: 'Digital Assets' },
{ name: 'Digital Links' },
{ name: 'Line Items' },
- { name: 'Menus' },
- { name: 'Menu Items' },
{ name: 'Option Types' },
{ name: 'Option Values' },
{ name: 'Orders' },
@@ -233,428 +229,6 @@ RSpec.configure do |config|
'x-internal': false
},
- # CMS Page
- create_standard_cms_page_params: {
- type: :object,
- properties: {
- cms_page: {
- type: :object,
- required: %w[title locale type],
- properties: {
- title: { type: :string, example: 'About Us', description: 'Give your page a title.' },
- type: { type: :string, enum: ['Spree::Cms::Pages::StandardPage'], description: 'Set the type of page.' },
- meta_title: { type: :string, nullable: true, example: 'Learn More About Super-Shop', description: 'Set the meta title for this page, this appears in the title bar of the browser.' },
- content: { type: :string, nullable: true, example: "Lot's of text..", description: 'The text content of a standard page, this can be HTML from a rich text editor.' },
- meta_description: { type: :string, nullable: true, example: 'Learn more about us on this page here...', description: 'Set a meta description, used for SEO and displayed in search results.' },
- visible: { type: :boolean, enum: [true, false], description: 'This page is publicly visible when set to `true`.' },
- slug: { type: :string, nullable: true, example: 'about-us', description: 'Set a slug for this page.' },
- locale: { type: :string, example: 'en-US', description: 'The language this page is written in.' }
- }
- }
- },
- required: %w[cms_page],
- title: 'Create a Standard Page',
- 'x-internal': false
- },
- create_homepage_cms_page_params: {
- type: :object,
- properties: {
- cms_page: {
- type: :object,
- required: %w[title locale type],
- properties: {
- title: { type: :string, example: 'Our Flash Homepage', description: 'Give your page a title.' },
- type: { type: :string, enum: ['Spree::Cms::Pages::Homepage'], description: 'Set the type of page.' },
- meta_title: { type: :string, nullable: true, example: 'Visit Our Store - Great Deals', description: 'Set the meta title for this page, this appears in the title bar of the browser.' },
- meta_description: { type: :string, nullable: true, example: 'Discover great new products that we sell in this store...', description: 'Set a meta description, used for SEO and displayed in search results.' },
- visible: { type: :boolean, enum: [true, false], description: 'This page is publicly visible when set to `true`.' },
- locale: { type: :string, example: 'en-US', description: 'The language this page is written in.' }
- }
- }
- },
- required: %w[cms_page],
- title: 'Create a Homepage',
- 'x-internal': false
- },
- create_feature_cms_page_params: {
- type: :object,
- properties: {
- cms_page: {
- type: :object,
- required: %w[title locale type],
- properties: {
- title: { type: :string, example: 'Featured Product', description: 'Give your page a title.' },
- type: { type: :string, enum: ['Spree::Cms::Pages::FeaturePage'], description: 'Set the type of page.' },
- meta_title: { type: :string, nullable: true, example: 'Learn More About This Featured Product', description: 'Set the meta title for this page, this appears in the title bar of the browser.' },
- meta_description: { type: :string, nullable: true, example: 'Learn more about us this amazing product that we sell right here...', description: 'Set a meta description, used for SEO and displayed in search results.' },
- visible: { type: :boolean, enum: [true, false], description: 'This page is publicly visible when set to `true`.' },
- slug: { type: :string, nullable: true, example: 'about-us', description: 'Set a slug for this page.' },
- locale: { type: :string, example: 'en-US', description: 'The language this page is written in.' }
- }
- }
- },
- required: %w[cms_page],
- title: 'Create a Feature Page',
- 'x-internal': false
- },
- update_standard_cms_page_params: {
- type: :object,
- properties: {
- cms_page: {
- type: :object,
- properties: {
- title: { type: :string, example: 'About Us', description: 'Update the page title.' },
- type: { type: :string, enum: ['Spree::Cms::Pages::StandardPage', 'Spree::Cms::Pages::Homepage', 'Spree::Cms::Pages::FeaturePage'], description: 'Change the type of page.' },
- meta_title: { type: :string, nullable: true, example: 'Learn More About Super-Shop', description: 'Update the meta title for this page, this appears in the title bar of the browser.' },
- content: { type: :string, nullable: true, example: "Lot's of text..", description: 'Update the text content of a standard page, this can be HTML from a rich text editor.' },
- meta_description: { type: :string, nullable: true, example: 'Learn more about us on this page here...', description: 'Update the meta description, used for SEO and displayed in search results.' },
- visible: { type: :boolean, enum: [true, false], description: 'This page is publicly visible when set to `true`.' },
- slug: { type: :string, nullable: true, example: 'about-us', description: 'Update the slug for this page.' },
- locale: { type: :string, example: 'en-US', description: 'Update the language of this page.' }
- }
- }
- },
- required: %w[cms_page],
- title: 'Update a Standard Page',
- 'x-internal': false
- },
- update_homepage_cms_page_params: {
- type: :object,
- properties: {
- cms_page: {
- type: :object,
- properties: {
- title: { type: :string, example: 'Our Flash Homepage', description: 'Update the page title.' },
- type: { type: :string, enum: ['Spree::Cms::Pages::StandardPage', 'Spree::Cms::Pages::Homepage', 'Spree::Cms::Pages::FeaturePage'], description: 'Change the type of page.' },
- meta_title: { type: :string, nullable: true, example: 'Visit Our Store - Great Deals', description: 'Update the meta title for this page, this appears in the title bar of the browser.' },
- meta_description: { type: :string, nullable: true, example: 'Discover great new products that we sell in this store...', description: 'Update the meta description, used for SEO and displayed in search results.' },
- visible: { type: :boolean, enum: [true, false], description: 'This page is publicly visible when set to `true`.' },
- locale: { type: :string, example: 'en-US', description: 'Update the language of this page.' }
- }
- }
- },
- required: %w[cms_page],
- title: 'Update a Homepage',
- 'x-internal': false
- },
- update_feature_cms_page_params: {
- type: :object,
- properties: {
- cms_page: {
- type: :object,
- properties: {
- title: { type: :string, example: 'Featured Product', description: 'Update the page title.' },
- type: { type: :string, enum: ['Spree::Cms::Pages::StandardPage', 'Spree::Cms::Pages::Homepage', 'Spree::Cms::Pages::FeaturePage'], description: 'Change the type of page.' },
- meta_title: { type: :string, nullable: true, example: 'Learn More About This Featured Product', description: 'Update the meta title for this page, this appears in the title bar of the browser.' },
- meta_description: { type: :string, nullable: true, example: 'Learn more about us this amazing product that we sell right here...', description: 'Update the meta description, used for SEO and displayed in search results.' },
- visible: { type: :boolean, enum: [true, false], description: 'This page is publicly visible when set to `true`.' },
- slug: { type: :string, nullable: true, example: 'about-us', description: 'Update the slug for this page.' },
- locale: { type: :string, example: 'en-US', description: 'Update the language of this page.' }
- }
- }
- },
- required: %w[cms_page],
- title: 'Update a Feature Page',
- 'x-internal': false
- },
-
- # CMS Section
- create_hero_image_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- required: %w[name cms_page_id type],
- properties: {
- name: { type: :string, description: 'Give this section a name.' },
- cms_page_id: { type: :string, description: 'Set the `cms_page` ID that this section belongs to.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::HeroImage'], example: 'Spree::Cms::Sections::HeroImage', description: 'Set the section type.' },
- linked_resource_type: { type: :string, example: 'Spree::Taxon', nullable: true, enum: ['Spree::Taxon', 'Spree::Product', 'Spree::CmsPage'], description: 'Set the resource type that this section links to.' },
- linked_resource_id: { type: :string, example: '1', nullable: true, description: 'Set the ID of the resource that you would like this section to link to.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- gutters: { type: :string, example: 'No Gutters', enum: ['Gutters', 'No Gutters'], description: 'This value is used by front end developers for styling the section padding.' },
- button_text: { type: :string, example: 'Click Here', description: 'Set the text value of the button used in this section.' },
- title: { type: :string, example: 'Shop Today', description: 'Create a title for the Hero Section.' },
- 'cms_section[image_one]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Create a Hero Image Section',
- 'x-internal': false
- },
- create_product_carousel_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- required: %w[name cms_page_id type],
- properties: {
- name: { type: :string, description: 'Give this section a name.' },
- cms_page_id: { type: :string, description: 'Set the `cms_page` ID that this section belongs to.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::ProductCarousel'], example: 'Spree::Cms::Sections::ProductCarousel', description: 'Set the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- linked_resource_id: { type: :string, example: '1', nullable: true, description: 'Set the ID of the Taxon that you would like displayed as a Product Carousel.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Create a Product Carousel Section',
- 'x-internal': false
- },
- create_side_by_side_images_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- required: %w[name cms_page_id type],
- properties: {
- name: { type: :string, description: 'Give this section a name.' },
- cms_page_id: { type: :string, description: 'Set the `cms_page` ID that this section belongs to.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::SideBySideImages'], example: 'Spree::Cms::Sections::SideBySideImages', description: 'Set the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- link_type_one: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Set the resource type that image one links to.' },
- link_type_two: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Set the resource type that image two links to.' },
- link_one: { type: :string, example: 'men/shirts', nullable: true, description: 'Set the slug or path that image two links to.' },
- link_two: { type: :string, example: 'white-shirt', nullable: true, description: 'Set the slug or path that image two links to.' },
- title_one: { type: :string, example: "Shop Men's Shirts", nullable: true, description: 'Set the title used in image one.' },
- title_two: { type: :string, example: "Buy This Men's Shirt", nullable: true, description: 'Set the title used in image two.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- subtitle_one: { type: :string, example: 'Save 50% today', nullable: true, description: 'Set the subtitle used in image one.' },
- subtitle_two: { type: :string, example: 'Save 50% today', nullable: true, description: 'Set the subtitle used in image two.' },
- gutters: { type: :string, example: 'No Gutters', enum: ['Gutters', 'No Gutters'], description: 'This value is used by front end developers for styling the section padding.' },
- 'cms_section[image_one]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' },
- 'cms_section[image_two]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Create a Side-by-Side Image Section',
- 'x-internal': false
- },
- create_image_gallery_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- required: %w[name cms_page_id type],
- properties: {
- name: { type: :string, description: 'Give this section a name.' },
- cms_page_id: { type: :string, description: 'Set the `cms_page` ID that this section belongs to.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::ImageGallery'], example: 'Spree::Cms::Sections::ImageGallery', description: 'Set the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- link_type_one: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Set the resource type that image one links to.' },
- link_type_two: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Set the resource type that image two links to.' },
- link_type_three: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Set the resource type that image three links to.' },
- link_one: { type: :string, example: 'men/shirts', nullable: true, description: 'Set the slug or path that image two links to.' },
- link_two: { type: :string, example: 'white-shirt', nullable: true, description: 'Set the slug or path that image two links to.' },
- link_three: { type: :string, example: 'red-shirt', nullable: true, description: 'Set the slug or path that image three links to.' },
- title_one: { type: :string, example: "Shop Men's Shirts", nullable: true, description: 'Set the title used in image one.' },
- title_two: { type: :string, example: "Buy This Men's Shirt", nullable: true, description: 'Set the title used in image two.' },
- title_three: { type: :string, example: "Buy This Women's Skirt", nullable: true, description: 'Set the title used in image three.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- layout_style: { type: :string, example: 'Default', enum: ['Default', 'Reversed'], description: 'This value is used by front end developers for styling the order the images appear.' },
- display_labels: { type: :string, example: 'Show', enum: ['Show', 'Hide'], description: 'This value is used by front end developers for showing and hiding the label on the images.' },
- 'cms_section[image_one]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' },
- 'cms_section[image_two]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' },
- 'cms_section[image_three]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Create an Image Gallery Section',
- 'x-internal': false
- },
- create_featured_article_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- required: %w[name cms_page_id type],
- properties: {
- name: { type: :string, description: 'Give this section a name.' },
- cms_page_id: { type: :string, description: 'Set the `cms_page` ID that this section belongs to.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::FeaturedArticle'], example: 'Spree::Cms::Sections::FeaturedArticle', description: 'Set the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- linked_resource_type: { type: :string, example: 'Spree::Taxon', nullable: true, enum: ['Spree::Taxon', 'Spree::Product', 'Spree::CmsPage'], description: 'Set the resource type that this section links to.' },
- linked_resource_id: { type: :string, example: '1', nullable: true, description: 'Set the ID of the resource that you would like this section to link to.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- gutters: { type: :string, example: 'No Gutters', enum: ['Gutters', 'No Gutters'], description: 'This value is used by front end developers for styling the section padding.' },
- button_text: { type: :string, example: 'Click Here', description: 'Set the text value of the button used in this section.' },
- title: { type: :string, example: 'Shop Today', description: 'Create a title for the Section.' },
- subtitle: { type: :string, example: 'Save Big!', description: 'Create a subtitle for the Section.' },
- rte_content: { type: :string, example: 'Lots of text and content goes here.', description: 'Set the content, here, this can be rich text editor content.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Create a Featured Article Section',
- 'x-internal': false
- },
- create_rich_text_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- required: %w[name cms_page_id type],
- properties: {
- name: { type: :string, description: 'Give this section a name.' },
- cms_page_id: { type: :string, description: 'Set the `cms_page` ID that this section belongs to.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::RichTextContent'], example: 'Spree::Cms::Sections::RichTextContent', description: 'Set the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- rte_content: { type: :string, example: 'Lots of text and content goes here.', description: 'Set the content, here, this can be rich text editor content.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Create a Rich Text Section',
- 'x-internal': false
- },
- update_hero_image_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- properties: {
- name: { type: :string, description: 'Update this section name.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::HeroImage', 'Spree::Cms::Sections::FeaturedArticle', 'Spree::Cms::Sections::ProductCarousel', 'Spree::Cms::Sections::ImageGallery', 'Spree::Cms::Sections::SideBySideImages', 'Spree::Cms::Sections::RichTextContent'], example: 'Spree::Cms::Sections::ProductCarousel', description: 'Change the section type.' },
- linked_resource_type: { type: :string, example: 'Spree::Taxon', nullable: true, enum: ['Spree::Taxon', 'Spree::Product', 'Spree::CmsPage'], description: 'Update the resource type that this section links to.' },
- linked_resource_id: { type: :string, example: '1', nullable: true, description: 'Set the ID of the resource that you would like this section to link to.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- gutters: { type: :string, example: 'No Gutters', enum: ['Gutters', 'No Gutters'], description: 'This value is used by front end developers for styling the section padding.' },
- button_text: { type: :string, example: 'Click Here', description: 'Update the text value of the button used in this section.' },
- title: { type: :string, example: 'Shop Today', description: 'Update the title for this section.' },
- 'cms_section[image_one]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' }
-
- }
- }
- },
- required: %w[cms_section],
- title: 'Update a Hero Image Section',
- 'x-internal': false
- },
- update_product_carousel_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- properties: {
- name: { type: :string, description: 'Change this section name.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::HeroImage', 'Spree::Cms::Sections::FeaturedArticle', 'Spree::Cms::Sections::ProductCarousel', 'Spree::Cms::Sections::ImageGallery', 'Spree::Cms::Sections::SideBySideImages', 'Spree::Cms::Sections::RichTextContent'], example: 'Spree::Cms::Sections::ProductCarousel', description: 'Change the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- linked_resource_id: { type: :string, example: '1', nullable: true, description: 'Update the ID of the Taxon that you would like displayed as a Product Carousel.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Update a Product Carousel Section',
- 'x-internal': false
- },
- update_side_by_side_images_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- properties: {
- name: { type: :string, description: 'Update this section name.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::HeroImage', 'Spree::Cms::Sections::FeaturedArticle', 'Spree::Cms::Sections::ProductCarousel', 'Spree::Cms::Sections::ImageGallery', 'Spree::Cms::Sections::SideBySideImages', 'Spree::Cms::Sections::RichTextContent'], example: 'Spree::Cms::Sections::ProductCarousel', description: 'Change the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- link_type_one: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Update the resource type that image one links to.' },
- link_type_two: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Update the resource type that image two links to.' },
- link_one: { type: :string, example: 'men/shirts', nullable: true, description: 'Update the slug or path that image two links to.' },
- link_two: { type: :string, example: 'white-shirt', nullable: true, description: 'Update the slug or path that image two links to.' },
- title_one: { type: :string, example: "Shop Men's Shirts", nullable: true, description: 'Update the title used in image one.' },
- title_two: { type: :string, example: "Buy This Men's Shirt", nullable: true, description: 'Update the title used in image two.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- subtitle_one: { type: :string, example: 'Save 50% today', nullable: true, description: 'Update the subtitle used in image one.' },
- subtitle_two: { type: :string, example: 'Save 50% today', nullable: true, description: 'Update the subtitle used in image two.' },
- gutters: { type: :string, example: 'No Gutters', enum: ['Gutters', 'No Gutters'], description: 'This value is used by front end developers for styling the section padding.' },
- 'cms_section[image_one]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' },
- 'cms_section[image_two]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Update a Side-by-Side Image Section',
- 'x-internal': false
- },
- update_image_gallery_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- properties: {
- name: { type: :string, description: 'Update this section name.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::HeroImage', 'Spree::Cms::Sections::FeaturedArticle', 'Spree::Cms::Sections::ProductCarousel', 'Spree::Cms::Sections::ImageGallery', 'Spree::Cms::Sections::SideBySideImages', 'Spree::Cms::Sections::RichTextContent'], example: 'Spree::Cms::Sections::ProductCarousel', description: 'Change the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- link_type_one: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Update the resource type that image one links to.' },
- link_type_two: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Update the resource type that image two links to.' },
- link_type_three: { type: :string, example: 'Spree::Taxon', enum: ['Spree::Taxon', 'Spree::Product'], description: 'Update the resource type that image three links to.' },
- link_one: { type: :string, example: 'men/shirts', nullable: true, description: 'Update the slug or path that image two links to.' },
- link_two: { type: :string, example: 'white-shirt', nullable: true, description: 'Update the slug or path that image two links to.' },
- link_three: { type: :string, example: 'red-shirt', nullable: true, description: 'Update the slug or path that image three links to.' },
- title_one: { type: :string, example: "Shop Men's Shirts", nullable: true, description: 'Update the title used in image one.' },
- title_two: { type: :string, example: "Buy This Men's Shirt", nullable: true, description: 'Update the title used in image two.' },
- title_three: { type: :string, example: "Buy This Women's Skirt", nullable: true, description: 'Update the title used in image three.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- layout_style: { type: :string, example: 'Default', enum: ['Default', 'Reversed'], description: 'This value is used by front end developers for styling the order the images appear.' },
- display_labels: { type: :string, example: 'Show', enum: ['Show', 'Hide'], description: 'This value is used by front end developers for showing and hiding the label on the images.' },
- 'cms_section[image_one]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' },
- 'cms_section[image_two]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' },
- 'cms_section[image_three]': { type: :string, format: :binary, description: 'Use a `multipart/form-data` request to upload assets.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Update an Image Gallery Section',
- 'x-internal': false
- },
- update_featured_article_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- properties: {
- name: { type: :string, description: 'Update this section name.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::HeroImage', 'Spree::Cms::Sections::FeaturedArticle', 'Spree::Cms::Sections::ProductCarousel', 'Spree::Cms::Sections::ImageGallery', 'Spree::Cms::Sections::SideBySideImages', 'Spree::Cms::Sections::RichTextContent'], example: 'Spree::Cms::Sections::ProductCarousel', description: 'Change the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- linked_resource_type: { type: :string, example: 'Spree::Taxon', nullable: true, enum: ['Spree::Taxon', 'Spree::Product', 'Spree::CmsPage'], description: 'Set the resource type that this section links to.' },
- linked_resource_id: { type: :string, example: '1', nullable: true, description: 'Change the ID of the resource that you would like this section to link to.' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- gutters: { type: :string, example: 'No Gutters', enum: ['Gutters', 'No Gutters'], description: 'This value is used by front end developers for styling the section padding.' },
- button_text: { type: :string, example: 'Click Here', description: 'Update the text value of the button used in this section.' },
- title: { type: :string, example: 'Shop Today', description: 'Update the title for the Section.' },
- subtitle: { type: :string, example: 'Save Big!', description: 'Update the subtitle for the Section.' },
- rte_content: { type: :string, example: 'Lots of text and content goes here.', description: 'Update the content here, this can be rich text editor content.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Update a Featured Article Section',
- 'x-internal': false
- },
- update_rich_text_cms_section_params: {
- type: :object,
- properties: {
- cms_section: {
- type: :object,
- properties: {
- name: { type: :string, description: 'Update this section name.' },
- type: { type: :string, enum: ['Spree::Cms::Sections::HeroImage', 'Spree::Cms::Sections::FeaturedArticle', 'Spree::Cms::Sections::ProductCarousel', 'Spree::Cms::Sections::ImageGallery', 'Spree::Cms::Sections::SideBySideImages', 'Spree::Cms::Sections::RichTextContent'], example: 'Spree::Cms::Sections::ProductCarousel', description: 'Change the section type.' },
- position: { type: :integer, example: 2, description: 'Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: `1`)' },
- fit: { type: :string, example: 'Screen', enum: ['Screen', 'Container'], description: 'This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.' },
- rte_content: { type: :string, example: 'Lots of text and content goes here.', description: 'Update the content, here, this can be rich text editor content.' }
- }
- }
- },
- required: %w[cms_section],
- title: 'Update a Rich Text Section',
- 'x-internal': false
- },
-
# Digital
create_digital_params: {
type: :object,
@@ -743,102 +317,6 @@ RSpec.configure do |config|
'x-internal': false
},
- # Menu
- create_menu_params: {
- type: :object,
- properties: {
- menu: {
- type: :object,
- required: %w[name location locale],
- properties: {
- name: { type: :string, example: 'Main Menu', description: 'Give this Menu a name.' },
- location: { type: :string, enum: ['header', 'footer'], description: 'Set the location this menu appears in the website.' },
- locale: { type: :string, example: 'en-US', description: 'Set the language of this menu.' }
- }
- }
- },
- required: %w[menu],
- 'x-internal': false
- },
- update_menu_params: {
- type: :object,
- properties: {
- menu: {
- type: :object,
- properties: {
- name: { type: :string, example: 'Main Menu', description: 'Update this Menu name.' },
- location: { type: :string, enum: ['header', 'footer'], description: 'Update the location this menu appears in the website.' },
- locale: { type: :string, example: 'en-US', description: 'Change the language of this menu.' }
- }
- }
- },
- required: %w[menu],
- 'x-internal': false
- },
-
- # Menu Item
- create_menu_item_params: {
- type: :object,
- properties: {
- menu_item: {
- type: :object,
- required: %w[name menu_id],
- properties: {
- name: { type: :string, example: 'T-Shirts', description: 'The name of this Menu Item' },
- code: { type: :string, nullable: true, example: 'MEN-TS', description: 'Give this Menu Item a code to identify this Menu Item from others. This is especially useful when using Container type Menu Items to group items.' },
- subtitle: { type: :string, nullable: true, example: "Shop men's T-Shirts", description: 'Set an optional subtitle for the Menu Item, this is useful if your menu has promotional links that require more than just a link name.' },
- destination: { type: :string, nullable: true, example: 'https://getvendo.com', description: 'Used when the linked_resource_type is set to: URL' },
- menu_id: { type: :integer, example: 1, description: 'Specify the ID of the Menu this item belongs to.' },
- new_window: { type: :boolean, description: 'When set to `true` the link will be opened in a new tab or window.' },
- item_type: { type: :string, enum: ['Link', 'Container'], description: 'Links are standard links, where as Containers are used to group links.' },
- linked_resource_type: { type: :string, enum: ['URL', 'Spree::Taxon', 'Spree::Product', 'Spree::CmsPage'], description: 'Set the type of resource you want to link to, or set to: URL to use the destination field for an external link.' },
- linked_resource_id: { type: :integer, example: 1, nullable: true, description: 'The ID of the resource you are linking to.' }
- }
- }
- },
- required: %w[menu_item],
- title: 'Create a Menu Item',
- 'x-internal': false
- },
- update_menu_item_params: {
- type: :object,
- properties: {
- menu_item: {
- type: :object,
- properties: {
- name: { type: :string, example: 'T-Shirts', description: 'Update the name of this Menu Item' },
- code: { type: :string, nullable: true, example: 'MEN-TS', description: 'The Menu Item a code to identifies this Menu Item from others. This is especially useful when using Container type Menu Items to group items.' },
- subtitle: { type: :string, nullable: true, example: "Shop men's T-Shirts", description: 'Set an optional subtitle for the Menu Item, this is useful if your menu has promotional links that require more than just a link name.' },
- destination: { type: :string, nullable: true, example: 'https://getvendo.com', description: 'Used when the linked_resource_type is set to: URL' },
- menu_id: { type: :integer, example: 1, description: 'Specify the ID of the Menu this item belongs to.' },
- new_window: { type: :boolean, description: 'When set to `true` the link will be opened in a new tab or window.' },
- item_type: { type: :string, enum: ['Link', 'Container'], description: 'Links are standard links, where as Containers are used to group links.' },
- linked_resource_type: { type: :string, enum: ['URL', 'Spree::Taxon', 'Spree::Product', 'Spree::CmsPage'], description: 'Change the type of resource you want to link to, or set to: URL to use the destination field for an external link.' },
- linked_resource_id: { type: :integer, example: 1, nullable: true, description: 'The ID of the resource you are linking to.' }
- }
- }
- },
- required: %w[menu_item],
- title: 'Update a Menu Item',
- 'x-internal': false
- },
- menu_item_reposition: {
- type: :object,
- properties: {
- menu_item: {
- type: :object,
- required: %w[new_parent_id new_position_idx],
- properties: {
- new_parent_id: { type: :integer, example: 1, description: 'The ID of the new target parent Menu Item.' },
- new_position_idx: { type: :integer, example: 1, description: 'The new index position of the Menu Item within its parent' }
- }
- }
- },
- required: %w[menu_item],
- title: 'Reposition a Menu Item',
- 'x-internal': false
- },
-
# Option Type
create_option_type_params: {
type: :object,
diff --git a/core/app/finders/spree/cms_pages/find.rb b/core/app/finders/spree/cms_pages/find.rb
deleted file mode 100644
index 9446c0ea8a..0000000000
--- a/core/app/finders/spree/cms_pages/find.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-module Spree
- module CmsPages
- class Find < ::Spree::BaseFinder
- ALLOWED_KINDS = %w[standard home feature].freeze
-
- def initialize(scope:, params:)
- @scope = scope
- @title = params.dig(:filter, :title)
- @kind = params.dig(:filter, :type)
- end
-
- def execute
- pages = by_title(scope)
- pages = by_kind(pages)
-
- pages
- end
-
- private
-
- attr_reader :scope, :title, :kind
-
- def title_matcher
- Spree::CmsPage.arel_table[:title].matches("%#{title}%")
- end
-
- def by_title(pages)
- return pages if title.blank?
-
- pages.where(title_matcher)
- end
-
- def by_kind(pages)
- return pages if kind.blank?
- return pages if ALLOWED_KINDS.exclude?(kind)
-
- pages.send(kind)
- end
- end
- end
-end
diff --git a/core/app/finders/spree/menus/find.rb b/core/app/finders/spree/menus/find.rb
deleted file mode 100644
index cc8cc3a3c7..0000000000
--- a/core/app/finders/spree/menus/find.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module Spree
- module Menus
- class Find < ::Spree::BaseFinder
- def execute
- return scope.where(location: params[:filter]['location']) if params[:filter].present? && params[:filter]['location'].present?
-
- scope
- end
- end
- end
-end
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rb
index 439b249d50..ee1ef172bd 100644
--- a/core/app/helpers/spree/base_helper.rb
+++ b/core/app/helpers/spree/base_helper.rb
@@ -106,7 +106,7 @@ module Spree
description: [object.name, current_store.meta_description].reject(&:blank?).join(', '))
else
meta.reverse_merge!(keywords: (current_store.meta_keywords || current_store.seo_title),
- description: (current_store.homepage(I18n.locale)&.seo_meta_description || current_store.seo_meta_description))
+ description: (current_store.seo_meta_description))
end
end
meta
@@ -178,8 +178,6 @@ module Spree
"#{current_store.formatted_url + localize}/#{Spree::Config[:storefront_products_path]}/#{resource.slug}"
elsif resource.instance_of?(Spree::Taxon)
"#{current_store.formatted_url + localize}/#{Spree::Config[:storefront_taxons_path]}/#{resource.permalink}"
- elsif resource.instance_of?(Spree::Cms::Pages::FeaturePage) || resource.instance_of?(Spree::Cms::Pages::StandardPage)
- "#{current_store.formatted_url + localize}/#{Spree::Config[:storefront_pages_path]}/#{resource.slug}"
elsif localize.blank?
current_store.formatted_url
else
diff --git a/core/app/models/concerns/spree/display_link.rb b/core/app/models/concerns/spree/display_link.rb
deleted file mode 100644
index 838906e9d8..0000000000
--- a/core/app/models/concerns/spree/display_link.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-module Spree
- module DisplayLink
- extend ActiveSupport::Concern
-
- included do
- belongs_to :linked_resource, polymorphic: true
-
- def link
- case linked_resource_type
- when 'Spree::Taxon'
- return if linked_resource&.permalink.blank?
-
- "/#{Spree::Config[:storefront_taxons_path]}/#{linked_resource.permalink}"
- when 'Spree::Product'
- return if linked_resource&.slug.blank?
-
- "/#{Spree::Config[:storefront_products_path]}/#{linked_resource.slug}"
- when 'Spree::CmsPage'
- return if linked_resource&.slug.blank?
-
- "/#{Spree::Config[:storefront_pages_path]}/#{linked_resource.slug}"
- when 'Spree::Linkable::Homepage'
- '/'
- when 'Spree::Linkable::Uri'
- destination
- end
- end
- end
- end
-end
diff --git a/core/app/models/spree/ability.rb b/core/app/models/spree/ability.rb
index 7313e34ea5..1aaa2d66a0 100644
--- a/core/app/models/spree/ability.rb
+++ b/core/app/models/spree/ability.rb
@@ -62,8 +62,6 @@ module Spree
def apply_user_permissions(user)
can :read, ::Spree::Country
- can :read, ::Spree::Menu
- can :read, ::Spree::CmsPage
can :read, ::Spree::OptionType
can :read, ::Spree::OptionValue
can :create, ::Spree::Order
diff --git a/core/app/models/spree/cms/pages/feature_page.rb b/core/app/models/spree/cms/pages/feature_page.rb
deleted file mode 100644
index 4543c5ae06..0000000000
--- a/core/app/models/spree/cms/pages/feature_page.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module Spree::Cms::Pages
- class FeaturePage < Spree::CmsPage
- def sections?
- true
- end
- end
-end
diff --git a/core/app/models/spree/cms/pages/homepage.rb b/core/app/models/spree/cms/pages/homepage.rb
deleted file mode 100644
index 490ce88c02..0000000000
--- a/core/app/models/spree/cms/pages/homepage.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-module Spree::Cms::Pages
- class Homepage < Spree::CmsPage
- before_create :empty_slug
- after_save :empty_slug
-
- def sections?
- true
- end
-
- def seo_meta_description
- meta_description if meta_description.present?
- end
-
- private
-
- def empty_slug
- self.slug = nil
- end
- end
-end
diff --git a/core/app/models/spree/cms/pages/standard_page.rb b/core/app/models/spree/cms/pages/standard_page.rb
deleted file mode 100644
index d0f5b94053..0000000000
--- a/core/app/models/spree/cms/pages/standard_page.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module Spree::Cms::Pages
- class StandardPage < Spree::CmsPage
- end
-end
diff --git a/core/app/models/spree/cms/sections/featured_article.rb b/core/app/models/spree/cms/sections/featured_article.rb
deleted file mode 100644
index c1a18555bc..0000000000
--- a/core/app/models/spree/cms/sections/featured_article.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-module Spree::Cms::Sections
- class FeaturedArticle < Spree::CmsSection
- 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?
- gutters == 'Gutters'
- end
-
- private
-
- def default_values
- self.gutters ||= 'No Gutters'
- self.fit ||= 'Screen'
- self.linked_resource_type ||= 'Spree::Taxon'
- end
- end
-end
diff --git a/core/app/models/spree/cms/sections/hero_image.rb b/core/app/models/spree/cms/sections/hero_image.rb
deleted file mode 100644
index daf39e783b..0000000000
--- a/core/app/models/spree/cms/sections/hero_image.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-module Spree::Cms::Sections
- class HeroImage < Spree::CmsSection
- 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', 'Spree::CmsPage']
-
- def gutters?
- gutters == 'Gutters'
- end
-
- def img_one_sm(dimensions = '600x250>')
- super
- end
-
- def img_one_md(dimensions = '1200x500>')
- super
- end
-
- def img_one_lg(dimensions = '2400x1000>')
- super
- end
-
- def img_one_xl(dimensions = '4800x2000>')
- super
- end
-
- private
-
- def default_values
- self.gutters ||= 'No Gutters'
- self.fit ||= 'Screen'
- self.linked_resource_type ||= 'Spree::Taxon'
- end
- end
-end
diff --git a/core/app/models/spree/cms/sections/image_gallery.rb b/core/app/models/spree/cms/sections/image_gallery.rb
deleted file mode 100644
index 6d5fc978c6..0000000000
--- a/core/app/models/spree/cms/sections/image_gallery.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-module Spree::Cms::Sections
- class ImageGallery < Spree::CmsSection
- after_initialize :default_values
- validate :reset_multiple_link_attributes
-
- LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product'].freeze
-
- LAYOUT_OPTIONS = ['Default', 'Reversed'].freeze
- LABEL_OPTIONS = ['Show', 'Hide'].freeze
-
- store :content, accessors: [:link_type_one, :link_one, :title_one,
- :link_type_two, :link_two, :title_two,
- :link_type_three, :link_three, :title_three], coder: JSON
-
- store :settings, accessors: [:layout_style, :display_labels], coder: JSON
-
- #
- # img_one sizing
- def img_one_md(dimensions = '270x195>')
- super
- end
-
- def img_one_lg(dimensions = '540x390>')
- super
- end
-
- def img_one_xl(dimensions = '1080x780>')
- super
- end
-
- #
- # img_two sizing
- def img_two_md(dimensions = '270x400>')
- super
- end
-
- def img_two_lg(dimensions = '540x800>')
- super
- end
-
- def img_two_xl(dimensions = '1080x1600>')
- super
- end
-
- #
- # img_three sizing
- def img_three_md(dimensions = '270x195>')
- super
- end
-
- def img_three_lg(dimensions = '540x390>')
- super
- end
-
- def img_three_xl(dimensions = '1080x780>')
- super
- end
-
- def default_layout?
- layout_style == 'Default'
- end
-
- def show_labels?
- display_labels == 'Show'
- end
-
- private
-
- def reset_multiple_link_attributes
- if link_type_one_changed?
- return if link_type_one_was.nil?
-
- self.link_one = nil
- end
-
- if link_type_two_changed?
- return if link_type_two_was.nil?
-
- self.link_two = nil
- end
-
- if link_type_three_changed?
- return if link_type_three_was.nil?
-
- self.link_three = nil
- end
- end
-
- def default_values
- self.layout_style ||= 'Default'
- self.fit ||= 'Container'
- self.link_type_one ||= 'Spree::Taxon'
- self.link_type_two ||= 'Spree::Taxon'
- self.link_type_three ||= 'Spree::Taxon'
- end
- end
-end
diff --git a/core/app/models/spree/cms/sections/product_carousel.rb b/core/app/models/spree/cms/sections/product_carousel.rb
deleted file mode 100644
index 4f12945856..0000000000
--- a/core/app/models/spree/cms/sections/product_carousel.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Spree::Cms::Sections
- class ProductCarousel < Spree::CmsSection
- after_initialize :default_values
-
- LINKED_RESOURCE_TYPE = ['Spree::Taxon']
-
- private
-
- def default_values
- self.fit ||= 'Screen'
- self.linked_resource_type ||= 'Spree::Taxon'
- end
- end
-end
diff --git a/core/app/models/spree/cms/sections/rich_text_content.rb b/core/app/models/spree/cms/sections/rich_text_content.rb
deleted file mode 100644
index b5b1092120..0000000000
--- a/core/app/models/spree/cms/sections/rich_text_content.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module Spree::Cms::Sections
- class RichTextContent < Spree::CmsSection
- after_initialize :default_values
-
- store :content, accessors: [:rte_content], coder: JSON
-
- private
-
- def default_values
- self.fit ||= 'Container'
- end
- end
-end
diff --git a/core/app/models/spree/cms/sections/side_by_side_images.rb b/core/app/models/spree/cms/sections/side_by_side_images.rb
deleted file mode 100644
index 24119e3a68..0000000000
--- a/core/app/models/spree/cms/sections/side_by_side_images.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-module Spree::Cms::Sections
- class SideBySideImages < Spree::CmsSection
- after_initialize :default_values
- validate :reset_multiple_link_attributes
-
- LINKED_RESOURCE_TYPE = ['Spree::Taxon', 'Spree::Product'].freeze
-
- store :content, accessors: [:link_type_one, :link_one, :title_one, :subtitle_one,
- :link_type_two, :link_two, :title_two, :subtitle_two], coder: JSON
-
- store :settings, accessors: [:gutters], coder: JSON
-
- def gutters?
- gutters == 'Gutters'
- end
-
- #
- # img_one sizing
- def img_one_md(dimensions = '387x250>')
- super
- end
-
- def img_one_lg(dimensions = '540x390>')
- super
- end
-
- def img_one_xl(dimensions = '1468x952>')
- super
- end
-
- #
- # img_two sizing
- def img_two_md(dimensions = '387x250>')
- super
- end
-
- def img_two_lg(dimensions = '734x476>')
- super
- end
-
- def img_two_xl(dimensions = '1468x952>')
- super
- end
-
- private
-
- def reset_multiple_link_attributes
- if link_type_one_changed?
- return if link_type_one_was.nil?
-
- self.link_one = nil
- end
-
- if link_type_two_changed?
- return if link_type_two_was.nil?
-
- self.link_two = nil
- end
- end
-
- def default_values
- self.gutters ||= 'Gutters'
- self.fit ||= 'Container'
- self.link_type_one ||= 'Spree::Taxon'
- self.link_type_two ||= 'Spree::Taxon'
- end
- end
-end
diff --git a/core/app/models/spree/cms_page.rb b/core/app/models/spree/cms_page.rb
deleted file mode 100644
index 2022742641..0000000000
--- a/core/app/models/spree/cms_page.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-module Spree
- class CmsPage < Spree.base_class
- include Spree::SingleStoreResource
- include Spree::DisplayLink
-
- if defined?(Spree::Webhooks::HasWebhooks)
- include Spree::Webhooks::HasWebhooks
- end
-
- acts_as_paranoid
-
- TYPES = ['Spree::Cms::Pages::StandardPage',
- 'Spree::Cms::Pages::FeaturePage',
- 'Spree::Cms::Pages::Homepage']
-
- belongs_to :store, touch: true
-
- has_many :cms_sections, class_name: 'Spree::CmsSection'
- has_many :menu_items, as: :linked_resource
-
- before_validation :handle_slug
-
- validates :title, :store, :locale, :type, presence: true
- validates :slug, uniqueness: { scope: :store_id, allow_nil: true, case_sensitive: true }
- validates :locale, uniqueness: { scope: [:store, :type] }, if: :homepage?
-
- scope :visible, -> { where(visible: true) }
- scope :by_locale, ->(locale) { where(locale: locale) }
- scope :by_slug, ->(slug) { where(slug: slug) }
-
- scope :home, -> { where(type: 'Spree::Cms::Pages::Homepage') }
- scope :standard, -> { where(type: 'Spree::Cms::Pages::StandardPage') }
- scope :feature, -> { where(type: 'Spree::Cms::Pages::FeaturePage') }
-
- self.whitelisted_ransackable_attributes = %w[title type locale]
-
- def seo_title
- if meta_title.present?
- meta_title
- else
- title
- end
- end
-
- # Override this if your page type uses cms_sections
- def sections?
- false
- end
-
- def homepage?
- type == 'Spree::Cms::Pages::Homepage'
- end
-
- def draft_mode?
- !visible
- end
-
- private
-
- def handle_slug
- self.slug = if homepage?
- nil
- elsif slug.blank?
- title&.downcase&.to_url
- else
- slug&.downcase&.to_url
- end
- end
- end
-end
diff --git a/core/app/models/spree/cms_section.rb b/core/app/models/spree/cms_section.rb
deleted file mode 100644
index 62a627f991..0000000000
--- a/core/app/models/spree/cms_section.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-module Spree
- class CmsSection < Spree.base_class
- include Spree::DisplayLink
-
- acts_as_list scope: :cms_page
- belongs_to :cms_page, touch: true
-
- validate :reset_link_attributes
-
- has_one :image_one, class_name: 'Spree::CmsSectionImageOne', dependent: :destroy, as: :viewable
- accepts_nested_attributes_for :image_one, reject_if: :all_blank
-
- has_one :image_two, class_name: 'Spree::CmsSectionImageTwo', dependent: :destroy, as: :viewable
- accepts_nested_attributes_for :image_two, reject_if: :all_blank
-
- has_one :image_three, class_name: 'Spree::CmsSectionImageThree', dependent: :destroy, as: :viewable
- accepts_nested_attributes_for :image_three, reject_if: :all_blank
-
- Spree::CmsSectionImage::IMAGE_COUNT.each do |count|
- Spree::CmsSectionImage::IMAGE_SIZE.each do |size|
- define_method("img_#{count}_#{size}") do |dimensions = nil|
- image = send("image_#{count}")&.attachment
- return if !image&.attached? || dimensions.nil?
-
- image.variant(resize_to_limit: dimensions.split('x').map(&:to_i))
- end
- end
- end
-
- default_scope { order(position: :asc) }
-
- validates :name, :cms_page, :type, presence: true
-
- LINKED_RESOURCE_TYPE = []
-
- TYPES = ['Spree::Cms::Sections::HeroImage',
- 'Spree::Cms::Sections::FeaturedArticle',
- 'Spree::Cms::Sections::ProductCarousel',
- 'Spree::Cms::Sections::ImageGallery',
- 'Spree::Cms::Sections::SideBySideImages',
- 'Spree::Cms::Sections::RichTextContent']
-
- def boundaries
- ['Container', 'Screen']
- end
-
- def css_classes
- ['row', 'section-row'].compact
- end
-
- def gutters_sizes
- ['Gutters', 'No Gutters']
- end
-
- def fullscreen?
- fit == 'Screen'
- end
-
- private
-
- def reset_link_attributes
- if linked_resource_type_changed?
- return if linked_resource_id_was.nil?
-
- self.linked_resource_id = nil
- end
- end
- end
-end
diff --git a/core/app/models/spree/cms_section_image.rb b/core/app/models/spree/cms_section_image.rb
deleted file mode 100644
index c4e056e786..0000000000
--- a/core/app/models/spree/cms_section_image.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Spree
- class CmsSectionImage < Asset
- IMAGE_COUNT = ['one', 'two', 'three']
- IMAGE_TYPES = ['image/png', 'image/jpg', 'image/jpeg', 'image/gif'].freeze
- IMAGE_SIZE = ['sm', 'md', 'lg', 'xl']
-
- validates :attachment, attached: true, content_type: IMAGE_TYPES
- end
-end
diff --git a/core/app/models/spree/cms_section_image_one.rb b/core/app/models/spree/cms_section_image_one.rb
deleted file mode 100644
index 1c6250257d..0000000000
--- a/core/app/models/spree/cms_section_image_one.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module Spree
- class CmsSectionImageOne < CmsSectionImage
- end
-end
diff --git a/core/app/models/spree/cms_section_image_three.rb b/core/app/models/spree/cms_section_image_three.rb
deleted file mode 100644
index e2f68a1e20..0000000000
--- a/core/app/models/spree/cms_section_image_three.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module Spree
- class CmsSectionImageThree < CmsSectionImage
- end
-end
diff --git a/core/app/models/spree/cms_section_image_two.rb b/core/app/models/spree/cms_section_image_two.rb
deleted file mode 100644
index ae2bf16f82..0000000000
--- a/core/app/models/spree/cms_section_image_two.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module Spree
- class CmsSectionImageTwo < CmsSectionImage
- end
-end
diff --git a/core/app/models/spree/icon.rb b/core/app/models/spree/icon.rb
deleted file mode 100644
index abc28a97e8..0000000000
--- a/core/app/models/spree/icon.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module Spree
- class Icon < Spree::Asset
- ICON_TYPES = %i[png jpg jpeg gif svg]
-
- validates :attachment, attached: true, content_type: ICON_TYPES
- end
-end
diff --git a/core/app/models/spree/linkable/homepage.rb b/core/app/models/spree/linkable/homepage.rb
deleted file mode 100644
index 3124ed0485..0000000000
--- a/core/app/models/spree/linkable/homepage.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-module Spree::Linkable::Homepage
- # Placeholder for polymorphic lookup.
-end
diff --git a/core/app/models/spree/linkable/uri.rb b/core/app/models/spree/linkable/uri.rb
deleted file mode 100644
index a6b0990b18..0000000000
--- a/core/app/models/spree/linkable/uri.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-module Spree::Linkable::Uri
- # Placeholder for polymorphic lookup.
-end
diff --git a/core/app/models/spree/menu.rb b/core/app/models/spree/menu.rb
deleted file mode 100644
index dc6e03de90..0000000000
--- a/core/app/models/spree/menu.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-module Spree
- class Menu < Spree.base_class
- include Spree::SingleStoreResource
- if defined?(Spree::Webhooks::HasWebhooks)
- include Spree::Webhooks::HasWebhooks
- end
-
- MENU_LOCATIONS = ['Header', 'Footer']
- MENU_LOCATIONS_PARAMETERIZED = []
-
- MENU_LOCATIONS.each do |location|
- parameterize_location = location.parameterize(separator: '_')
- MENU_LOCATIONS_PARAMETERIZED << parameterize_location
- end
-
- has_many :menu_items, dependent: :destroy, class_name: 'Spree::MenuItem'
- belongs_to :store, touch: true, class_name: 'Spree::Store'
-
- before_validation :parameterize_location
- after_create :set_root
- after_save :update_root_name
- after_touch :touch_store
-
- validates :name, :store, :locale, presence: true
- validates :location, uniqueness: { scope: [:store, :locale] }
- validates :location, inclusion: { in: MENU_LOCATIONS_PARAMETERIZED }
-
- has_one :root, -> { where(parent_id: nil) }, class_name: 'Spree::MenuItem', dependent: :destroy
-
- default_scope { order(created_at: :asc) }
-
- scope :by_locale, ->(locale) { where(locale: locale) }
-
- self.whitelisted_ransackable_attributes = %w[name location locale store_id]
-
- MENU_LOCATIONS_PARAMETERIZED.each do |location_name|
- define_singleton_method("for_#{location_name}") do |locale|
- menu = find_by(location: location_name, locale: locale.to_s)
-
- menu.root if menu.present?
- end
- end
-
- private
-
- def parameterize_location
- return unless location.present?
-
- self.location = location.parameterize(separator: '_')
- end
-
- def set_root
- self.root ||= menu_items.create!(name: name, item_type: 'Container')
- end
-
- def update_root_name
- return unless saved_change_to_name?
-
- root.update(name: name)
- end
-
- def touch_store
- store.touch
- end
- end
-end
diff --git a/core/app/models/spree/menu_item.rb b/core/app/models/spree/menu_item.rb
deleted file mode 100644
index df293ed8a3..0000000000
--- a/core/app/models/spree/menu_item.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-module Spree
- class MenuItem < Spree.base_class
- include Spree::DisplayLink
- if defined?(Spree::Webhooks::HasWebhooks)
- include Spree::Webhooks::HasWebhooks
- end
-
- acts_as_nested_set dependent: :destroy
-
- ITEM_TYPE = %w[Link Container]
- LINKED_RESOURCE_TYPE = ['Spree::Linkable::Uri', 'Spree::Linkable::Homepage', 'Spree::Product', 'Spree::Taxon', 'Spree::CmsPage']
-
- belongs_to :menu, touch: true
-
- before_create :ensure_item_belongs_to_root
- before_update :reset_link_attributes
- before_save :paremeterize_code
-
- after_save :touch_ancestors_and_menu
- after_touch :touch_ancestors_and_menu
-
- validates :name, :menu, presence: true
- validates :item_type, inclusion: { in: ITEM_TYPE }
- validates :linked_resource_type, inclusion: { in: LINKED_RESOURCE_TYPE }
-
- has_one :icon, as: :viewable, dependent: :destroy, class_name: 'Spree::Icon'
- accepts_nested_attributes_for :icon, reject_if: :all_blank
-
- def container?
- item_type == 'Container'
- end
-
- def code?(item_code = nil)
- if item_code
- code == item_code
- else
- code.present?
- end
- end
-
- private
-
- def reset_link_attributes
- if linked_resource_type_changed? || item_type == 'Container'
- self.linked_resource_id = nil
- self.destination = nil
- self.new_window = false
-
- self.linked_resource_type = 'Spree::Linkable::Uri' if item_type == 'Container'
- end
- end
-
- def ensure_item_belongs_to_root
- if menu.try(:root).present? && parent_id.nil?
- self.parent = menu.root
-
- store_new_parent
- end
- end
-
- def touch_ancestors_and_menu
- ancestors.update_all(updated_at: Time.current)
- menu.try!(:touch)
- end
-
- def paremeterize_code
- return if code.blank?
-
- self.code = code.parameterize
- end
- end
-end
diff --git a/core/app/models/spree/product.rb b/core/app/models/spree/product.rb
index 7cbf14d954..9d5f8498a7 100644
--- a/core/app/models/spree/product.rb
+++ b/core/app/models/spree/product.rb
@@ -88,8 +88,6 @@ module Spree
has_many :product_properties, dependent: :destroy, inverse_of: :product
has_many :properties, through: :product_properties
- has_many :menu_items, as: :linked_resource
-
has_many :classifications, -> { order(created_at: :asc) }, dependent: :delete_all, inverse_of: :product
has_many :taxons, through: :classifications, before_remove: :remove_taxon
has_many :taxonomies, through: :taxons
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index d6b0e21c07..748bb9b4af 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -68,12 +68,6 @@ module Spree
has_many :store_payment_methods, class_name: 'Spree::StorePaymentMethod'
has_many :payment_methods, through: :store_payment_methods, class_name: 'Spree::PaymentMethod'
- # FIXME: remove old CMS code
- has_many :cms_pages, class_name: 'Spree::CmsPage'
- has_many :cms_sections, through: :cms_pages, class_name: 'Spree::CmsSection'
- has_many :menus, class_name: 'Spree::Menu'
- has_many :menu_items, through: :menus, class_name: 'Spree::MenuItem'
-
has_many :store_products, class_name: 'Spree::StoreProduct'
has_many :products, through: :store_products, class_name: 'Spree::Product'
has_many :product_properties, through: :products, class_name: 'Spree::ProductProperty'
@@ -237,24 +231,12 @@ module Spree
end
end
- def default_menu(location)
- menu = menus.find_by(location: location, locale: default_locale) || menus.find_by(location: location)
-
- menu.root if menu.present?
- end
-
def supported_currencies_list
@supported_currencies_list ||= ([default_currency] + read_attribute(:supported_currencies).to_s.split(',')).uniq.map(&:to_s).map do |code|
::Money::Currency.find(code.strip)
end.compact.sort_by { |currency| currency.iso_code == default_currency ? 0 : 1 }
end
- def homepage(requested_locale)
- cms_pages.by_locale(requested_locale).find_by(type: 'Spree::Cms::Pages::Homepage') ||
- cms_pages.by_locale(default_locale).find_by(type: 'Spree::Cms::Pages::Homepage') ||
- cms_pages.find_by(type: 'Spree::Cms::Pages::Homepage')
- end
-
def seo_meta_description
if meta_description.present?
meta_description
diff --git a/core/app/models/spree/taxon.rb b/core/app/models/spree/taxon.rb
index f88f58803c..377d91111a 100644
--- a/core/app/models/spree/taxon.rb
+++ b/core/app/models/spree/taxon.rb
@@ -38,9 +38,6 @@ module Spree
has_many :products, through: :classifications
has_one :icon, as: :viewable, dependent: :destroy, class_name: 'Spree::TaxonImage' # TODO: remove this as this is deprecated
- has_many :menu_items, as: :linked_resource
- has_many :cms_sections, as: :linked_resource
-
has_many :prototype_taxons, class_name: 'Spree::PrototypeTaxon', dependent: :destroy
has_many :prototypes, through: :prototype_taxons, class_name: 'Spree::Prototype'
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index 578b86a02e..9b530ad385 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -1802,7 +1802,6 @@ en:
message: If you have received this email, then your email settings are correct.
subject: Test Mail
test_mode: Test Mode
- this_menu_already_has_a_root_item: This Menu already has a root item
thank_you_for_your_order: Thank you for your business. Please print out a copy of this confirmation page for your records.
there_are_no_items_for_this_order: There are no items for this order. Please add an item to the order to continue.
there_were_problems_with_the_following_fields: There were problems with the following fields
diff --git a/core/db/migrate/20210914000000_spree_four_three.rb b/core/db/migrate/20210914000000_spree_four_three.rb
index ef2c81d5dd..af49f78300 100644
--- a/core/db/migrate/20210914000000_spree_four_three.rb
+++ b/core/db/migrate/20210914000000_spree_four_three.rb
@@ -97,47 +97,6 @@ class SpreeFourThree < ActiveRecord::Migration[5.2]
t.index ["id", "type"], name: "index_spree_calculators_on_id_and_type"
end
- create_table "spree_cms_pages", force: :cascade do |t|
- t.string "title", null: false
- t.string "meta_title"
- t.text "content"
- t.text "meta_description"
- t.boolean "visible", default: true
- t.string "slug"
- t.string "type"
- t.string "locale"
- t.datetime "deleted_at"
- t.bigint "store_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["deleted_at"], name: "index_spree_cms_pages_on_deleted_at"
- t.index ["slug", "store_id", "deleted_at"], name: "index_spree_cms_pages_on_slug_and_store_id_and_deleted_at"
- t.index ["slug", "store_id"], name: "index_spree_cms_pages_on_slug_and_store_id", unique: true
- t.index ["store_id", "locale", "type"], name: "index_spree_cms_pages_on_store_id_and_locale_and_type"
- t.index ["store_id"], name: "index_spree_cms_pages_on_store_id"
- t.index ["title", "type", "store_id"], name: "index_spree_cms_pages_on_title_and_type_and_store_id"
- t.index ["visible"], name: "index_spree_cms_pages_on_visible"
- end
-
- create_table "spree_cms_sections", force: :cascade do |t|
- t.string "name", null: false
- t.text "content"
- t.text "settings"
- t.string "fit"
- t.string "destination"
- t.string "type"
- t.integer "position"
- t.string "linked_resource_type"
- t.bigint "linked_resource_id"
- t.bigint "cms_page_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["cms_page_id"], name: "index_spree_cms_sections_on_cms_page_id"
- t.index ["linked_resource_type", "linked_resource_id"], name: "index_spree_cms_sections_on_linked_resource"
- t.index ["position"], name: "index_spree_cms_sections_on_position"
- t.index ["type"], name: "index_spree_cms_sections_on_type"
- end
-
create_table "spree_countries", force: :cascade do |t|
t.string "iso_name"
t.string "iso", null: false
@@ -250,44 +209,6 @@ class SpreeFourThree < ActiveRecord::Migration[5.2]
t.index ["source_id", "source_type"], name: "index_spree_log_entries_on_source_id_and_source_type"
end
- create_table "spree_menu_items", force: :cascade do |t|
- t.string "name", null: false
- t.string "subtitle"
- t.string "destination"
- t.boolean "new_window", default: false
- t.string "item_type"
- t.string "linked_resource_type", default: "URL"
- t.bigint "linked_resource_id"
- t.string "code"
- t.bigint "parent_id"
- t.bigint "lft", null: false
- t.bigint "rgt", null: false
- t.integer "depth", default: 0, null: false
- t.bigint "menu_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["code"], name: "index_spree_menu_items_on_code"
- t.index ["depth"], name: "index_spree_menu_items_on_depth"
- t.index ["item_type"], name: "index_spree_menu_items_on_item_type"
- t.index ["lft"], name: "index_spree_menu_items_on_lft"
- t.index ["linked_resource_type", "linked_resource_id"], name: "index_spree_menu_items_on_linked_resource"
- t.index ["menu_id"], name: "index_spree_menu_items_on_menu_id"
- t.index ["parent_id"], name: "index_spree_menu_items_on_parent_id"
- t.index ["rgt"], name: "index_spree_menu_items_on_rgt"
- end
-
- create_table "spree_menus", force: :cascade do |t|
- t.string "name"
- t.string "location"
- t.string "locale"
- t.bigint "store_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["locale"], name: "index_spree_menus_on_locale"
- t.index ["store_id", "location", "locale"], name: "index_spree_menus_on_store_id_and_location_and_locale", unique: true
- t.index ["store_id"], name: "index_spree_menus_on_store_id"
- end
-
create_table "spree_option_type_prototypes", force: :cascade do |t|
t.bigint "prototype_id"
t.bigint "option_type_id"
diff --git a/core/db/migrate/20211201202851_update_linkable_resource_types.rb b/core/db/migrate/20211201202851_update_linkable_resource_types.rb
deleted file mode 100644
index ab15ab8c1b..0000000000
--- a/core/db/migrate/20211201202851_update_linkable_resource_types.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class UpdateLinkableResourceTypes < ActiveRecord::Migration[5.2]
- def change
- change_column_default :spree_menu_items, :linked_resource_type, 'Spree::Linkable::Uri'
-
- Spree::MenuItem.where(linked_resource_type: 'URL').update_all(linked_resource_type: 'Spree::Linkable::Uri')
- Spree::CmsSection.where(linked_resource_type: 'URL').update_all(linked_resource_type: 'Spree::Linkable::Uri')
- Spree::MenuItem.where(linked_resource_type: 'Home Page').update_all(linked_resource_type: 'Spree::Linkable::Homepage')
- Spree::CmsSection.where(linked_resource_type: 'Home Page').update_all(linked_resource_type: 'Spree::Linkable::Homepage')
- end
-end
diff --git a/core/db/migrate/20220329113557_fix_cms_pages_unique_indexes.rb b/core/db/migrate/20220329113557_fix_cms_pages_unique_indexes.rb
deleted file mode 100644
index 86607fbece..0000000000
--- a/core/db/migrate/20220329113557_fix_cms_pages_unique_indexes.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class FixCmsPagesUniqueIndexes < ActiveRecord::Migration[5.2]
- def change
- remove_index :spree_cms_pages, [:slug, :store_id, :deleted_at]
- remove_index :spree_cms_pages, [:slug, :store_id], unique: true
-
- add_index :spree_cms_pages, [:slug, :store_id, :deleted_at], unique: true
- end
-end
diff --git a/core/lib/spree/core/controller_helpers/store.rb b/core/lib/spree/core/controller_helpers/store.rb
index d5153c4aaf..ac0837d308 100644
--- a/core/lib/spree/core/controller_helpers/store.rb
+++ b/core/lib/spree/core/controller_helpers/store.rb
@@ -8,7 +8,6 @@ module Spree
if defined?(helper_method)
helper_method :current_store
helper_method :current_price_options
- helper_method :available_menus
end
end
@@ -16,10 +15,6 @@ module Spree
@current_store ||= current_store_finder.new(url: request.env['SERVER_NAME']).execute
end
- def available_menus
- @available_menus ||= current_store.menus
- end
-
def store_locale
current_store.default_locale
end
diff --git a/core/lib/spree/core/dependencies.rb b/core/lib/spree/core/dependencies.rb
index 9ca2594ad9..c1f94bda20 100644
--- a/core/lib/spree/core/dependencies.rb
+++ b/core/lib/spree/core/dependencies.rb
@@ -92,8 +92,8 @@ module Spree
# finders
address_finder: 'Spree::Addresses::Find',
country_finder: 'Spree::Countries::Find',
- cms_page_finder: 'Spree::CmsPages::Find',
- menu_finder: 'Spree::Menus::Find',
+ cms_page_finder: 'Spree::CmsPages::Find', # LEGACY
+ menu_finder: 'Spree::Menus::Find', # LEGACY
current_order_finder: 'Spree::Orders::FindCurrent',
current_store_finder: 'Spree::Stores::FindCurrent',
completed_order_finder: 'Spree::Orders::FindComplete',
diff --git a/core/lib/spree/testing_support/factories/cms_page_factory.rb b/core/lib/spree/testing_support/factories/cms_page_factory.rb
deleted file mode 100644
index dd9ce58436..0000000000
--- a/core/lib/spree/testing_support/factories/cms_page_factory.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-FactoryBot.define do
- factory :base_cms_page, class: Spree::CmsPage do
- title { generate(:random_string) }
- locale { 'en' }
-
- store
-
- factory :cms_homepage do
- type { 'Spree::Cms::Pages::Homepage' }
- end
-
- factory :cms_standard_page do
- type { 'Spree::Cms::Pages::StandardPage' }
- end
-
- factory :cms_feature_page do
- type { 'Spree::Cms::Pages::FeaturePage' }
- end
- end
-end
diff --git a/core/lib/spree/testing_support/factories/cms_section_factory.rb b/core/lib/spree/testing_support/factories/cms_section_factory.rb
deleted file mode 100644
index 0bcdaa970b..0000000000
--- a/core/lib/spree/testing_support/factories/cms_section_factory.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-FactoryBot.define do
- factory :base_cms_section, class: Spree::CmsSection do
- name { generate(:random_string) }
-
- association :cms_page, factory: :cms_feature_page
-
- factory :cms_hero_image_section do
- type { 'Spree::Cms::Sections::HeroImage' }
- end
-
- factory :cms_featured_article_section do
- type { 'Spree::Cms::Sections::FeaturedArticle' }
- end
-
- factory :cms_product_carousel_section do
- type { 'Spree::Cms::Sections::ProductCarousel' }
- end
-
- factory :cms_image_gallery_section do
- type { 'Spree::Cms::Sections::ImageGallery' }
- end
-
- factory :cms_side_by_side_images_section do
- type { 'Spree::Cms::Sections::SideBySideImages' }
- end
-
- factory :cms_rich_text_content_section do
- type { 'Spree::Cms::Sections::RichTextContent' }
- end
- end
-end
diff --git a/core/lib/spree/testing_support/factories/icon_factory.rb b/core/lib/spree/testing_support/factories/icon_factory.rb
deleted file mode 100644
index 6db61604d6..0000000000
--- a/core/lib/spree/testing_support/factories/icon_factory.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-FactoryBot.define do
- factory :icon, class: Spree::Icon do
- before(:create) do |icon|
- if icon.respond_to? :attachment
- icon.attachment.attach(io: File.new(Spree::Core::Engine.root + 'spec/fixtures' + 'thinking-cat.jpg'), filename: 'thinking-cat.jpg')
- end
- end
- end
-end
diff --git a/core/lib/spree/testing_support/factories/menu_factory.rb b/core/lib/spree/testing_support/factories/menu_factory.rb
deleted file mode 100644
index cf059c445a..0000000000
--- a/core/lib/spree/testing_support/factories/menu_factory.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-FactoryBot.define do
- factory :menu, class: Spree::Menu do
- name { generate(:random_string) }
- locale { 'en' }
- location { 'Header' }
-
- before(:create) do |menu|
- if menu.store.nil?
- default_store = Spree::Store.default.persisted? ? Spree::Store.default : nil
- store = default_store || create(:store)
-
- menu.store = store
- end
- end
- end
-end
diff --git a/core/lib/spree/testing_support/factories/menu_item_factory.rb b/core/lib/spree/testing_support/factories/menu_item_factory.rb
deleted file mode 100644
index c1297766fa..0000000000
--- a/core/lib/spree/testing_support/factories/menu_item_factory.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-FactoryBot.define do
- factory :menu_item, class: Spree::MenuItem do
- sequence(:name) { |n| "Link no. #{n} To Somewhere" }
- item_type { 'Link' }
- linked_resource_type { 'Spree::Linkable::Uri' }
-
- menu
- icon
- end
-end
diff --git a/core/spec/lib/spree/core/controller_helpers/store_spec.rb b/core/spec/lib/spree/core/controller_helpers/store_spec.rb
index 52b2c312e7..8178100058 100644
--- a/core/spec/lib/spree/core/controller_helpers/store_spec.rb
+++ b/core/spec/lib/spree/core/controller_helpers/store_spec.rb
@@ -91,7 +91,7 @@ describe Spree::Core::ControllerHelpers::Store, type: :controller do
before { allow(controller).to receive(:current_store).and_return(store) }
context 'when no store is present' do
- object = Spree::Menu.new
+ object = Spree::Taxonomy.new
it 'sets the current_store' do
controller.ensure_current_store(object)
@@ -101,7 +101,7 @@ describe Spree::Core::ControllerHelpers::Store, type: :controller do
end
context 'when an object already has a store assigned' do
- object = Spree::Menu.new
+ object = Spree::Taxonomy.new
it 'raises an exception' do
object.store = store_2
@@ -112,7 +112,7 @@ describe Spree::Core::ControllerHelpers::Store, type: :controller do
end
context 'when an object already has a store assigned and the same store is re-assigned' do
- object = Spree::Menu.new
+ object = Spree::Taxonomy.new
it 'no exception is raised' do
object.store = store
@@ -123,14 +123,6 @@ describe Spree::Core::ControllerHelpers::Store, type: :controller do
end
end
- context 'when an object that does not have store association is passed in' do
- object = Spree::CmsSection.new
-
- it 'returns nil' do
- expect(controller.ensure_current_store(object)).to be_nil
- end
- end
-
context 'when object is nil' do
before { allow(controller).to receive(:current_store).and_return(store) }
diff --git a/core/spec/models/spree/cms/sections/featured_article_spec.rb b/core/spec/models/spree/cms/sections/featured_article_spec.rb
deleted file mode 100644
index d428f5e2d4..0000000000
--- a/core/spec/models/spree/cms/sections/featured_article_spec.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Cms::Sections::FeaturedArticle, type: :model do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: nil, cms_page: homepage)).not_to be_valid
- end
-
- it 'validates presence of page' do
- expect(described_class.new(name: 'Got Name')).not_to be_valid
- end
-
- context 'when a new Featured Article section is created' do
- let!(:featured_article_section) { create(:cms_featured_article_section, cms_page: homepage) }
-
- it 'sets gutters to No Gutters' do
- section = Spree::CmsSection.find(featured_article_section.id)
-
- expect(section.settings[:gutters]).to eq('No Gutters')
- end
-
- it 'sets fit to Screen' do
- section = Spree::CmsSection.find(featured_article_section.id)
-
- expect(section.fit).to eq('Screen')
- end
-
- it 'sets linked_resource_type to Spree::Taxon' do
- section = Spree::CmsSection.find(featured_article_section.id)
-
- expect(section.linked_resource_type).to eq('Spree::Taxon')
- end
-
- it '#gutters? is false' do
- section = Spree::CmsSection.find(featured_article_section.id)
-
- expect(section.gutters?).to be false
- end
-
- it '#fullscreen? is true' do
- section = Spree::CmsSection.find(featured_article_section.id)
-
- expect(section.fullscreen?).to be true
- end
- end
-
- context 'when changing the link type' do
- let!(:featured_article_section) { create(:cms_featured_article_section, cms_page: homepage) }
-
- before do
- featured_article_section.update!(linked_resource_type: 'Spree::Product')
- end
-
- it 'resets the linked resource to nil' do
- section = Spree::CmsSection.find(featured_article_section.id)
-
- expect(section.linked_resource_id).to be nil
- end
- end
-end
diff --git a/core/spec/models/spree/cms/sections/hero_image_spec.rb b/core/spec/models/spree/cms/sections/hero_image_spec.rb
deleted file mode 100644
index cc97b74d88..0000000000
--- a/core/spec/models/spree/cms/sections/hero_image_spec.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Cms::Sections::HeroImage, type: :model do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: nil, cms_page: homepage)).not_to be_valid
- end
-
- it 'validates presence of page' do
- expect(described_class.new(name: 'Got Name')).not_to be_valid
- end
-
- context 'when a new Hero Image section is created' do
- let!(:hero_section) { create(:cms_hero_image_section, cms_page: homepage) }
-
- it 'sets gutters to No Gutters' do
- section = Spree::CmsSection.find(hero_section.id)
-
- expect(section.settings[:gutters]).to eq('No Gutters')
- end
-
- it 'sets fit to Screen' do
- section = Spree::CmsSection.find(hero_section.id)
-
- expect(section.fit).to eq('Screen')
- end
-
- it 'sets linked_resource_type to Spree::Taxon' do
- section = Spree::CmsSection.find(hero_section.id)
-
- expect(section.linked_resource_type).to eq('Spree::Taxon')
- end
-
- it '#gutters? is false' do
- section = Spree::CmsSection.find(hero_section.id)
-
- expect(section.gutters?).to be false
- end
-
- it '#fullscreen? is true' do
- section = Spree::CmsSection.find(hero_section.id)
-
- expect(section.fullscreen?).to be true
- end
- end
-
- context 'when changing the link type' do
- let!(:hero_section) { create(:cms_hero_image_section, cms_page: homepage) }
-
- before do
- hero_section.update!(linked_resource_type: 'Spree::Product')
- end
-
- it 'resets the linked resource to nil' do
- section = Spree::CmsSection.find(hero_section.id)
-
- expect(section.linked_resource_id).to be nil
- end
- end
-end
diff --git a/core/spec/models/spree/cms/sections/image_gallery_spec.rb b/core/spec/models/spree/cms/sections/image_gallery_spec.rb
deleted file mode 100644
index 840a00fc69..0000000000
--- a/core/spec/models/spree/cms/sections/image_gallery_spec.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Cms::Sections::ImageGallery, type: :model do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: nil, cms_page: homepage)).not_to be_valid
- end
-
- it 'validates presence of page' do
- expect(described_class.new(name: 'Got Name')).not_to be_valid
- end
-
- context 'when a new Image Gallery section is created' do
- let!(:image_gallery_section) { create(:cms_image_gallery_section, cms_page: homepage) }
-
- it 'sets layout_style to Default' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.settings[:layout_style]).to eq('Default')
- end
-
- it 'sets link_type_one to Spree::Taxon' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.content[:link_type_one]).to eq('Spree::Taxon')
- end
-
- it 'sets link_type_two to Spree::Taxon' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.content[:link_type_two]).to eq('Spree::Taxon')
- end
-
- it 'sets link_type_three to Spree::Taxon' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.content[:link_type_three]).to eq('Spree::Taxon')
- end
-
- it 'sets fit to Container' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.fit).to eq('Container')
- end
-
- it '#fullscreen? is true' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.fullscreen?).to be false
- end
-
- it '#default_layout? is true' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.default_layout?).to be true
- end
- end
-
- context 'when changing the link types for links one two and three' do
- let!(:image_gallery_section) { create(:cms_image_gallery_section, cms_page: homepage) }
-
- before do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- section.content[:link_type_one] = 'Spree::Product'
- section.content[:link_type_two] = 'Spree::Product'
- section.content[:link_type_three] = 'Spree::Product'
-
- section.content[:link_one] = 'Shirt 1'
- section.content[:link_two] = 'Shirt 2'
- section.content[:link_three] = 'Shirt 3'
-
- section.save!
- section.reload
- end
-
- it 'link_one, link_two and save the initial values' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- expect(section.link_one).to eql 'Shirt 1'
- expect(section.link_two).to eql 'Shirt 2'
- expect(section.link_three).to eql 'Shirt 3'
- end
-
- it 'link_one, link_two and link_three are reset to nil' do
- section = Spree::CmsSection.find(image_gallery_section.id)
-
- section.content[:link_type_one] = 'Spree::Taxon'
- section.content[:link_type_two] = 'Spree::Taxon'
- section.content[:link_type_three] = 'Spree::Taxon'
- section.save!
- section.reload
-
- expect(section.link_one).to be nil
- expect(section.link_two).to be nil
- expect(section.link_three).to be nil
- end
- end
-end
diff --git a/core/spec/models/spree/cms/sections/product_carousel_spec.rb b/core/spec/models/spree/cms/sections/product_carousel_spec.rb
deleted file mode 100644
index 72e9e0ece7..0000000000
--- a/core/spec/models/spree/cms/sections/product_carousel_spec.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Cms::Sections::ProductCarousel, type: :model do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: nil, cms_page: homepage)).not_to be_valid
- end
-
- it 'validates presence of page' do
- expect(described_class.new(name: 'Got Name')).not_to be_valid
- end
-
- context 'when a new Product Carousel section is created' do
- let!(:product_carousel_section) { create(:cms_product_carousel_section, cms_page: homepage) }
-
- it 'sets fit to Screen' do
- section = Spree::CmsSection.find(product_carousel_section.id)
-
- expect(section.fit).to eq('Screen')
- end
-
- it 'sets linked_resource_type to Spree::Taxon' do
- section = Spree::CmsSection.find(product_carousel_section.id)
-
- expect(section.linked_resource_type).to eq('Spree::Taxon')
- end
- end
-end
diff --git a/core/spec/models/spree/cms/sections/rich_text_content_spec.rb b/core/spec/models/spree/cms/sections/rich_text_content_spec.rb
deleted file mode 100644
index c0abd0f570..0000000000
--- a/core/spec/models/spree/cms/sections/rich_text_content_spec.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Cms::Sections::RichTextContent, type: :model do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: nil, cms_page: homepage)).not_to be_valid
- end
-
- it 'validates presence of page' do
- expect(described_class.new(name: 'Got Name')).not_to be_valid
- end
-
- context 'when a new Rich Text Content section is created' do
- let!(:rich_text_content_section) { create(:cms_rich_text_content_section, cms_page: homepage) }
-
- it 'sets fit to Screen' do
- section = Spree::CmsSection.find(rich_text_content_section.id)
-
- expect(section.fit).to eq('Container')
- end
- end
-end
diff --git a/core/spec/models/spree/cms/sections/side_by_side_images_spec.rb b/core/spec/models/spree/cms/sections/side_by_side_images_spec.rb
deleted file mode 100644
index b450f9b755..0000000000
--- a/core/spec/models/spree/cms/sections/side_by_side_images_spec.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Cms::Sections::SideBySideImages, type: :model do
- let!(:store) { Spree::Store.default }
- let!(:homepage) { create(:cms_homepage, store: store) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: nil, cms_page: homepage)).not_to be_valid
- end
-
- it 'validates presence of page' do
- expect(described_class.new(name: 'Got Name')).not_to be_valid
- end
-
- context 'when a new Image Gallery section is created' do
- let!(:side_by_side_images_section) { create(:cms_side_by_side_images_section, cms_page: homepage) }
-
- it 'sets link_type_one to Spree::Taxon' do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- expect(section.content[:link_type_one]).to eq('Spree::Taxon')
- end
-
- it 'sets link_type_two to Spree::Taxon' do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- expect(section.content[:link_type_two]).to eq('Spree::Taxon')
- end
-
- it 'sets fit to Container' do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- expect(section.fit).to eq('Container')
- end
-
- it '#fullscreen? is true' do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- expect(section.fullscreen?).to be false
- end
-
- it '#gutters? is true' do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- expect(section.gutters?).to be true
- end
- end
-
- context 'when changing the link types for links one and two' do
- let!(:side_by_side_images_section) { create(:cms_side_by_side_images_section, cms_page: homepage) }
-
- before do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- section.content[:link_type_one] = 'Spree::Product'
- section.content[:link_type_two] = 'Spree::Product'
-
- section.content[:link_one] = 'Shirt 1'
- section.content[:link_two] = 'Shirt 2'
-
- section.save!
- section.reload
- end
-
- it 'link_one and link_two save the values correctly' do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- expect(section.link_one).to eql 'Shirt 1'
- expect(section.link_two).to eql 'Shirt 2'
- end
-
- it 'link_one and link_two are reset to nil when type is changed' do
- section = Spree::CmsSection.find(side_by_side_images_section.id)
-
- section.content[:link_type_one] = 'Spree::Taxon'
- section.content[:link_type_two] = 'Spree::Taxon'
- section.save!
- section.reload
-
- expect(section.link_one).to be nil
- expect(section.link_two).to be nil
- end
- end
-end
diff --git a/core/spec/models/spree/cms_page_spec.rb b/core/spec/models/spree/cms_page_spec.rb
deleted file mode 100644
index d8466869cf..0000000000
--- a/core/spec/models/spree/cms_page_spec.rb
+++ /dev/null
@@ -1,163 +0,0 @@
-require 'spec_helper'
-
-describe Spree::CmsPage, type: :model do
- let!(:store_a) { create(:store) }
- let!(:store_b) { create(:store) }
-
- it 'validates presence of title' do
- expect(described_class.new(title: nil, store: store_a, locale: :en)).not_to be_valid
- end
-
- it 'validates presence of store' do
- expect(described_class.new(title: 'Got Name', store: nil, locale: :en)).not_to be_valid
- end
-
- it 'validates presence of locale' do
- expect(described_class.new(title: 'Got Name', store: store_a, locale: nil)).not_to be_valid
- end
-
- describe 'validates uniqueness of homepage by locale' do
- let!(:homepage) { create(:cms_homepage, store: store_a, locale: 'en') }
-
- it 'valid' do
- expect(described_class.new(title: 'Got Name', store: store_a, locale: 'en', type: 'Spree::Cms::Pages::Homepage')).not_to be_valid
- end
- end
-
- describe 'validates uniqueness of slug' do
- context 'valid' do
- let!(:page) { create(:cms_standard_page, store: store_a, slug: 'got-name', locale: 'en') }
-
- it 'valid' do
- expect(described_class.new(title: 'Another Name', store: store_a, locale: 'en', type: 'Spree::Cms::Pages::StandardPage')).to be_valid
- end
-
- it 'omits previously deleted page' do
- expect { page.destroy }.to change(page, :deleted_at).from(nil).to(Time)
- expect(described_class.new(title: 'Got Name', store: store_a, slug: 'got-name', locale: 'en', type: 'Spree::Cms::Pages::StandardPage')).to be_valid
- end
- end
-
- context 'invalid' do
- let!(:page) { create(:cms_standard_page, store: store_a, slug: 'got-name', locale: 'en') }
-
- it 'invalid' do
- expect(described_class.new(title: 'Got Name', store: store_a, slug: 'got-name', locale: 'en', type: 'Spree::Cms::Pages::StandardPage')).not_to be_valid
- end
- end
- end
-
- describe 'Spree::Cms::Pages::Homepage' do
- let(:homepage) { create(:cms_homepage, store: store_a, locale: 'en') }
-
- it 'has a type of Spree::Cms::Pages::Homepage' do
- expect(homepage.type).to eq('Spree::Cms::Pages::Homepage')
- end
-
- it 'has a slug with nil value' do
- expect(homepage.slug).to be nil
- end
-
- it 'returns true for a homepage?' do
- expect(homepage.homepage?).to be true
- end
-
- it 'returns true for sections?' do
- expect(described_class.find_by(id: homepage.id).sections?).to be true
- end
-
- it 'homepage is visible by default' do
- expect(homepage.visible?).to be true
- end
-
- it 'homepage is not in draft_mode by default' do
- expect(homepage.draft_mode?).to be false
- end
- end
-
- describe 'Spree::Cms::Pages::FeaturePage' do
- let(:feature_page) { create(:cms_feature_page, title: 'This New Product', store: store_a) }
-
- it 'has a type of Spree::Cms::Pages::FeaturePage' do
- expect(feature_page.type).to eq('Spree::Cms::Pages::FeaturePage')
- end
-
- it 'has a slug that is the title parameterized' do
- expect(feature_page.slug).to eql('this-new-product')
- end
-
- it 'returns false for homepage?' do
- expect(feature_page.homepage?).to be false
- end
-
- it 'returns true for sections?' do
- expect(described_class.find_by(id: feature_page.id).sections?).to be true
- end
-
- it 'feature_page is visible by default' do
- expect(feature_page.visible?).to be true
- end
-
- it 'feature_page is not in draft_mode by default' do
- expect(feature_page.draft_mode?).to be false
- end
- end
-
- describe 'Spree::Cms::Pages::StandardPage' do
- let(:standard_page) { create(:cms_standard_page, title: 'About Us', store: store_a) }
-
- it 'has a type of Spree::Cms::Pages::FeaturePage' do
- expect(standard_page.type).to eq('Spree::Cms::Pages::StandardPage')
- end
-
- it 'has a slug that is the title parameterized' do
- expect(standard_page.slug).to eql('about-us')
- end
-
- it 'returns false for homepage?' do
- expect(standard_page.homepage?).to be false
- end
-
- it 'returns true for sections?' do
- expect(described_class.find_by(id: standard_page.id).sections?).to be false
- end
-
- it 'standard_page is visible by default' do
- expect(standard_page.visible?).to be true
- end
-
- it 'standard_page is not in draft_mode by default' do
- expect(standard_page.draft_mode?).to be false
- end
- end
-
- describe '.by_locale' do
- let!(:homepage_en) { create(:cms_homepage, store: store_a, locale: 'en') }
- let!(:homepage_de) { create(:cms_homepage, store: store_a, locale: 'de') }
-
- it 'returns homepage for the requested locale' do
- result_de = described_class.find(homepage_de.id)
-
- expect(described_class.by_locale(:de)).to eq([result_de])
- end
- end
-
- describe '.by_slug' do
- let!(:standard_page_slug_a) { create(:cms_standard_page, store: store_a, title: 'Little Page') }
- let!(:standard_page_slug_b) { create(:cms_standard_page, store: store_a, title: 'Big Page') }
-
- it 'returns standard_page_slug_a for the requested locale' do
- result_slug_a = described_class.find(standard_page_slug_a.id)
-
- expect(described_class.by_slug('little-page')).to eq([result_slug_a])
- end
- end
-
- describe '#seo_title' do
- let!(:homepage_title) { create(:cms_homepage, store: store_a, title: 'This Is My Homepage Title') }
-
- it 'seo_title' do
- expect(homepage_title.seo_title).to eql(homepage_title.title)
- end
- end
-end
diff --git a/core/spec/models/spree/cms_section_spec.rb b/core/spec/models/spree/cms_section_spec.rb
deleted file mode 100644
index f574c1282f..0000000000
--- a/core/spec/models/spree/cms_section_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-require 'spec_helper'
-
-describe Spree::CmsSection, type: :model do
- let!(:store_a) { create(:store) }
- let!(:homepage) { create(:cms_homepage, store: store_a) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: nil, cms_page: homepage)).not_to be_valid
- end
-
- it 'validates presence of page' do
- expect(described_class.new(name: 'Got Name')).not_to be_valid
- end
-
- context 'uploading a png' do
- let!(:store_a) { create(:store) }
- let!(:homepage) { create(:cms_homepage, store: store_a) }
-
- let(:section) do
- section = build(:cms_hero_image_section, cms_page: homepage)
- section.build_image_one
- section.image_one.attachment.attach(io: file, filename: 't-shirt.png')
- section
- end
-
- let(:file) { File.open(file_fixture('icon_256x256.png')) }
-
- it 'is valid' do
- expect(section).to be_valid
- end
-
- it 'image is valid' do
- expect(section.image_one).to be_valid
- end
- end
-end
diff --git a/core/spec/models/spree/concerns/single_store_spec.rb b/core/spec/models/spree/concerns/single_store_spec.rb
deleted file mode 100644
index d0456fa3f7..0000000000
--- a/core/spec/models/spree/concerns/single_store_spec.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'spec_helper'
-
-module Spree
- describe Spree::SingleStoreResource do
- let(:store) { Spree::Store.default }
- let(:store_2) { create :store }
-
- describe '.ensure_store_association_is_not_changed' do
- let(:menu) { create :menu }
- let(:menu_b) { create :menu, location: 'footer' }
-
- it 'allows creation of a new instance, update the store then save without triggering validation error' do
- object = Spree::CmsPage.new(title: 'Got Name', locale: 'de', type: 'Spree::Cms::Pages::StandardPage')
- object.update(store: store)
-
- expect(object.save!).to be true
- end
-
- context 'when an attempt to change the associated store' do
- it 'raises an ActiveRecord::RecordInvalid' do
- expect { menu.update!(store: store_2) }.to raise_error(ActiveRecord::RecordInvalid)
- end
- end
-
- context 'when update is made and store is same as existing store' do
- it 'does not raise an error' do
- expect { menu.update!(name:'Jones', store: store) }.not_to raise_error
- end
- end
-
- context 'when destroy a an item with store association' do
- it 'validation does not raise an error' do
- expect { menu_b.reload }.not_to raise_error
-
- menu_b.destroy
-
- expect { menu_b.reload }.to raise_error(ActiveRecord::RecordNotFound)
- end
- end
- end
- end
-end
diff --git a/core/spec/models/spree/menu_item_spec.rb b/core/spec/models/spree/menu_item_spec.rb
deleted file mode 100644
index 8c994c337b..0000000000
--- a/core/spec/models/spree/menu_item_spec.rb
+++ /dev/null
@@ -1,201 +0,0 @@
-require 'spec_helper'
-
-describe Spree::MenuItem, type: :model do
- let!(:store) { create(:store, default_locale: 'en') }
- let!(:menu) { create(:menu, name: 'Main Menu', store: store) }
-
- describe 'validates name' do
- it 'returns presence error when no name is given' do
- expect(described_class.new(name: '', menu: menu, parent: menu.root, item_type: 'Link')).not_to be_valid
- end
- end
-
- describe 'validates menu_id presence and integer_only' do
- it 'returns error when no menu id is passed' do
- expect(described_class.new(name: 'Menu Item', item_type: 'Link', parent: menu.root)).not_to be_valid
- end
-
- it 'returns error when no menu id is not an integer' do
- expect(described_class.new(name: 'Menu Item', menu_id: 'string', item_type: 'Link', parent: menu.root)).not_to be_valid
- end
-
- it 'returns success when no menu id an integer' do
- expect(described_class.new(name: 'Menu Item', item_type: 'Link', menu: menu, parent: menu.root)).to be_valid
- end
- end
-
- describe 'validates item_type' do
- it 'returns error when the item_type is not in the list' do
- expect(described_class.new(name: 'Menu Item', menu: menu, item_type: 'Linkker', parent: menu.root)).not_to be_valid
- end
- end
-
- describe 'validates linked_resource_type' do
- it 'returns error when the linked_resource_type is not in the list' do
- expect(described_class.new(name: 'Menu Item', menu: menu, item_type: 'Link', linked_resource_type: 'Purple', parent: menu.root)).not_to be_valid
- end
- end
-
- describe '#container?' do
- let(:container_item){ create(:menu_item, name: 'Link 1', item_type: 'Container', menu: menu) }
- let(:link_item) { create(:menu_item, name: 'Home', item_type: 'Link', menu: menu) }
-
- it 'returns true when the menu item is of type container' do
- expect(container_item.container?).to be true
- end
-
- it 'returns false when the menu item is of type Link' do
- expect(link_item.container?).to be false
- end
- end
-
- describe '#code?' do
- let(:coded_item){ create(:menu_item, name: 'Link 1', item_type: 'Container', menu: menu, code: 'some-code') }
- let(:not_coded_item) { create(:menu_item, name: 'Home', item_type: 'Link', menu: menu) }
-
- it 'returns true when the menu item has a matching code' do
- expect(coded_item.code?('some-code')).to be true
- end
-
- it 'returns false when the menu item has a code but the code does not match' do
- expect(coded_item.code?('Some-code')).to be false
- end
-
- it 'returns false when the menu item has no code' do
- expect(not_coded_item.code?('some-code')).to be false
- end
-
- it 'returns true if no args are passed, and the item has a code' do
- expect(coded_item.code?).to be true
- end
-
- it 'returns false if no args are passed, and the item has no code' do
- expect(not_coded_item.code?).to be false
- end
- end
-
- describe '#reset_link_attributes from URL to Homepage' do
- let(:i_b) do
- create(:menu_item, name: 'Home', item_type: 'Link', menu: menu,
- parent: menu.root, linked_resource_type: 'Spree::Linkable::Uri', destination: 'http://somewhere.com', new_window: true, linked_resource_id: 5)
- end
-
- before do
- i_b.update!(linked_resource_type: 'Spree::Linkable::Homepage')
- end
-
- it 'sets destination to /' do
- expect(i_b.link).to eql('/')
- end
- end
-
- describe '#reset_link_attributes from Link to Container' do
- let(:i_c) do
- create(:menu_item, name: 'Home', item_type: 'Link', menu: menu,
- parent: menu.root, linked_resource_type: 'Spree::Linkable::Uri', destination: 'http://somewhere.com', new_window: true, linked_resource_id: 5)
- end
-
- before do
- i_c.update!(item_type: 'Container')
- end
-
- it 'sets resets the destination to nil' do
- expect(i_c.destination).to be nil
- end
- end
-
- describe '#link' do
- let(:product) { create(:product, stores: [store]) }
- let(:taxon) { create(:taxon) }
- let(:cms_page) { create(:cms_standard_page) }
- let(:cms_page_with_no_slug) { create(:cms_homepage) }
-
- let(:item_url) { create(:menu_item, name: 'URL To Random Site', item_type: 'Link', menu: menu, linked_resource_type: 'Spree::Linkable::Uri', destination: 'https://some-other-website.com') }
- let(:item_empty_url) { create(:menu_item, name: 'URL To Random Site', item_type: 'Link', menu: menu, linked_resource_type: 'Spree::Linkable::Uri', destination: nil) }
- let(:item_home) { create(:menu_item, name: 'Home', item_type: 'Link', menu: menu, linked_resource_type: 'Spree::Linkable::Homepage') }
- let(:item_product) { create(:menu_item, name: product.name, item_type: 'Link', menu: menu, linked_resource_type: 'Spree::Product') }
- let(:item_taxon) { create(:menu_item, name: taxon.name, item_type: 'Link', menu: menu, linked_resource_type: 'Spree::Taxon') }
- let(:item_cms_page) { create(:menu_item, name: cms_page.title, item_type: 'Link', menu: menu, linked_resource_type: 'Spree::CmsPage') }
- let(:item_cms_page_with_no_slug) { create(:menu_item, name: cms_page_with_no_slug.title, item_type: 'Link', menu: menu, linked_resource_type: 'Spree::CmsPage') }
-
- it 'returns correct taxon path' do
- item_taxon.update(linked_resource: taxon)
-
- expect(item_taxon.link).to eql "/t/#{taxon.permalink}"
- end
-
- it 'returns correct cms_standard_page path' do
- item_cms_page.update(linked_resource: cms_page)
-
- expect(item_cms_page.link).to eql "/pages/#{cms_page.slug}"
- end
-
- it 'returns nil if no slug is present' do
- item_cms_page_with_no_slug.update(linked_resource: cms_page_with_no_slug)
-
- expect(item_cms_page_with_no_slug.link).to be nil
- end
-
- it 'returns nil for destination when taxon is removed' do
- item_taxon.update(linked_resource: taxon)
- item_taxon.update(linked_resource_id: nil)
-
- expect(item_taxon.link).to be nil
- end
-
- it 'returns correct product path' do
- item_product.update(linked_resource: product)
-
- expect(item_product.link).to eql "/products/#{product.slug}"
- end
-
- it 'returns nil for destination when product is removed' do
- item_product.update(linked_resource: product)
- item_product.update(linked_resource_id: nil)
-
- expect(item_product.link).to be nil
- end
-
- it 'returns correct root path' do
- expect(item_home.link).to eq '/'
- end
-
- it 'returns correct URL path' do
- expect(item_url.link).to eql 'https://some-other-website.com'
- end
-
- it 'returns nil when URL is nil' do
- expect(item_empty_url.link).to be nil
- end
- end
-
- describe '#paremeterize_code' do
- let(:item) { create(:menu_item, name: 'URL', item_type: 'Link', menu: menu, parent: menu.root, linked_resource_type: 'Spree::Linkable::Uri', code: 'My Fantastic Code') }
-
- it 'paramatizes a code when one is given' do
- expect(item.code).to eql 'my-fantastic-code'
- end
- end
-
- describe '#ensure_item_belongs_to_root' do
- let(:item_x) { create(:menu_item, name: 'URL', item_type: 'Link', menu: menu, linked_resource_type: 'Spree::Linkable::Uri', code: 'My Fantastic Code') }
-
- it 'Sets new items parent_id to root.id' do
- expect(item_x.parent_id).to eql menu.root.id
- end
-
- it 'is not a root' do
- expect(item_x.root?).to be false
- end
-
- it 'is level 1' do
- expect(item_x.level).to be 1
- end
- end
-
- describe 'touch menu and store' do
- let(:menu_item) { build(:menu_item, menu: menu, icon: nil) }
-
- it { expect { menu_item.save! }.to change(store, :updated_at) }
- end
-end
diff --git a/core/spec/models/spree/menu_spec.rb b/core/spec/models/spree/menu_spec.rb
deleted file mode 100644
index 10e8856500..0000000000
--- a/core/spec/models/spree/menu_spec.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-require 'spec_helper'
-
-describe Spree::Menu, type: :model do
- it 'responds to for_header' do
- expect(described_class).to respond_to(:for_header)
- end
-
- it 'does not respond to for_some_other_location' do
- expect(described_class).not_to respond_to(:for_some_other_location)
- end
-
- describe '.for_store' do
- let!(:store) { Spree::Store.default }
- let!(:store_b) { create(:store) }
-
- let!(:menu_a) { create(:menu, store: store) }
- let!(:menu_b) { create(:menu, store: store_b) }
-
- it 'returns menus for the requested store' do
- expect(described_class.for_store(store)).to eq([menu_a])
- end
- end
-
- describe '.by_locale' do
- let!(:store_milti) { Spree::Store.default }
- let!(:menu_en) { create(:menu, store: store_milti, locale: 'en') }
- let!(:menu_fr) { create(:menu, store: store_milti, locale: 'fr') }
-
- it 'returns menus for the requested locale' do
- expect(described_class.by_locale('fr')).to eq([menu_fr])
- end
- end
-
- describe '#for_header' do
- let!(:fr_store) { create(:store, default_locale: 'fr', supported_locales: 'fr,en,de') }
- let!(:menu_en) { create(:menu, name: 'Main Menu EN', store: fr_store, locale: 'en') }
- let!(:menu_fr) { create(:menu, name: 'Main Menu FR', store: fr_store, locale: 'fr') }
-
- context 'when the I18n.locale is set to a none default language and a menu is available' do
- it 'returns a menu in the correct locale' do
- expect(described_class.for_header('en').name).to eql('Main Menu EN')
- end
- end
-
- context 'when the I18n.locale is set to a none default language and a menu is not available' do
- it 'returns a menu in the current stores default locale if one is available' do
- expect(described_class.for_header('de')).to be nil
- end
- end
-
- context 'when the I18n.locale is set to the default language and a menu is available' do
- it 'returns a the default menu' do
- expect(described_class.for_header('fr').name).to eql('Main Menu FR')
- end
- end
- end
-
- describe 'creating new menu' do
- let(:store_1) { Spree::Store.default }
- let(:store_2) { create(:store) }
- let(:store_3) { create(:store) }
- let!(:menu) { create(:menu, name: 'Footer Menu', location: 'Footer', store: store_1) }
-
- it 'validates presence of name' do
- expect(described_class.new(name: '', location: 'Header', store: store_3)).not_to be_valid
- end
-
- it 'validates presence of store' do
- expect(described_class.new(name: 'Got Name', location: 'Header', store_id: nil)).not_to be_valid
- end
-
- it 'validates presence of locale' do
- expect(described_class.new(name: 'No Locale For Me', location: 'Header', locale: nil, store: store_2)).not_to be_valid
- end
-
- it 'validates uniqueness of location within scope of language and store' do
- expect(described_class.new(name: 'BBB', location: 'Footer', locale: 'en', store: store_1)).not_to be_valid
- expect(described_class.new(name: 'BBB', location: 'Footer', locale: 'fr', store: store_1)).to be_valid
- expect(described_class.new(name: 'BBB', location: 'Header', locale: 'en', store: store_1)).to be_valid
- expect(described_class.new(name: 'BBB', location: 'Footer', locale: 'en', store: store_2)).to be_valid
- end
-
- it '.parameterize_location parametizes the location' do
- expect(menu.location).to eql('footer')
- end
-
- it '.set_root creates a new root item' do
- expect(menu.root.name).to eql('Footer Menu')
- expect(menu.root.root?).to be true
- expect(menu.root.item_type).to eql('Container')
- end
- end
-
- describe 'updating the menu name' do
- let(:store_a) { Spree::Store.default }
- let(:m_x) { create(:menu, name: 'Main Menu', location: 'Header', store: store_a) }
-
- before do
- m_x.update!(name: 'Super Menu')
- end
-
- it '.update_root_name sets the new root menu_item name' do
- expect(m_x.root.name).to eql('Super Menu')
- end
- end
-
- describe 'touch store' do
- let!(:store) { Spree::Store.default }
- let(:menu) { build(:menu, store: store) }
-
- it { expect { menu.save! }.to change(store, :updated_at) }
- end
-end
diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb
index 36074bdfce..e77eeb11f6 100644
--- a/core/spec/models/spree/store_spec.rb
+++ b/core/spec/models/spree/store_spec.rb
@@ -356,29 +356,6 @@ describe Spree::Store, type: :model do
it { expect(described_class.available_locales).to contain_exactly('en', 'de') }
end
- describe '.default_menu' do
- let!(:store_a) { create(:store, default_locale: 'en') }
- let!(:store_b) { create(:store, default_locale: 'en') }
-
- context 'when default menu is available' do
- let!(:menu_a) { create(:menu, store: store_a, locale: 'en') }
- let!(:menu_b) { create(:menu, store: store_a, locale: 'de') }
-
- it 'returns the default menu root' do
- expect(store_a.default_menu('header')).to eq(menu_a.root)
- end
- end
-
- context 'when default menu is not available' do
- let!(:menu_c) { create(:menu, store: store_b, locale: 'de') }
- let!(:menu_d) { create(:menu, store: store_b, locale: 'pl') }
-
- it 'returns the first created menu root' do
- expect(store_b.default_menu('header')).to eq(menu_c.root)
- end
- end
- end
-
shared_context 'with checkout zone set' do
let!(:country1) { create(:country) }
let!(:country2) { create(:country) }
diff --git a/docs/images/cms_navigation.png b/docs/images/cms_navigation.png
deleted file mode 100644
index 3febb0bdc2..0000000000
Binary files a/docs/images/cms_navigation.png and /dev/null differ
diff --git a/docs/images/cms_pages.png b/docs/images/cms_pages.png
deleted file mode 100644
index 0d4ed07a54..0000000000
Binary files a/docs/images/cms_pages.png and /dev/null differ