Compare commits

...

1 Commits
0.6.1 ... 0.6.2

Author SHA1 Message Date
Rob H
25d7adac83 WIP: Replace configuration menu on payment methods edit page 2014-08-08 17:47:49 +10:00
6 changed files with 15 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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 }

View File

@@ -0,0 +1 @@
remove "code[erb-loud]:contains(\"render :partial => 'spree/admin/shared/configuration_menu'\")"

View File

@@ -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 }

View File

@@ -0,0 +1 @@
remove "code[erb-loud]:contains(\"render :partial => 'spree/admin/shared/configuration_menu'\")"