Clean up payment methods form

This commit is contained in:
Rohan Mitchell
2013-10-17 11:08:25 +11:00
parent 8654f23a19
commit de8d7bd66e
3 changed files with 7 additions and 4 deletions

View File

@@ -7,6 +7,10 @@ module EnterprisesHelper
enterprises.map { |enterprise| [enterprise.name + ": " + enterprise.address.address1 + ", " + enterprise.address.city, enterprise.id.to_i] }
end
def enterprises_to_names(enterprises)
enterprises.map(&:name).sort.join(', ')
end
def enterprise_confirm_delete_message(enterprise)
if enterprise.supplied_products.present?
"This will also delete the #{pluralize enterprise.supplied_products.count, 'product'} that this enterprise supplies. Are you sure you want to continue?"

View File

@@ -1,9 +1,8 @@
/
insert_before '[data-hook="environment"]'
/ 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
= collection_select(:payment_method, :distributor_ids, distributors, :id, :name, {include_blank: false}, {class: "select2 fullwidth", multiple: true})
= f.collection_select(:distributor_ids, distributors, :id, :name, {include_blank: false}, {class: "select2 fullwidth", multiple: true})
= f.error_message_on :distributors

View File

@@ -1,4 +1,4 @@
/ insert_top "[data-hook='admin_payment_methods_index_rows']"
%td.align-center
= method.distributors.map(&:name).sort.join(', ')
= enterprises_to_names method.distributors