Sha256: d27d104e7248d65a4eb0de987cd5a9c2dde7a78ef852419fc1151a6af60a9864

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

= f.simple_fields_for method, (address || f.object.send(method) || f.object.addresses.build(:category => method.to_s.gsub('_address', ''))), (EffectiveAddresses.simple_form_options || {}) 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 use_full_name || fa.object.errors.include?(:full_name)
    = fa.input :full_name, :required => required, :label => 'Full name', :placeholder => 'Full name'

  = fa.input :address1, :placeholder => 'Address', :label => 'Address 1', :required => required
  = fa.input :address2, :label => 'Address 2'
  = fa.input :city, :placeholder => 'City', :required => required

  = fa.input :country_code, :as => :select, :label => 'Country', :prompt => 'Choose country...', :collection => region_options_for_simple_form_select(), :input_html => {'data-effective-address-country' => uuid}, :required => required

  - if fa.object.try(:country_code).present?
    = fa.input :state_code, :as => :select, :label => 'Province / State', :prompt => 'Please choose a country first', :collection => region_options_for_simple_form_select(Carmen::Country.coded(fa.object.country_code).subregions), :input_html => {'data-effective-address-state' => uuid}, :required => required
  - else
    = fa.input :state_code, :as => :select, :label => 'Province / State', :disabled => true, :prompt => 'Please choose a country', :collection => [], :input_html => { 'data-effective-address-state' => uuid }, :required => required

  = fa.input :postal_code, :label => 'Postal / Zip code', :placeholder => 'Postal / Zip code', :required => required

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
effective_addresses-1.2.3 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.2.2 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.2.1 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.2.0 app/views/effective/addresses/_address_fields_simple_form.html.haml