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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d46ad50e796ff7c0c17cdd23a1fe6d29b3bf1a3
|
4
|
+
data.tar.gz: 0485776d5ae75eb3ec9ecca74d2c739c0652de82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
9
|
-
= fa.input :full_name, :required =>
|
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'
|
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.
|
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-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|