create helper to select correct url

This commit is contained in:
Sinan Chaush
2021-09-09 22:22:25 +02:00
parent 12c154934d
commit 868187aaaf
2 changed files with 9 additions and 1 deletions

View File

@@ -100,4 +100,12 @@ module EnterprisesHelper
def subscriptions_enabled?
spree_current_user.admin? || spree_current_user.enterprises.where(enable_subscriptions: true).any?
end
def enterprise_url_selector(enterprise)
if enterprise.is_distributor
main_app.enterprise_shop_url(enterprise)
else
main_app.producers_url
end
end
end

View File

@@ -40,7 +40,7 @@
%span.icon-user
= t "your_profil_live"
.list
%a.button.bottom{href: enterprise_url(@enterprise), target: '_blank'}
%a.button.bottom{href: enterprise_url_selector(@enterprise), target: '_blank'}
= t "see"
= @enterprise.name
= t "live"