Sha256: 534c59b2991c49613f99f8ce4fbc2cbf998f627fed89849536c252141d124d01

Contents?: true

Size: 1.72 KB

Versions: 6

Compression:

Stored size: 1.72 KB

Contents

= f.simple_fields_for method, (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 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', :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

6 entries across 6 versions & 1 rubygems

Version Path
effective_addresses-1.0.5 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.0.4 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.0.3 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.0.2 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.0.1 app/views/effective/addresses/_address_fields_simple_form.html.haml
effective_addresses-1.0.0 app/views/effective/addresses/_address_fields_simple_form.html.haml