Sha256: b498549b623dd2fcbb81e4fb76d28bc4f14e5537fc75abcb142134712aaa71aa

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

= f.inputs :name => name, :for => [method, f.object.send(method) || (f.object.addresses.build(:category => category) rescue Effective::Address.new(:category => category))] do |fa|
  - if f.object.errors.include?(method) and !f.object.errors.include?(:addresses)
    %p.inline-errors= f.object.errors[method].first

  - unless skip_full_name
    = fa.input :full_name

  = fa.input :address1, :placeholder => "e.g. Asphalt Road", :label => "Address 1"
  = fa.input :address2, :label => "Address 2"
  = fa.input :city, :placeholder => "e.g. Edmonton"
  = fa.input :country_code,
    :as => :select,
    :label => '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-behavior' => 'address-country' }

  - if fa.object.country_code.present?
    = fa.input :state_code, :as => :select, :label => "State / Province",
      :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-behavior' => 'address-state' }
  - else
    = fa.input :state_code, :as => :select, :label => "State / Province",
      :collection => [],
      :prompt => 'please select a country',
      :input_html => {:disabled => 'disabled', 'data-behavior' => 'address-state'}

  = fa.input :postal_code, :label => "Zip / Postal code", :placeholder => "e.g. A1B 2C3"
  = fa.input :category, :as => :hidden

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_addresses-0.1 app/views/effective/addresses/_address_fields.html.haml