Merge pull request #13143 from mkllnk/admin-in-same-tab

Open admin dashboard in same tab by default
This commit is contained in:
Filipe
2025-03-25 17:10:51 +00:00
committed by GitHub
4 changed files with 13 additions and 2 deletions

View File

@@ -15,4 +15,12 @@ module LinkHelper
prefix + url
end
end
def new_tab_option
if feature?(:open_in_same_tab, spree_current_user)
{}
else
{ target: "_blank" }
end
end
end

View File

@@ -9,7 +9,7 @@
- if admin_user? or enterprise_user?
%li
%a{href: spree.admin_dashboard_path, target:'_blank'}
%a{href: spree.admin_dashboard_path, **new_tab_option}
%i.ofn-i_021-tools
= t 'label_administration'

View File

@@ -1,6 +1,6 @@
- if admin_user? or enterprise_user?
%li
%a{href: spree.admin_dashboard_path, target:'_blank'}
%a{href: spree.admin_dashboard_path, **new_tab_option}
%i.ofn-i_021-tools
= t 'label_admin'

View File

@@ -58,6 +58,9 @@ module OpenFoodNetwork
Activated for a user.
The user (INRAE researcher) has access to anonymised sales.
DESC
"open_in_same_tab" => <<~DESC,
Open the admin dashboard in the same tab instead of a new tab.
DESC
}.merge(conditional_features).freeze;
# Features you would like to be enabled to start with.