mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Include E2E permissions
This commit is contained in:
@@ -32,6 +32,12 @@ module EnterprisesHelper
|
||||
Enterprise.managed_by(spree_current_user)
|
||||
end
|
||||
|
||||
def editable_enterprises
|
||||
OpenFoodNetwork::Permissions.new(spree_current_user).
|
||||
editable_enterprises.
|
||||
order('is_primary_producer ASC, name')
|
||||
end
|
||||
|
||||
def enterprises_options enterprises
|
||||
enterprises.map { |enterprise| [enterprise.name + ": " + enterprise.address.address1 + ", " + enterprise.address.city, enterprise.id.to_i] }
|
||||
end
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
= "ng-app='admin.enterprises'"
|
||||
|
||||
- content_for :page_actions do
|
||||
%li= select :enterprise, :id, options_for_select(managed_enterprises.collect {|e| [e.name, e.id, {:'data-url' => "#{main_app.edit_admin_enterprise_path(e.permalink)}", :'ng-selected' => "selected==#{e.id}"}]}, @enterprise.id ), {}, {:'enterprise-switcher' => '', 'data-initial' => "#{@enterprise.id}", :'ng-init' => "selected='#{@enterprise.id}'", :'ng-model' => 'selected', :id => 'enterprise_switcher', :class => 'select2'}
|
||||
%li= button_link_to "Back to enterprises list", main_app.admin_enterprises_path, icon: 'icon-arrow-left'
|
||||
%li= select :enterprise, :id, options_for_select(editable_enterprises.collect {|e| [e.name, e.id, {:'data-url' => "#{main_app.edit_admin_enterprise_path(e.permalink)}", :'ng-selected' => "selected==#{e.id}"}]}, @enterprise.id ), {}, {:'enterprise-switcher' => '', 'data-initial' => "#{@enterprise.id}", :'ng-init' => "selected='#{@enterprise.id}'", :'ng-model' => 'selected', :id => 'enterprise_switcher', :class => 'select2'}
|
||||
%li= button_link_to t('.back_link'), main_app.admin_enterprises_path, icon: 'icon-arrow-left'
|
||||
|
||||
|
||||
= render 'admin/enterprises/form_data'
|
||||
|
||||
Reference in New Issue
Block a user