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.

Admin: Fixed return authorizations breadcrumbs

Damian Legawiecbc753e6ecb12
diff --git a/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb b/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb
index 0f567fbccc..881d51ef10 100644
--- a/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb
+++ b/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb
@@ -3,8 +3,10 @@ module Spree
module Orders
class ReturnAuthorizationsController < ResourceController
include Spree::Admin::OrderConcern
+ include Spree::Admin::OrderBreadcrumbConcern
before_action :load_order
+ before_action :add_breadcrumb_for_order
before_action :load_return_authorization
before_action :load_form_data, only: [:new, :edit]
@@ -14,6 +16,11 @@ module Spree
private
+
+ def add_breadcrumb_for_order
+ add_breadcrumb @order.number, spree.edit_admin_order_path(@order)
+ end
+
def location_after_save
spree.edit_admin_order_path(@order)
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.erb
index 7a19b31dbd..691ae3fedd 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,4 +1,4 @@
-<% returns_active = %[customer_returns return_authorizations].include?(controller_name) %>
+<% returns_active = %[customer_returns return_authorizations].include?(controller_name) && !@order %>
<% if can?(:manage, Spree::CustomerReturn) || can?(:manage, Spree::ReturnAuthorization) %>
<%= nav_item(Spree.t(:returns), spree.admin_customer_returns_path, icon: 'receipt-refund', active: returns_active) %>