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
Tidy up and add set js vars for move.
Matthew Kennedy2ad848640cd2
diff --git a/backend/app/assets/javascripts/spree/backend/navigation/menu.es6 b/backend/app/assets/javascripts/spree/backend/navigation/menu.es6index 12d41b30bc..6d5a28304f 100644--- a/backend/app/assets/javascripts/spree/backend/navigation/menu.es6+++ b/backend/app/assets/javascripts/spree/backend/navigation/menu.es6@@ -13,7 +13,11 @@ document.addEventListener('DOMContentLoaded', function() {dragClass: 'menu-item-dragged',draggable: '.dragable',animation: 350,- forceFallback: true+ forceFallback: true,+ onEnd: function (evt) {+ const newParentId = evt.to.dataset.parentId+ const position = evt.newIndex+ }};let containers = null;diff --git a/backend/app/helpers/spree/admin/menu_helper.rb b/backend/app/helpers/spree/admin/menu_helper.rbindex 24a8c34370..1b833c9f28 100644--- a/backend/app/helpers/spree/admin/menu_helper.rb+++ b/backend/app/helpers/spree/admin/menu_helper.rb@@ -23,7 +23,7 @@ module Spreedecendents = build_menu_item(menu, item.children[0]) unless item.leaf?info_row = menu_item_bar(menu, item)- sub_menu_container = content_tag(:div, decendents, class: 'menu-container')+ sub_menu_container = content_tag(:div, decendents, class: 'menu-container', data: { parent_id: item.id })content_tag(:div, info_row + sub_menu_container, class: 'menu-item menu-container-item dragable', data: { item_id: item.id })enddiff --git a/backend/app/views/spree/admin/menus/edit.html.erb b/backend/app/views/spree/admin/menus/edit.html.erbindex c447f8c32d..7bd92d5f5a 100644--- a/backend/app/views/spree/admin/menus/edit.html.erb+++ b/backend/app/views/spree/admin/menus/edit.html.erb@@ -36,32 +36,20 @@</div></div>- <div class="card-body p-0 bg-light" >+ <div class="card-body p-0 bg-light"><div id="primaryMenuContainer" class="menu-container">- <%# nested_set_options(@menu.menu_items) do |item| %>- <%# if item.root? %>- <%#= build_menu_item(@menu, item) %>- <%# end %>- <%# end %>-- <% @menu.menu_items.each_with_level(@menu.menu_items.root.self_and_descendants) do |item, level| %>- <%= build_menu_item(@menu, item) %>+ <% nested_set_options(@menu.menu_items) do |item| %>+ <% if item.root? %>+ <%= build_menu_item(@menu, item) %>+ <% end %><% end %>+ <%# @menu.menu_items.each_with_level(@menu.menu_items.root.self_and_descendants) do |item, level| %>+ <%#= build_menu_item(@menu, item) %>+ <%# end %></div></div></div></div></div></div>---<% nested_set_options(@menu.menu_items) do |item| %>- <%= "L:#{item.level} NAME:#{item.name}" %>-<% end %>---<br>-<% @menu.menu_items.each_with_level(@menu.menu_items.root.self_and_descendants) do |item, level| %>- <%= "L:#{item.level} NAME:#{item.name}" %>-<% end %>