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
Added `nav_item` helper methdo to unify rendering navigation across a… (#12594)
Damian Legawiec3543405afe9c
diff --git a/admin/app/helpers/spree/admin/navigation_helper.rb b/admin/app/helpers/spree/admin/navigation_helper.rbindex e02136e7bd..c9939ce8cd 100644--- a/admin/app/helpers/spree/admin/navigation_helper.rb+++ b/admin/app/helpers/spree/admin/navigation_helper.rb@@ -1,6 +1,19 @@module Spreemodule Adminmodule NavigationHelper+ # Creates a navigation item with optional icon+ # @param [String, SafeBuffer] label The text or HTML to use as the link content+ # @param [String] url The URL for the link+ # @param [String, nil] icon Optional icon name to prepend to the label+ # @param [Boolean, nil] active Whether the link should be marked as active+ # @return [SafeBuffer] The navigation item HTML+ def nav_item(label, url, icon: nil, active: nil)+ content_tag :li, class: 'nav-item', role: 'presentation' do+ label = icon(icon) + label if icon.present?+ active_link_to label, url, class: 'nav-link', active: active+ end+ end+# the per_page_dropdown is used on index pages like orders, products, promotions etc.# this method generates the select_tagdef per_page_dropdown@@ -162,16 +175,6 @@ module Spreeendend- def nav_pill_list_item(resource, url: nil, label: Spree.t(resource), active: nil, link_class: 'nav-link')- url = spree.send("admin_#{resource.to_s.pluralize}_path") if url.nil?- active = request.url.starts_with?(url) || request.fullpath.starts_with?(url) || controller_name == resource.to_s if active.nil?- link_class = "#{link_class} active" if active-- content_tag :li, class: 'nav-item', role: 'presentation' do- link_to label, url, role: 'tab', 'aria-controls': 'pills-general', class: link_class, 'aria-selected': active- end- end-def external_link_to(label, url, opts = {}, &block)opts[:target] ||= :blankopts[:rel] ||= :nofollowdiff --git a/admin/app/helpers/spree/admin/webhooks_subscribers_helper.rb b/admin/app/helpers/spree/admin/webhooks_subscribers_helper.rbindex efb12d8b99..b58b122382 100644--- a/admin/app/helpers/spree/admin/webhooks_subscribers_helper.rb+++ b/admin/app/helpers/spree/admin/webhooks_subscribers_helper.rb@@ -5,7 +5,7 @@ module Spreecontent_tag :div, class: 'col-xs-12 col-sm-6 col-md-4 col-lg-4 form-group' docontent_tag :div, class: 'custom-control custom-switch' do(form.check_box resource_name, event_checkbox_opts(resource_name), true, nil) + ' ' +- form.label(resource_name, Spree.t("admin.webhooks_subscribers.#{resource_name.to_s.pluralize}"), class: 'custom-control-label')+ form.label(resource_name, Spree.t("#{resource_name.to_s.pluralize}"), class: 'custom-control-label')endendenddiff --git a/admin/app/views/spree/admin/shared/_developers_nav.html.erb b/admin/app/views/spree/admin/shared/_developers_nav.html.erbindex 10790b5daa..cde223c2ed 100644--- a/admin/app/views/spree/admin/shared/_developers_nav.html.erb+++ b/admin/app/views/spree/admin/shared/_developers_nav.html.erb@@ -2,6 +2,6 @@<%= Spree.t(:developers) %><% end %><%= content_for :page_tabs do %>- <%= nav_pill_list_item(:api_keys, label: Spree.t(:api_keys), url: spree.admin_oauth_applications_path) if can?(:manage, Spree::OauthApplication) %>- <%= nav_pill_list_item(:webhooks, label: Spree.t(:webhooks), url: spree.admin_webhooks_subscribers_path) if can?(:manage, Spree::Webhooks::Subscriber) %>+ <%= nav_item(Spree.t(:api_keys), spree.admin_oauth_applications_path) if can?(:manage, Spree::OauthApplication) %>+ <%= nav_item(Spree.t(:webhooks), spree.admin_webhooks_subscribers_path) if can?(:manage, Spree::Webhooks::Subscriber) %><% end %>diff --git a/admin/app/views/spree/admin/shared/_posts_tabs.html.erb b/admin/app/views/spree/admin/shared/_posts_tabs.html.erbindex 48579b44cf..4d030f8a11 100644--- a/admin/app/views/spree/admin/shared/_posts_tabs.html.erb+++ b/admin/app/views/spree/admin/shared/_posts_tabs.html.erb@@ -3,6 +3,6 @@<% end %><% content_for(:page_tabs) do %>- <%= nav_pill_list_item(:posts) if can?(:manage, Spree::Post) %>- <%= nav_pill_list_item(:post_categories, label: Spree.t(:categories)) if can?(:manage, Spree::PostCategory) %>+ <%= nav_item(Spree.t(:posts), spree.admin_posts_path) if can?(:manage, Spree::Post) %>+ <%= nav_item(Spree.t(:categories), spree.admin_post_categories_path) if can?(:manage, Spree::PostCategory) %><% end %>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/_returns_and_refunds_nav.html.erb b/admin/app/views/spree/admin/shared/_returns_and_refunds_nav.html.erbindex 5d3ea797ff..cb25e018e2 100644--- a/admin/app/views/spree/admin/shared/_returns_and_refunds_nav.html.erb+++ b/admin/app/views/spree/admin/shared/_returns_and_refunds_nav.html.erb@@ -3,7 +3,7 @@<% end %><% content_for(:page_tabs) do %>- <%= nav_pill_list_item(:return_authorization_reasons, url: spree.admin_return_authorization_reasons_path) if can?(:manage, Spree::ReturnAuthorizationReason) %>- <%= nav_pill_list_item(:refund_reasons, url: spree.admin_refund_reasons_path) if can?(:manage, Spree::RefundReason) %>- <%= nav_pill_list_item(:reimbursement_types, url: spree.admin_reimbursement_types_path) if can?(:manage, Spree::ReimbursementType) %>+ <%= nav_item(Spree.t(:return_authorization_reasons), spree.admin_return_authorization_reasons_path) if can?(:manage, Spree::ReturnAuthorizationReason) %>+ <%= nav_item(Spree.t(:refund_reasons), spree.admin_refund_reasons_path) if can?(:manage, Spree::RefundReason) %>+ <%= nav_item(Spree.t(:reimbursement_types), spree.admin_reimbursement_types_path) if can?(:manage, Spree::ReimbursementType) %><% end %>diff --git a/admin/app/views/spree/admin/shared/_shipping_nav.html.erb b/admin/app/views/spree/admin/shared/_shipping_nav.html.erbindex 1bc1c4a697..7662422ff1 100644--- a/admin/app/views/spree/admin/shared/_shipping_nav.html.erb+++ b/admin/app/views/spree/admin/shared/_shipping_nav.html.erb@@ -1,4 +1,4 @@<%= content_for(:page_tabs) do %>- <%= nav_pill_list_item(:shipping_methods, url: spree.admin_shipping_methods_path, active: controller_name == 'shipping_methods' && action_name == 'index') if can?(:manage, Spree::ShippingMethod) %>- <%= nav_pill_list_item(:shipping_categories, url: spree.admin_shipping_categories_path) if can?(:manage, Spree::ShippingCategory) %>+ <%= nav_item(Spree.t(:shipping_methods), spree.admin_shipping_methods_path, active: controller_name == 'shipping_methods' && action_name == 'index') if can?(:manage, Spree::ShippingMethod) %>+ <%= nav_item(Spree.t(:shipping_categories), spree.admin_shipping_categories_path) if can?(:manage, Spree::ShippingCategory) %><% end %>diff --git a/admin/app/views/spree/admin/shared/_stock_nav.html.erb b/admin/app/views/spree/admin/shared/_stock_nav.html.erbindex 40eb7ac63c..11f0fb7623 100644--- a/admin/app/views/spree/admin/shared/_stock_nav.html.erb+++ b/admin/app/views/spree/admin/shared/_stock_nav.html.erb@@ -1,4 +1,4 @@<ul class="nav mb-0" id="pills-tab" role="tablist">- <%= nav_pill_list_item(:stock_items) if can?(:manage, Spree::StockItem) %>- <%= nav_pill_list_item(:stock_transfers) if can?(:manage, Spree::StockTransfer) %>+ <%= nav_item(Spree.t(:stock_items), spree.admin_stock_items_path) if can?(:manage, Spree::StockItem) %>+ <%= nav_item(Spree.t(:stock_transfers), spree.admin_stock_transfers_path) if can?(:manage, Spree::StockTransfer) %></ul>diff --git a/admin/app/views/spree/admin/shared/_tax_nav.html.erb b/admin/app/views/spree/admin/shared/_tax_nav.html.erbindex 18030da015..1a2e03c177 100644--- a/admin/app/views/spree/admin/shared/_tax_nav.html.erb+++ b/admin/app/views/spree/admin/shared/_tax_nav.html.erb@@ -1,4 +1,4 @@<%= content_for(:page_tabs) do %>- <%= nav_pill_list_item(:tax_rates, url: spree.admin_tax_rates_path) if can?(:manage, Spree::TaxRate) %>- <%= nav_pill_list_item(:tax_categories, url: spree.admin_tax_categories_path) if can?(:manage, Spree::TaxCategory) %>+ <%= nav_item(Spree.t(:tax_rates), spree.admin_tax_rates_path) if can?(:manage, Spree::TaxRate) %>+ <%= nav_item(Spree.t(:tax_categories), spree.admin_tax_categories_path) if can?(:manage, Spree::TaxCategory) %><% end %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erbindex 9fc20ec8c7..418e0c57a8 100644--- a/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb@@ -1,35 +1,23 @@<% orders_active = %[orders checkouts].include?(controller_name) || @order %><% if can?(:manage, Spree::Order) %>- <li class="nav-item">- <%= active_link_to spree.admin_orders_path, class: 'nav-link', active: orders_active do %>- <%= icon 'inbox' %>- <%= Spree.t(:orders) %>-+ <% orders_label = Spree.t(:orders) %>+ <% if ready_to_ship_orders_count&.positive? %>+ <% orders_label += content_tag(:span, ready_to_ship_orders_count, class: 'badge ml-auto') %>+ <% end %>++ <%= nav_item(orders_label.html_safe, spree.admin_orders_path, icon: 'inbox', active: orders_active) %>++ <% if orders_active && (ready_to_ship_orders_count&.positive? || can?(:manage, :checkouts)) %>+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1"><% if ready_to_ship_orders_count&.positive? %>- <span class="badge ml-auto">- <%= ready_to_ship_orders_count %>- </span>+ <% fulfill_label = Spree.t('admin.orders.orders_to_fulfill') %>+ <% fulfill_label += content_tag(:span, ready_to_ship_orders_count, class: 'badge ml-auto') %>+ <%= nav_item(fulfill_label.html_safe, spree.admin_orders_path(q: {shipment_state_not_in: [:shipped, :canceled]}), active: params.dig(:q, :shipment_state_not_in).present?) %><% end %>- <% end %>- <% if orders_active && (ready_to_ship_orders_count&.positive? || can?(:manage, :checkouts)) %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">- <% if ready_to_ship_orders_count&.positive? %>- <li class="nav-item">- <%= active_link_to spree.admin_orders_path(q: {shipment_state_not_in: [:shipped, :canceled]}), class: 'nav-link', active: params.dig(:q, :shipment_state_not_in).present? do %>- <span><%= Spree.t('admin.orders.orders_to_fulfill') %></span>- <span class="badge ml-auto">- <%= ready_to_ship_orders_count %>- </span>- <% end %>- </li>- <% end %>- <% if can?(:manage, :checkouts) %>- <li class="nav-item">- <%= active_link_to Spree.t(:draft_orders), spree.admin_checkouts_path, class: 'nav-link' %>- </li>- <% end %>- </ul>- <% end %>- </li>+ <% if can?(:manage, :checkouts) %>+ <%= nav_item(Spree.t(:draft_orders), spree.admin_checkouts_path, active: params[:controller] == 'checkouts') %>+ <% end %>+ </ul>+ <% end %><% end %>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erbindex 7dc0a3a474..1573e1c7ee 100644--- a/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb@@ -1,41 +1,24 @@<% products_active = %w[products external_categories taxons taxonomies option_types option_values properties stock_items stock_transfers].include?(controller_name) || request.path.include?('products') %><% if can?(:manage, Spree::Product) %>- <li class="nav-item">- <%= active_link_to spree.admin_products_path, class: 'nav-link', active: products_active do %>- <span class="position-relative">- <%= icon 'box-seam' %>- </span>- <%= Spree.t(:products) %>- <% end %>+ <%= nav_item(Spree.t(:products), spree.admin_products_path, icon: 'box-seam', active: products_active) %><% if products_active %><ul class="ml-4 pl-1 mb-2 nav-submenu mt-1"><% if can?(:manage, Spree::StockItem) || can?(:manage, Spree::StockTransfer) %>- <li class="nav-item">- <%= active_link_to Spree.t(:stock), spree.admin_stock_items_path, class: 'nav-link', active: %w[stock_items stock_transfers].include?(controller_name) %>- </li>+ <%= nav_item(Spree.t(:stock), spree.admin_stock_items_path, active: %w[stock_items stock_transfers].include?(controller_name)) %><% end %><% if can?(:manage, Spree::Taxonomy) && can?(:manage, Spree::Taxon) %>- <li class="nav-item">- <%= active_link_to Spree.t(:taxonomies), spree.admin_taxonomies_path, class: 'nav-link' %>- </li>+ <%= nav_item(Spree.t(:taxonomies), spree.admin_taxonomies_path) %><% end %><% if can?(:manage, Spree::OptionType) %>- <li class="nav-item">- <%= active_link_to Spree.t(:options), spree.admin_option_types_path, class: 'nav-link', active: %w[option_types option_values].include?(controller_name) %>- </li>+ <%= nav_item(Spree.t(:options), spree.admin_option_types_path, active: %w[option_types option_values].include?(controller_name)) %><% end %><% if can?(:manage, Spree::Property) %>- <li class="nav-item">- <%= active_link_to Spree.t(:properties), spree.admin_properties_path, class: 'nav-link' %>- </li>+ <%= nav_item(Spree.t(:properties), spree.admin_properties_path) %><% end %><% if defined?(Spree::ExternalCategory) && can?(:manage, Spree::ExternalCategory) %>- <li class="nav-item">- <%= active_link_to 'Category mapper', spree.admin_external_categories_path, class: 'nav-link' %>- </li>+ <%= nav_item('Category mapper', spree.admin_external_categories_path) %><% end %></ul><% end %>- </li><% end %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erbindex db4721e4d5..001d20764c 100644--- a/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb@@ -1,20 +1,13 @@<% returns_active = %[customer_returns return_authorizations].include?(controller_name) %><% if can?(:manage, Spree::CustomerReturn) || can?(:manage, Spree::ReturnAuthorization) %>- <li class="nav-item">- <%= active_link_to spree.admin_customer_returns_path, class: 'nav-link', active: returns_active do %>- <%= icon 'receipt-refund' %>- <%= Spree.t(:returns) %>- <% end %>+ <%= nav_item(Spree.t(:returns), spree.admin_customer_returns_path, icon: 'receipt-refund', active: returns_active) %>- <% if returns_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">- <% if can?(:manage, Spree::ReturnAuthorization) %>- <li class="nav-item">- <%= active_link_to Spree.t(:return_authorizations), spree.admin_return_authorizations_path, class: 'nav-link' %>- </li>- <% end %>- </ul>- <% end %>- </li>+ <% if returns_active %>+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">+ <% if can?(:manage, Spree::ReturnAuthorization) %>+ <%= nav_item(Spree.t(:return_authorizations), spree.admin_return_authorizations_path) %>+ <% end %>+ </ul>+ <% end %><% end %>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erbindex cce3d7834f..caa26c155b 100644--- a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb@@ -5,79 +5,51 @@</li><% if can?(:manage, current_store) %>- <li class="nav-item">- <%= active_link_to_with_icon('building-store', Spree.t(:store_details), spree.edit_admin_store_path(section: 'general-settings'), class: 'nav-link', active: params[:section] == 'general-settings') %>- </li>+ <%= nav_item(Spree.t(:store_details), spree.edit_admin_store_path(section: 'general-settings'), icon: 'building-store', active: params[:section] == 'general-settings') %><% end %><% if defined?(current_account) && current_account.present? && can?(:manage, current_account) %>- <li class="nav-item">- <%= active_link_to_with_icon 'receipt', Spree.t(:account), main_app.edit_account_path(current_account), class: 'nav-link' %>- </li>- <li class="nav-item">- <%= active_link_to_with_icon 'users', Spree.t(:account_members), main_app.account_members_path(current_account), class: 'nav-link rounded-lg ' %>- </li>+ <%= nav_item(Spree.t(:account), main_app.edit_account_path(current_account), icon: 'receipt') %>+ <%= nav_item(Spree.t(:account_members), main_app.account_members_path(current_account), icon: 'users') %><% end %><% if can?(:manage, current_store) %>- <li class="nav-item">- <%= active_link_to_with_icon('send', Spree.t(:emails), spree.edit_admin_store_path(section: 'emails'), class: 'nav-link', active: params[:section] == 'emails') %>- </li>- <li class="nav-item">- <%= active_link_to_with_icon('list-check', Spree.t(:policies), spree.edit_admin_store_path(section: 'policies'), class: 'nav-link', active: params[:section] == 'policies') %>- </li>- <li class="nav-item">- <%= active_link_to_with_icon('shopping-cart', Spree.t(:checkout), spree.edit_admin_store_path(section: 'checkout'), class: 'nav-link', active: params[:section] == 'checkout') %>- </li>+ <%= nav_item(Spree.t(:emails), spree.edit_admin_store_path(section: 'emails'), icon: 'send', active: params[:section] == 'emails') %>+ <%= nav_item(Spree.t(:policies), spree.edit_admin_store_path(section: 'policies'), icon: 'list-check', active: params[:section] == 'policies') %>+ <%= nav_item(Spree.t(:checkout), spree.edit_admin_store_path(section: 'checkout'), icon: 'shopping-cart', active: params[:section] == 'checkout') %><% end %><% if can?(:manage, Spree::CustomDomain) %>- <li class="nav-item">- <%= active_link_to_with_icon('world-www', Spree.t(:domains), spree.admin_custom_domains_path, class: 'nav-link') %>- </li>+ <%= nav_item(Spree.t(:domains), spree.admin_custom_domains_path, icon: 'world-www') %><% end %><% if can?(:manage, Spree::PaymentMethod) %>- <li class="nav-item">- <%= active_link_to_with_icon('credit-card', Spree.t(:payments), spree.admin_payment_methods_path, class: 'nav-link') %>- </li>+ <%= nav_item(Spree.t(:payments), spree.admin_payment_methods_path, icon: 'credit-card') %><% end %><% if can?(:manage, Spree::Zone) %>- <li class="nav-item">- <%= active_link_to_with_icon('world', Spree.t(:zones), spree.admin_zones_path, { active: %w[zones countries states].include?(controller_name), class: 'nav-link' }) %>- </li>+ <%= nav_item(Spree.t(:zones), spree.admin_zones_path, icon: 'world', active: %w[zones countries states].include?(controller_name)) %><% end %><% if can?(:manage, Spree::ShippingMethod) %>- <li class="nav-item">- <%= active_link_to_with_icon('truck', Spree.t(:shipping), spree.admin_shipping_methods_path, { active: %w[shipping_methods shipping_categories].include?(controller_name), class: 'nav-link' }) %>- </li>+ <%= nav_item(Spree.t(:shipping), spree.admin_shipping_methods_path, icon: 'truck', active: %w[shipping_methods shipping_categories].include?(controller_name)) %><% end %><% if can?(:manage, Spree::TaxRate) %>- <li class="nav-item">- <%= active_link_to_with_icon('receipt-tax', Spree.t(:tax), spree.admin_tax_rates_path, active: %w[tax_rates tax_categories stripe_tax_registrations].include?(controller_name), class: 'nav-link') %>- </li>+ <%= nav_item(Spree.t(:tax), spree.admin_tax_rates_path, icon: 'receipt-tax', active: %w[tax_rates tax_categories stripe_tax_registrations].include?(controller_name)) %><% end %><% if can?(:manage, Spree::ReturnAuthorizationReason) %>- <li class="nav-item">- <%= active_link_to_with_icon('receipt-refund', Spree.t(:returns), spree.admin_return_authorization_reasons_path, active: %w[refund_reasons reimbursement_types return_authorization_reasons].include?(controller_name), class: 'nav-link') %>- </li>+ <%= nav_item(Spree.t(:returns), spree.admin_return_authorization_reasons_path, icon: 'receipt-refund', active: %w[refund_reasons reimbursement_types return_authorization_reasons].include?(controller_name)) %><% end %><% if can?(:manage, Spree::StockLocation) %>- <li class="nav-item">- <%= active_link_to_with_icon('map-pin', Spree.t(:stock_locations), spree.admin_stock_locations_path, class: 'nav-link') %>- </li>+ <%= nav_item(Spree.t(:stock_locations), spree.admin_stock_locations_path, icon: 'map-pin') %><% end %><% if can?(:manage, Spree::Store) %><% if enterprise_edition? %>- <li class="nav-item">- <%= active_link_to_with_icon('history', Spree.t('admin.audit_log'), spree.admin_audits_path, class: 'nav-link w-auto', active: %w[audits exports imports].include?(controller_name)) %>- </li>+ <%= nav_item(Spree.t('admin.audit_log'), spree.admin_audits_path, icon: 'history', active: %w[audits exports imports].include?(controller_name)) %><% else %><li class="nav-item"><%= external_link_to nil, 'https://spreecommerce.org/pricing', class: 'nav-link d-flex align-items-center w-100' do %>@@ -91,9 +63,7 @@<% end %><% if can?(:manage, Spree::OauthApplication) %>- <li class="nav-item">- <%= active_link_to_with_icon('terminal', Spree.t(:developers), spree.admin_oauth_applications_path, class: 'nav-link', active: %w[oauth_applications webhooks_subscribers].include?(controller_name)) %>- </li>+ <%= nav_item(Spree.t(:developers), spree.admin_oauth_applications_path, icon: 'terminal', active: %w[oauth_applications webhooks_subscribers].include?(controller_name)) %><% end %></ul><% else %>@@ -163,14 +133,12 @@<%= render 'spree/admin/shared/sidebar/storefront_nav' %><%= render 'spree/admin/shared/sidebar/integrations_nav' %>- <li class="nav-item border-top border-top-dashed my-1"></li>- <li class="nav-item">- <%= active_link_to_with_icon('settings', Spree.t(:settings), spree.edit_admin_store_path(section: 'general-settings'), class: 'nav-link', active: params[:section] == 'general-settings') %>- </li>+ <% if can?(:manage, current_store) %>+ <li class="nav-item border-top border-top-dashed my-1"></li>+ <%= nav_item(Spree.t(:settings), spree.edit_admin_store_path(section: 'general-settings'), icon: 'settings', active: params[:section] == 'general-settings') %>+ <% end %><% if defined?(current_account) && current_account.present? && can?(:manage, current_account) %>- <li class="nav-item">- <%= active_link_to_with_icon 'users', Spree.t(:account_members), main_app.account_members_path(current_account), class: 'nav-link' %>- </li>+ <%= nav_item(Spree.t(:account_members), main_app.account_members_path(current_account), icon: 'users') %><% end %></ul><% end %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erbindex 1fffd5d1c5..7969cbf673 100644--- a/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb@@ -1,29 +1,22 @@<% if can?(:manage, Spree::Theme) %>- <li class="nav-item">- <% storefront_active = %w[themes posts post_categories pages storefront].include?(controller_name) %>- <%= active_link_to_with_icon('building-store', Spree.t('admin.storefront'), spree.admin_themes_path, class: 'nav-link', active: storefront_active) %>+ <% storefront_active = %w[themes posts post_categories pages storefront].include?(controller_name) %>+ <%= nav_item(Spree.t('admin.storefront'), spree.admin_themes_path, icon: 'building-store', active: storefront_active) %>- <% if storefront_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">- <li class="nav-item">- <%= active_link_to Spree.t(:themes), spree.admin_themes_path, class: 'nav-link' %>- </li>- <% if can?(:manage, Spree::Page) %>- <li class="nav-item">- <%= active_link_to Spree.t(:pages), spree.admin_pages_path, class: 'nav-link' %>- </li>- <% end %>- <% if can?(:manage, Spree::Post) %>- <li class="nav-item">- <%= active_link_to Spree.t(:posts), spree.admin_posts_path, class: 'nav-link', active: %w[posts post_categories].include?(controller_name) %>- </li>- <% end %>- <% if can?(:manage, current_store) %>- <li class="nav-item">- <%= active_link_to Spree.t(:settings), spree.edit_admin_storefront_path, class: 'nav-link' %>- </li>- <% end %>- </ul>- <% end %>- </li>+ <% if storefront_active %>+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">+ <%= nav_item(Spree.t(:themes), spree.admin_themes_path) %>++ <% if can?(:manage, Spree::Page) %>+ <%= nav_item(Spree.t(:pages), spree.admin_pages_path) %>+ <% end %>++ <% if can?(:manage, Spree::Post) %>+ <%= nav_item(Spree.t(:posts), spree.admin_posts_path, active: %w[posts post_categories].include?(controller_name)) %>+ <% end %>++ <% if can?(:manage, current_store) %>+ <%= nav_item(Spree.t(:settings), spree.edit_admin_storefront_path) %>+ <% end %>+ </ul>+ <% end %><% end %>\ No newline at end of filediff --git a/admin/config/locales/en.yml b/admin/config/locales/en.ymlindex ca5b1e3629..99be4a0c0c 100644--- a/admin/config/locales/en.yml+++ b/admin/config/locales/en.yml@@ -251,54 +251,11 @@ en:stock_locations_link: To add more stock locations please go to <a href="%{link}">Stock Locations</a>total_inventory_html: 'Total inventory at %{stock_location} location: %{count} available'webhooks_subscribers:- addresses: Addressesall_events: All Events- assets: Assets- credit_cards: Credit Cards- customer_returns: Customer Returns- digital_links: Digital Links- digitals: Digitals- inventory_units: Inventory Units- line_items: Line Itemsnew_webhooks_subscriber: New Webhooks Subscriberno_events: No Events- option_types: Option Types- option_values: Option Values- orders: Orders- payment_capture_events: Payment Capture Events- payments: Payments- prices: Prices- products: Products- promotions: Promotions- properties: Properties- prototypes: Prototypes- refunds: Refunds- reimbursements: Reimbursements- return_authorizations: Return Authorizations- return_items: Return Items- roles: Rolesselect_events: Select events- shipment_transfer:- wrong_destination: Selected location is not a valid destination- shipments: Shipments- shipping_categories: Shipping Categories- shipping_methods: Shipping Methods- shipping_rates: Shipping Rates- stock_items: Stock Items- stock_locations: Stock Locations- stock_movements: Stock Movements- stock_transfers: Stock Transfers- store_credits: Store Credits- stores: Storessubscribe_to_all_events: Subscribe to all eventssubscriptions: Subscriptions- tax_rates: Tax Rates- taxonomies: Taxonomies- taxons: Taxonstime_of_last_event: Time of Last Event- variants: Variantswebhooks_events: Webhooks Events- webhooks_subscribers: Webhooks Subscribers- wished_items: Wished Items- wishlists: Wishlists- zones: Zonesdiff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex d5be41bda0..17ad94e327 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -1923,6 +1923,7 @@ en:states_required: States Requiredstatus: Statusstock: Stock+ stock_items: Stock Itemsstock_location: Stock Locationstock_location_info: Stock location infostock_locations: Stock Locations