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.

Fix footer menu and mobile menu.

Matthew Kennedydf9537730b45
diff --git a/frontend/app/controllers/spree/store_controller.rb b/frontend/app/controllers/spree/store_controller.rb
index 1fca946459..95b49303ca 100644
--- a/frontend/app/controllers/spree/store_controller.rb
+++ b/frontend/app/controllers/spree/store_controller.rb
@@ -32,7 +32,7 @@ module Spree
end
def menu_by_code(code)
- menu = Spree::Menu.includes(:menu_items).by_store(current_store).by_unique_code(code)
+ menu = Spree::Menu.by_store(current_store).by_unique_code(code)
menu[0]
end
helper_method :menu_by_code
diff --git a/frontend/app/views/spree/shared/_footer.html.erb b/frontend/app/views/spree/shared/_footer.html.erb
index 90d73cc66b..fa28d10cb7 100644
--- a/frontend/app/views/spree/shared/_footer.html.erb
+++ b/frontend/app/views/spree/shared/_footer.html.erb
@@ -50,10 +50,9 @@
<div class="row d-none d-xl-flex border-top py-5 text-uppercase footer-spree-menu-links">
<% if menu_by_code('spree-all-footer').present? %>
- <% footer_menu_items = menu_by_code('spree-all-footer').menu_items.order(:lft) %>
+ <% footer_menu_root = menu_by_code('spree-all-footer').root %>
- <% footer_menu_items.each do |root| %>
- <% if root.root? %>
+ <% footer_menu_root.children.each do |root| %>
<div class="col-3">
<div class="footer-spree-label">
<%= link_to root.name, localized_item_link(root) %>
@@ -68,7 +67,6 @@
<% end %>
<% end %>
</div>
- <% end %>
<% end %>
<% end %>
diff --git a/frontend/app/views/spree/shared/_mobile_navigation.html.erb b/frontend/app/views/spree/shared/_mobile_navigation.html.erb
index 82601b25de..5fd532914e 100644
--- a/frontend/app/views/spree/shared/_mobile_navigation.html.erb
+++ b/frontend/app/views/spree/shared/_mobile_navigation.html.erb
@@ -1,5 +1,5 @@
<% if menu_by_code('spree-all-main').present? %>
-<% main_menu_items = menu_by_code('spree-all-main').menu_items.order(:lft) %>
+<% main_menu_root = menu_by_code('spree-all-main').root %>
<div class="position-fixed text-uppercase d-xl-none mobile-navigation" role="navigation" aria-label="<%= Spree.t('nav_bar.mobile') %>">
<div class="container d-flex align-items-center justify-content-between header-spree" data-hook>
@@ -20,8 +20,7 @@
</div>
<ul class="list-unstyled position-relative h-100 mobile-navigation-list">
- <% main_menu_items.each do |root| %>
- <% if root.root? %>
+ <% main_menu_root.children.each do |root| %>
<li class="d-flex justify-content-between align-items-center mobile-navigation-list-item">
<%= link_to root.name, localized_item_link(root), class: 'w-75' %>
<% if root.children.present? %>
@@ -38,6 +37,7 @@
<% root.children.each do |child| %>
<% if child.code == 'category' && child.item_type == 'Container' %>
+ <li class="text-muted mt-2"><%= child.name %></li>
<% if child.children.present? %>
<% child.children.each do |category_link| %>
<li class="d-flex justify-content-between align-items-center mobile-navigation-list-item">
@@ -50,7 +50,6 @@
</ul>
<% end %>
</li>
- <% end %>
<% end %>
</ul>
<% end %>