effective_addresses 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66a2d81b649e9100efaa6c5f170a0fdddb133df5
4
- data.tar.gz: fb01322e03627d40a8a0b7561ec5f782dbffb1ec
3
+ metadata.gz: 5d46ad50e796ff7c0c17cdd23a1fe6d29b3bf1a3
4
+ data.tar.gz: 0485776d5ae75eb3ec9ecca74d2c739c0652de82
5
5
  SHA512:
6
- metadata.gz: eb91fd23e15863be1f442581bd9f6b4aac6d7b26d9893fb43f3f635ac37ef43b9305a6dc7bdf9c7f7a69a4296ac338e5a0064c8e27fb50add9302c1f7b4f5d37
7
- data.tar.gz: c5c27f859d2e41cde1c659dfbdef21e7160c32482c881251d33d8015661361bd98b1660b569517ddfd6d504cd7d1e3a05dcd95201553916292ba249d29a42d38
6
+ metadata.gz: 2d0f8119f35746bb95ab5774b5a3c6f4fe42e098c5491b6cb50f47d15a104daf0c1eda92914652e5e8c198be72cab523b8289d91e381aa0a0f5eeafd3ad21e66
7
+ data.tar.gz: 4f63eaa8c584c15592849e33a32a0457ed976b89d575e28ccd49a2c5a91ce13c41c7f3c78c991b42fc9d2843b06b9d27d778d08248801cb2d10fc4c4db29b634
@@ -5,8 +5,9 @@ module EffectiveAddressesHelper
5
5
  method = (method.to_s.include?('_address') ? method.to_s : "#{method}_address")
6
6
 
7
7
  required = (form.object._validators[method.to_sym].any? { |v| v.kind_of?(ActiveRecord::Validations::PresenceValidator) && (v.options[:if].blank? || (v.options[:if].respond_to?(:call) ? f.object.instance_exec(&v.options[:if]) : v.options[:if])) } rescue true)
8
+ use_full_name = form.object._validators[method.to_sym].any? { |v| v.kind_of?(EffectiveAddressFullNamePresenceValidator) }
8
9
 
9
- opts = {:f => form, :method => method, :required => required}.merge(options)
10
+ opts = {:f => form, :method => method, :required => required, :use_full_name => use_full_name}.merge(options)
10
11
 
11
12
  if form.class.name == 'SimpleForm::FormBuilder'
12
13
  render :partial => 'effective/addresses/address_fields_simple_form', :locals => opts
@@ -5,7 +5,7 @@
5
5
  - if ((f.object.errors.include?(method) && !f.object.errors.include?(:addresses)) rescue false)
6
6
  - fa.object.errors.add(:address1, f.object.errors[method].first)
7
7
 
8
- - if f.object._validators[method].any? { |v| v.kind_of?(EffectiveAddressFullNamePresenceValidator) }
8
+ - if use_full_name || fa.object.errors.include?(:full_name)
9
9
  = fa.input :full_name, :required => true, :label => 'Full name', :prompt => 'Full name'
10
10
 
11
11
  = fa.input :address1, :placeholder => 'Address', :label => "Address 1"
@@ -5,8 +5,8 @@
5
5
  - if ((f.object.errors.include?(method) && !f.object.errors.include?(:addresses)) rescue false)
6
6
  - fa.object.errors.add(:address1, f.object.errors[method].first)
7
7
 
8
- - if f.object._validators[method].any? { |v| v.kind_of?(EffectiveAddressFullNamePresenceValidator) }
9
- = fa.input :full_name, :required => true, :label => 'Full name', :prompt => 'Full name'
8
+ - if use_full_name || fa.object.errors.include?(:full_name)
9
+ = fa.input :full_name, :required => required, :label => 'Full name', :prompt => 'Full name'
10
10
 
11
11
  = fa.input :address1, :placeholder => 'Address', :label => 'Address 1', :required => required
12
12
  = fa.input :address2, :label => 'Address 2'
@@ -1,3 +1,3 @@
1
1
  module EffectiveAddresses
2
- VERSION = '1.0.5'.freeze
2
+ VERSION = '1.0.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails