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.

Clean up code.

Matthew Kennedyb2c8c4a994ad
diff --git a/api/app/helpers/spree/api/api_helpers.rb b/api/app/helpers/spree/api/api_helpers.rb
index a4c36836f4..c3d384ca62 100644
--- a/api/app/helpers/spree/api/api_helpers.rb
+++ b/api/app/helpers/spree/api/api_helpers.rb
@@ -10,7 +10,6 @@ module Spree
:order_attributes,
:line_item_attributes,
:option_type_attributes,
- :menu_attributes,
:payment_attributes,
:payment_method_attributes,
:shipment_attributes,
@@ -139,10 +138,6 @@ module Spree
:id, :month, :year, :cc_type, :last_digits, :name
]
- @@menu_attributes = [
- :location
- ]
-
@@user_attributes = [:id, :email, :created_at, :updated_at]
@@property_attributes = [:id, :name, :presentation]
diff --git a/api/config/routes.rb b/api/config/routes.rb
index 1795be6334..76a533abdd 100644
--- a/api/config/routes.rb
+++ b/api/config/routes.rb
@@ -165,7 +165,7 @@ Spree::Core::Engine.add_routes do
get '/stores/:code', to: 'stores#show', as: :store
resources :menus, only: %i[index]
- get '/menus/:location', to: 'menus#show', as: :menu
+ get '/menus/:unique_code', to: 'menus#show', as: :menu
resources :cms_pages, only: %i[index], path: '/pages'
get '/pages/:slug', to: 'cms_page#show', as: :page
diff --git a/backend/app/assets/javascripts/spree/backend.js b/backend/app/assets/javascripts/spree/backend.js
index bfb1d3d2b4..04f2af98f0 100644
--- a/backend/app/assets/javascripts/spree/backend.js
+++ b/backend/app/assets/javascripts/spree/backend.js
@@ -98,7 +98,7 @@ Spree.routes.option_types_api_v2 = Spree.pathFor('api/v2/platform/option_types')
Spree.routes.option_values_api_v2 = Spree.pathFor('api/v2/platform/option_values')
Spree.routes.pages_api_v2 = Spree.pathFor('api/v2/platform/cms_pages')
Spree.routes.products_api_v2 = Spree.pathFor('/api/v2/platform/products')
-Spree.routes.section_reposition_api_v2 = Spree.pathFor('/api/v2/platform/cms_sections')
+Spree.routes.sections_api_v2 = Spree.pathFor('/api/v2/platform/cms_sections')
Spree.routes.taxons_api_v2 = Spree.pathFor('/api/v2/platform/taxons')
Spree.routes.users_api_v2 = Spree.pathFor('api/v2/platform/users')
diff --git a/backend/app/assets/javascripts/spree/backend/cms/page.es6 b/backend/app/assets/javascripts/spree/backend/cms/page.es6
index 76f6792c99..3ea64b7df0 100644
--- a/backend/app/assets/javascripts/spree/backend/cms/page.es6
+++ b/backend/app/assets/javascripts/spree/backend/cms/page.es6
@@ -55,7 +55,7 @@ function handleSectionReposition(evt) {
new_position_idx: parseInt(evt.newIndex, 10)
}
- fetch(Spree.routes.section_reposition_api_v2 + '/reposition', {
+ fetch(Spree.routes.sections_api_v2 + '/reposition', {
method: 'PATCH',
headers: {
Authorization: 'Bearer ' + OAUTH_TOKEN,
diff --git a/backend/app/controllers/spree/admin/cms_pages_controller.rb b/backend/app/controllers/spree/admin/cms_pages_controller.rb
index adad3982c3..f723c2f7fe 100644
--- a/backend/app/controllers/spree/admin/cms_pages_controller.rb
+++ b/backend/app/controllers/spree/admin/cms_pages_controller.rb
@@ -1,7 +1,6 @@
module Spree
module Admin
class CmsPagesController < ResourceController
-
private
def location_after_save
diff --git a/core/app/finders/spree/menus/find.rb b/core/app/finders/spree/menus/find.rb
index d8f6ad61d4..2090312ea8 100644
--- a/core/app/finders/spree/menus/find.rb
+++ b/core/app/finders/spree/menus/find.rb
@@ -2,7 +2,7 @@ module Spree
module Menus
class Find < ::Spree::BaseFinder
def execute
- return scope.where(location: params[:filter]['location']) if params[:filter].present?
+ return scope.where(unique_code: params[:filter]['unique_code']) if params[:filter].present?
scope
end
diff --git a/core/app/models/spree/app_dependencies.rb b/core/app/models/spree/app_dependencies.rb
index 62a078b0dc..c20f2f7ff4 100644
--- a/core/app/models/spree/app_dependencies.rb
+++ b/core/app/models/spree/app_dependencies.rb
@@ -7,8 +7,7 @@ module Spree
:cart_create_service, :cart_add_item_service, :cart_remove_item_service,
:cart_remove_line_item_service, :cart_set_item_quantity_service, :cart_recalculate_service,
:cms_page_finder, :cart_update_service, :checkout_next_service, :checkout_advance_service, :checkout_update_service,
- :checkout_complete_service, :checkout_add_store_credit_service,
- :checkout_remove_store_credit_service, :checkout_get_shipping_rates_service,
+ :checkout_complete_service, :checkout_add_store_credit_service, :checkout_remove_store_credit_service, :checkout_get_shipping_rates_service,
:coupon_handler, :menu_finder, :country_finder, :current_order_finder, :credit_card_finder,
:completed_order_finder, :order_sorter, :cart_compare_line_items_service, :collection_paginator, :products_sorter,
:products_finder, :taxon_finder, :line_item_by_variant_finder, :cart_estimate_shipping_rates_service,
diff --git a/core/lib/spree/core/controller_helpers/store.rb b/core/lib/spree/core/controller_helpers/store.rb
index f99c24dba1..c3701c8067 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
helper_method :current_store
helper_method :current_price_options
helper_method :available_menus
- helper_method :available_pages
end
def current_store
@@ -19,10 +18,6 @@ module Spree
@available_menus ||= current_store.menus
end
- def available_pages
- @available_pages ||= current_store.cms_pages
- end
-
def store_locale
current_store.default_locale
end
diff --git a/core/lib/spree/permitted_attributes.rb b/core/lib/spree/permitted_attributes.rb
index a9d8ed0459..39248e2b4b 100644
--- a/core/lib/spree/permitted_attributes.rb
+++ b/core/lib/spree/permitted_attributes.rb
@@ -7,7 +7,6 @@ module Spree
:image_attributes,
:inventory_unit_attributes,
:line_item_attributes,
- :menu_attributes,
:option_type_attributes,
:option_value_attributes,
:payment_attributes,
@@ -48,8 +47,6 @@ module Spree
@@image_attributes = [:alt, :attachment, :position, :viewable_type, :viewable_id]
- @@menu_attributes = [:location]
-
@@inventory_unit_attributes = [:shipment, :shipment_id, :variant_id]
@@line_item_attributes = [:id, :variant_id, :quantity]