mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
create helper to select correct url
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user