Make name of payment_methods more human readable

This commit is contained in:
Rob H
2014-07-04 11:43:10 +10:00
parent 1cbdd9a5fa
commit 55e29832e1
2 changed files with 24 additions and 4 deletions

View File

@@ -30,4 +30,21 @@ end
# Ensure that all derived classes also allow distributor_ids
Spree::Gateway.providers.each do |p|
p.attr_accessible :distributor_ids
p.instance_eval do
def clean_name
case name
when "Spree::PaymentMethod::Check"
"Cash/EFT/etc. (payments for which automatic validation is not required)"
when "Spree::Gateway::Migs"
"MasterCard Internet Gateway Service (MIGS)"
when "Spree::BillingIntegration::PaypalExpressUk"
"PayPal Express (UK)"
when "Spree::BillingIntegration::PaypalExpress"
"PayPal Express"
else
i = name.rindex('::') + 2
name[i..-1]
end
end
end
end

View File

@@ -33,13 +33,16 @@
= radio_button :payment_method, :active, false
 
= label_tag nil, t(:say_no)
.row
.alpha.three.columns
= f.label :type, t(:provider)
.omega.eight.columns
= collection_select(:payment_method, :type, @providers, :to_s, :clean_name, {}, {:id => 'gtwy-type', :class => 'select2 fullwidth'})
%fieldset.alpha.eleven.columns.no-border-bottom#gateway_fields
%legend{ align="center"}
= t(:gateway)
#preference-settings.field{"data-hook" => ""}
= f.label :type, t(:provider)
= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {:id => 'gtwy-type', :class => 'select2 fullwidth'})
= t(:provider_settings)
#preference-settings
- unless @object.new_record?
= preference_fields(@object, f)
- if @object.respond_to?(:preferences)