mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-15 19:06:50 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25d7adac83 |
@@ -1,4 +1,6 @@
|
||||
Spree::Admin::PaymentMethodsController.class_eval do
|
||||
before_filter :load_hubs, only: [:new, :edit, :create, :update]
|
||||
|
||||
# Only show payment methods that user has access to and sort by distributor name
|
||||
# ! Redundant code copied from Spree::Admin::ResourceController with modifications marked
|
||||
def collection
|
||||
@@ -22,4 +24,9 @@ Spree::Admin::PaymentMethodsController.class_eval do
|
||||
|
||||
collection
|
||||
end
|
||||
|
||||
private
|
||||
def load_hubs
|
||||
@hubs = Enterprise.managed_by(spree_current_user).is_distributor.sort_by!{ |d| [(@payment_method.has_distributor? d) ? 0 : 1, d.name] }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
/ insert_before '[data-hook="environment"]'
|
||||
|
||||
= f.field_container :distributors do
|
||||
= f.label :distributors
|
||||
%br
|
||||
- distributors = Enterprise.is_distributor.managed_by(spree_current_user) | f.object.distributors
|
||||
= f.collection_select(:distributor_ids, distributors, :id, :name, {include_blank: false}, {class: "select2 fullwidth", multiple: true})
|
||||
= f.error_message_on :distributors
|
||||
@@ -0,0 +1,3 @@
|
||||
/ insert_after "code[erb-loud]:contains(\"render :partial => 'form', :locals => { :f => f }\")"
|
||||
|
||||
= render :partial => 'spree/admin/shared/hubs_sidebar', :locals => { :f => f }
|
||||
@@ -0,0 +1 @@
|
||||
remove "code[erb-loud]:contains(\"render :partial => 'spree/admin/shared/configuration_menu'\")"
|
||||
@@ -0,0 +1,3 @@
|
||||
/ insert_after "code[erb-loud]:contains(\"render :partial => 'form', :locals => { :f => f }\")"
|
||||
|
||||
= render :partial => 'spree/admin/shared/hubs_sidebar', :locals => { :f => f }
|
||||
@@ -0,0 +1 @@
|
||||
remove "code[erb-loud]:contains(\"render :partial => 'spree/admin/shared/configuration_menu'\")"
|
||||
Reference in New Issue
Block a user