effective_addresses 1.3.4 → 1.3.5

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: e2a0de702ce06b137ff76dd3369442ddf9ba5f94
4
- data.tar.gz: 698755ab5f757fcbb8ee8c1d481b8e5df0bf238c
3
+ metadata.gz: 2d0c4361e8830a2fb6bb359f7d34d74f6eb44e56
4
+ data.tar.gz: 61c3558e17e2bfee0d994b319a23bfd7ab7dc3af
5
5
  SHA512:
6
- metadata.gz: 5cb549e5323b92b3b312d9ca9b33e66d7959a4f9b7d7b628f384522bf8a8405c1f8ac3f845fe2f65844e49a94d558d70223beda6e311524d380c6b2bfe08c005
7
- data.tar.gz: 236e4f110bc5956d46b1ba0c9ad9fd0ed0732ff74995631b630b38ba33ba9c3d0989535f8ea1af280247fa4b0c885b427fee308706f056facdcef94d2d18c71a
6
+ metadata.gz: 2af70e912d4cb310996e0d5d98ef7eb2239153f594da4486a55ebcb25ad353e8f9e13eec59e05877efd27f5c3f6cb94d140bd1d6ca6a26561359dd22896ba892
7
+ data.tar.gz: e61435314450ee49f758422a038b69ebb9aed78075cefc8d3b5dc4f1acb2429bf9c0490eaa05ac2a5a69a4771ac57680140ac5d05c8ec999efea633d8efb5b54
@@ -1,4 +1,4 @@
1
- loadSubregions = ($countrySelect) ->
1
+ loadSubregions = ($countrySelect, clearPostalCode = false) ->
2
2
  $.each $countrySelect, (index, countrySelector) ->
3
3
  $particularCountrySelect = $(countrySelector)
4
4
  countryCode = $particularCountrySelect.val()
@@ -9,8 +9,8 @@ loadSubregions = ($countrySelect) ->
9
9
 
10
10
  $container = if $nestedFields.length == 0 then $form else $nestedFields
11
11
 
12
- # clear postal_code values on country change
13
- $container.find("input[data-effective-address-postal-code='#{uuid}']").val('')
12
+ # clear postal_code values on country change if it is turned on
13
+ $container.find("input[data-effective-address-postal-code='#{uuid}']").val('') if clearPostalCode
14
14
 
15
15
  # load state options
16
16
  url = "/addresses/subregions/#{countryCode}"
@@ -20,18 +20,18 @@ loadSubregions = ($countrySelect) ->
20
20
  $stateSelect.prop('disabled', true).addClass('disabled').parent('.form-group').addClass('disabled')
21
21
  $stateSelect.html('<option value="">Please choose a country first</option>')
22
22
  else
23
- $stateSelect.removeProp('disabled').removeClass('disabled').parent('.form-group').removeClass('disabled')
23
+ $stateSelect.prop('disabled', false).removeClass('disabled').parent('.form-group').removeClass('disabled')
24
24
  $stateSelect.find('option').first().text('loading...')
25
25
  $stateSelect.load url, ->
26
26
  stateSelectAvailable = $(@).find('option:last').val().length > 0
27
27
  if stateSelectAvailable
28
28
  $(@).prop('required', true)
29
- $(@).removeProp('disabled')
29
+ $(@).prop('disabled', false)
30
30
  else
31
- $(@).removeProp('required')
31
+ $(@).prop('required', false)
32
32
  $(@).prop('disabled', true)
33
33
 
34
- $(document).on 'change', 'select[data-effective-address-country]', -> loadSubregions($(@))
34
+ $(document).on 'change', 'select[data-effective-address-country]', -> loadSubregions($(@), true)
35
35
 
36
36
  $ -> loadSubregions($('select[data-effective-address-country]'))
37
37
  $(document).on 'page:change', -> loadSubregions($('select[data-effective-address-country]'))
@@ -1,3 +1,3 @@
1
1
  module EffectiveAddresses
2
- VERSION = '1.3.4'.freeze
2
+ VERSION = '1.3.5'.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.4
4
+ version: 1.3.5
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-10-20 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails