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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add flash error message if the menu_item move is not saved.
Matthew Kennedy7af8684b06fd
diff --git a/backend/app/assets/javascripts/spree/backend/navigation/menu.es6 b/backend/app/assets/javascripts/spree/backend/navigation/menu.es6index 98a5c58f4e..13db609b81 100644--- a/backend/app/assets/javascripts/spree/backend/navigation/menu.es6+++ b/backend/app/assets/javascripts/spree/backend/navigation/menu.es6@@ -43,9 +43,16 @@ function handleMenuItemMove(evt, successCallback) {body: JSON.stringify(data)}).then(response => {- console.log(response);+ if (response.ok !== true) {+ handleMenuItemMoveError(response)+ }}).catch(err => {console.error(err);});}++function handleMenuItemMoveError (response) {+ // eslint-disable-next-line no-undef+ show_flash('error', Spree.translations.move_could_not_be_saved)+}diff --git a/backend/app/views/spree/admin/shared/_translations.html.erb b/backend/app/views/spree/admin/shared/_translations.html.erbindex 5660015af2..54ccb87ad8 100644--- a/backend/app/views/spree/admin/shared/_translations.html.erb+++ b/backend/app/views/spree/admin/shared/_translations.html.erb@@ -18,6 +18,7 @@month_names: I18n.t(:month_names, scope: :date).instance_eval {|o|o.try(:reject, &:blank?) || o},more: Spree.t(:more),+ move_could_not_be_saved: Spree.t('admin.navigation.move_could_not_be_saved'),name: Spree.t(:name),new_taxon: Spree.t(:new_taxon),next: Spree.t(:next),diff --git a/backend/config/routes.rb b/backend/config/routes.rbindex 615897a1d4..1b7dc93147 100644--- a/backend/config/routes.rb+++ b/backend/config/routes.rb@@ -189,7 +189,7 @@ Spree::Core::Engine.add_routes doendresources :menus do- resources :menu_items+ resources :menu_items, except: :indexendenddiff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 82415a1c7c..91d55f116d 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -586,6 +586,7 @@ en:link_settings: Link Settingslink_to: Link Toimage_asset: Add a Promotion image or Link icon.+ move_could_not_be_saved: 'ERROR: This move could not be saved.'new_menu_item: New Menu Itemnew_menu: New Menunested_under: Nested under