Sha256: 5d2f588bb050384816f54cd25b74f36b26441748ddd1b6796a111bf8b08e96d2
Contents?: true
Size: 1.81 KB
Versions: 6
Compression:
Stored size: 1.81 KB
Contents
= f.semantic_fields_for method, f.object.send(method) || f.object.addresses.build(:category => method.to_s.gsub('_address', '')) do |fa| - uuid = fa.object_id - method = method.to_sym - if ((f.object.errors.include?(method) && !f.object.errors.include?(:addresses)) rescue false) - fa.object.errors.add(:address1, f.object.errors[method].first) - if f.object._validators[method].any? { |v| v.kind_of?(EffectiveAddressFullNamePresenceValidator) } = fa.input :full_name, :required => true, :label => 'Full name', :prompt => 'Full name' = fa.input :address1, :placeholder => 'Address', :label => "Address 1" = fa.input :address2, :label => 'Address 2' = fa.input :city, :placeholder => 'City' = fa.input :country_code, :as => :select, :label => 'Country', :prompt => 'Country...', :collection => region_options_for_select(EffectiveAddresses.country_codes == :all ? Carmen::Country.all : Carmen::Country.all.select{ |c| EffectiveAddresses.country_codes.include?(c.code) rescue true}, fa.object.country_code, :priority => EffectiveAddresses.country_codes_priority), :input_html => { 'data-effective-address-country' => uuid } - if fa.object.country_code.present? = fa.input :state_code, :as => :select, :label => 'Province / State', :collection => region_options_for_select(Carmen::Country.coded(fa.object.country_code).subregions, fa.object.state_code), :prompt => 'please select a country', :input_html => { 'data-effective-address-state' => uuid } - else = fa.input :state_code, :as => :select, :label => 'Province / State', :collection => [], :prompt => 'please select a country', :input_html => {:disabled => 'disabled', 'data-effective-address-state' => uuid} = fa.input :postal_code, :label => 'Postal / Zip code', :placeholder => 'Postal / Zip code'
Version data entries
6 entries across 6 versions & 1 rubygems