= f.semantic_fields_for method, (address || 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) - field_order.each do |field| - case field - when :full_name - if local_assigns[:use_full_name] || EffectiveAddresses.use_full_name || fa.object.errors.include?(:full_name) = fa.input :full_name, :required => true, :label => 'Full name', :placeholder => 'Full name' - when :address1 = fa.input :address1, :placeholder => 'Address', :label => "Address" - when :address2 = fa.input :address2, :label => false - when :address3 = fa.input :address3, :label => false - when :city = fa.input :city, :placeholder => 'City' - when :country_code = fa.input :country_code, :as => (defined?(EffectiveFormInputs) ? :effective_select : :select), :label => 'Country', :prompt => 'Country...', :collection => options_for_select(effective_address_regions_collection()), :input_html => { 'data-effective-address-country' => uuid }, :input_js => { placeholder: 'Please choose' } - when :state_code - if fa.object.country_code.present? = fa.input :state_code, :as => (defined?(EffectiveFormInputs) ? :effective_select : :select), :label => 'Province / State', :collection => options_for_select(effective_address_regions_collection(Carmen::Country.coded(fa.object.country_code).try(:subregions))), :prompt => 'please select a country', :input_html => { 'data-effective-address-state' => uuid }, :input_js => { :placeholder => 'Please choose' } - else = fa.input :state_code, :as => (defined?(EffectiveFormInputs) ? :effective_select : :select), :label => 'Province / State', :collection => [], :prompt => 'please select a country', :input_html => {:disabled => 'disabled', 'data-effective-address-state' => uuid}, :input_js => { :placeholder => 'Please choose country first' } - when :postal_code = fa.input :postal_code, :label => 'Postal / Zip code', :placeholder => 'Postal / Zip code'