effective_addresses 1.9.3 → 1.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/app/helpers/effective_addresses_helper.rb +1 -3
- data/app/models/effective/address.rb +14 -16
- data/lib/effective_addresses.rb +19 -14
- data/lib/effective_addresses/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 903de54494687e66176870441f7dbf08122086a9d1de3dae3a38da0cbd2cca99
|
4
|
+
data.tar.gz: 8535f034cd7392a7f9ee711386248618f2b8d647784e30dfc4fc726220ec55c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0601a1e879b7cdce8604dd836bd4d80bbca09c1606ff68523ef591b07925ad9b5aba9c679a060a82b7cc5b3e16fa8f2bd0a9a4301ca4e1ab399d9c610ee81b94
|
7
|
+
data.tar.gz: 0fc12952f62102c4f792a4c25f380daec74a862a5a6a1fab39edd1a2546d11aa44442ea41c60318b64d3773e4a1adb965e767f5b18ed6c50c079f0b8e29f0b45
|
data/MIT-LICENSE
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
module EffectiveAddressesHelper
|
2
|
-
@@use_geocoder = defined?(Geocoder)
|
3
|
-
|
4
2
|
def effective_address_fields(form, method = 'billing', options = {})
|
5
3
|
method = (method.to_s.include?('_address') ? method.to_s : "#{method}_address")
|
6
4
|
|
@@ -28,7 +26,7 @@ module EffectiveAddressesHelper
|
|
28
26
|
if EffectiveAddresses.pre_selected_country.present?
|
29
27
|
address.country = EffectiveAddresses.pre_selected_country
|
30
28
|
address.state = EffectiveAddresses.pre_selected_state if EffectiveAddresses.pre_selected_state.present?
|
31
|
-
elsif
|
29
|
+
elsif defined?(Geocoder) && request.location.present?
|
32
30
|
location = request.location
|
33
31
|
address.country = location.country_code
|
34
32
|
address.state = location.state_code
|
@@ -8,27 +8,25 @@ module Effective
|
|
8
8
|
|
9
9
|
belongs_to :addressable, polymorphic: true, touch: true
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
category :string
|
11
|
+
effective_resource do
|
12
|
+
category :string
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
full_name :string
|
15
|
+
address1 :string
|
16
|
+
address2 :string
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
if EffectiveAddresses.use_address3
|
19
|
+
address3 :string
|
20
|
+
end
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
city :string
|
23
|
+
state_code :string
|
24
|
+
country_code :string
|
25
|
+
postal_code :string
|
27
26
|
|
28
|
-
|
27
|
+
shipping_address_same_as_billing permitted: true
|
29
28
|
|
30
|
-
|
31
|
-
end
|
29
|
+
timestamps
|
32
30
|
end
|
33
31
|
|
34
32
|
validates :category, :address1, :city, :country_code, :postal_code, presence: true, if: Proc.new { |address| address.present? }
|
data/lib/effective_addresses.rb
CHANGED
@@ -1,26 +1,31 @@
|
|
1
1
|
require 'carmen'
|
2
|
+
require 'effective_resources'
|
2
3
|
require 'effective_addresses/engine'
|
3
4
|
require 'effective_addresses/version'
|
4
5
|
|
5
6
|
module EffectiveAddresses
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
yield self
|
8
|
+
def self.config_keys
|
9
|
+
[
|
10
|
+
:addresses_table_name,
|
11
|
+
:country_codes,
|
12
|
+
:country_codes_priority,
|
13
|
+
:use_full_name,
|
14
|
+
:use_address3,
|
15
|
+
:simple_form_options,
|
16
|
+
:validate_postal_code_format,
|
17
|
+
:pre_selected_country,
|
18
|
+
:pre_selected_state
|
19
|
+
]
|
20
20
|
end
|
21
21
|
|
22
|
+
include EffectiveGem
|
23
|
+
|
22
24
|
def self.permitted_params
|
23
|
-
[
|
25
|
+
[
|
26
|
+
:address1, :address2, :address3, :city, :country_code, :state_code, :postal_code,
|
27
|
+
:full_name, :shipping_address_same_as_billing
|
28
|
+
]
|
24
29
|
end
|
25
30
|
|
26
31
|
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.9.
|
4
|
+
version: 1.9.4
|
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: 2021-02-
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: effective_resources
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: carmen
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|