effective_addresses 1.3.1 → 1.3.2

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: 1e8cba4d12a78d602faee293d07424ef7ef53ec6
4
- data.tar.gz: a92fde9f620c7219cfe3e904da0543b6971e22e7
3
+ metadata.gz: b5688457f9a6889758119802194fa1be36cc5452
4
+ data.tar.gz: 85af035d0d760ee4e4e997bc8db4611d500d9464
5
5
  SHA512:
6
- metadata.gz: 5f99a0c80b61790407be9e7ae6d44cf05019bedb366e82cc4fa8e0d3014986d8c5177491a64c4a62b35080bdf6801b8efae126439c9581d5dfa3dea0b6bc5e57
7
- data.tar.gz: f0e7f9b9ec536ce1e12ec234d3a9369bae7b674fd4e111806af978c57e527c8e66df3d84dc54f20fd072d514faeac0183e71a3122a60ae4e269e1204382f86b3
6
+ metadata.gz: c357eead61b53be0d8a0cb5a40d560a9ba76c707fec9d5ca0bd0d2dc6964b2317d8cb47fe33870617f11e1507ca0a647b81bdbccc7b18a40c1ac6eca8a6feaf4
7
+ data.tar.gz: 20bc9eed1de75eb80069270b242810f43c71097388119a8082358ebdab1b926f2fe6dc08feb2324cc72bcf513b5cc630b092165c3ccd255f469805746b914f41
@@ -1,15 +1,15 @@
1
1
  $(document).on 'change', "select[data-effective-address-country]", (event) ->
2
2
  country_code = $(this).val()
3
3
  uuid = $(this).data('effective-address-country')
4
+ nested_fields = $(this).closest('.nested-fields')
4
5
  form = $(this).closest('form')
5
6
 
6
- # clear postal_code and city values on country change
7
- form.find("input[data-effective-address-postal-code='#{uuid}']").val('')
8
- form.find("input[data-effective-address-city='#{uuid}']").val('')
7
+ # clear postal_code values on country change
8
+ (nested_fields || form).find("input[data-effective-address-postal-code='#{uuid}']").val('')
9
9
 
10
10
  # load state options
11
11
  url = "/addresses/subregions/#{country_code}"
12
- state_select = form.find("select[data-effective-address-state='#{uuid}']").first()
12
+ state_select = (nested_fields || form).find("select[data-effective-address-state='#{uuid}']").first()
13
13
 
14
14
  if country_code.length == 0
15
15
  state_select.prop('disabled', true).addClass('disabled').parent('.form-group').addClass('disabled')
@@ -26,7 +26,7 @@ module EffectiveAddressesHelper
26
26
  def effective_address_pre_select(address)
27
27
  if EffectiveAddresses.pre_selected_country.present?
28
28
  address.country = EffectiveAddresses.pre_selected_country
29
- address.state = EffectiveAddresses.pre_selected_state if (result[0].present? && EffectiveAddresses.pre_selected_state.present?)
29
+ address.state = EffectiveAddresses.pre_selected_state if EffectiveAddresses.pre_selected_state.present?
30
30
  elsif @@use_geocoder && request.location.present?
31
31
  location = request.location
32
32
  address.country = location.country_code
@@ -1,3 +1,3 @@
1
1
  module EffectiveAddresses
2
- VERSION = '1.3.1'.freeze
2
+ VERSION = '1.3.2'.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.3.1
4
+ version: 1.3.2
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-09-01 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails