countries_regions_and_cities_by_peterconsuegra 0.2.4 → 0.2.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
  SHA256:
3
- metadata.gz: c9dfb84c711a6dcd7b6e68cff31501be5bd3b31239b8d8c0d6c2b3dec8332ba3
4
- data.tar.gz: 9afecebe3050f327fd1193e6250e8cdfcc1161f30a3ac3fab4cb0237ccc4f0ee
3
+ metadata.gz: c98927b759e582fb6de9b590ce6e93628073ca2b76be0b80a0c4a17de60962cf
4
+ data.tar.gz: 398e821986ac1f8adecbf4c834c3d482a205d54b88d6f2e84a97e71450000a9b
5
5
  SHA512:
6
- metadata.gz: 1105e73d3502f0dc6a7fab871af689c0b0cf89b38b52fe85bc5b8b26882ded2bc95b13e39c44a60321fe50886ce8ac73c34d746d875b557261ef6daae6263347
7
- data.tar.gz: 38c0aaf006d1b43a9e5ae41d42ccd8b29d1eb73cea4dc4eea2899dd01cacad2f59766fd95b2b969f2bc80b8b4dbe1a20a00d0faab8b164dbdb78ffff77facf28
6
+ metadata.gz: c287be78aa49baff9889d848ee1ad5a4eeaa9fa938fa5d28f08a2475e97c9b6ebfe5a8ea8b149694aaddabd052066dcbb75ff54bca74d99c9ed2abe53efa5894
7
+ data.tar.gz: 07b8184e619580ac06653b40456ca8ba511b53c14f4d5a02a130672e5969c907a02bae1e4368f080a9b41f73690a744e036b943cb0ad6bd2aac8016d5f2101ba
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- countries_regions_and_cities_by_peterconsuegra (0.1.24)
4
+ countries_regions_and_cities_by_peterconsuegra (0.2.5)
5
5
  carmen (~> 1.1.3)
6
6
  city-state (~> 0.1.0)
7
+ colorize (~> 0.8.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -19,6 +20,7 @@ GEM
19
20
  activesupport (>= 3.0.0)
20
21
  city-state (0.1.0)
21
22
  rubyzip (>= 1.1)
23
+ colorize (0.8.1)
22
24
  concurrent-ruby (1.1.9)
23
25
  i18n (1.8.11)
24
26
  concurrent-ruby (~> 1.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CountriesRegionsAndCitiesByPeterconsuegra
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
@@ -8,6 +8,6 @@
8
8
 
9
9
  <% if cities %>
10
10
  <label><%=label%></label><br />
11
- <%= select_tag "#{model}[city]", options_for_select(cities, selected), include_blank: true %>
11
+ <%= select_tag "#{model}[city]", options_for_select(cities, selected), include_blank: true, id: "city" %>
12
12
  <% end %>
13
13
  </div>
@@ -2,16 +2,15 @@
2
2
 
3
3
  <div id="country_code_wrapper">
4
4
  <label><%=label%></label><br />
5
- <%= select_tag "#{model}[country]", options_for_select(country_options_array.sort_by{|c| c.name}.map{|c| [c.name, c.code]}, selected), include_blank: true %>
5
+ <%= select_tag "#{model}[country]", options_for_select(country_options_array.sort_by{|c| c.name}.map{|c| [c.name, c.code]}, selected), include_blank: true, id: "country" %>
6
6
  </div>
7
7
 
8
8
  <script>
9
9
 
10
- function city_select_logic(){
10
+ function region_select_logic(){
11
11
 
12
- $('select#place_region').change(function(event) {
13
-
14
- selected_country = $('select#<%=model%>_country').val();
12
+ $('select#region').change(function(event) {
13
+ selected_country = $('select#country').val();
15
14
  selected_region = $(this).val();
16
15
  locale = $('.locale').data('locale')
17
16
  url = "/get_cities?selected_country=" + selected_country + "&selected_region=" + selected_region + "&model=<%=model%>"
@@ -22,18 +21,18 @@
22
21
 
23
22
  $(function() {
24
23
 
25
- $('select#place_country').change(function(event) {
24
+ $('select#country').change(function(event) {
26
25
 
27
26
  selected_country = $(this).val();
28
- $('select#<%=model%>_city').val("");
29
- locale = $('.locale').data('locale')
27
+ $('select#city').val("");
28
+ //locale = $('.locale').data('locale')
30
29
  url = "/get_regions?selected_country=" + selected_country + "&model=<%=model%>"
31
30
  $('#region_field').load(url, function() {
32
- city_select_logic();
31
+ region_select_logic();
33
32
  });
34
33
  })
35
34
 
36
- city_select_logic();
35
+ region_select_logic();
37
36
 
38
37
  })
39
38
  </script>
@@ -7,7 +7,7 @@
7
7
  <%
8
8
  # byebug
9
9
  %>
10
- <%= select_tag "#{model}[region]", options_for_select(regions.sort_by{|c| c.name}.map{|c| [c.name, c.code]}, selected), include_blank: true %>
10
+ <%= select_tag "#{model}[region]", options_for_select(regions.sort_by{|c| c.name}.map{|c| [c.name, c.code]}, selected), include_blank: true, id: "region" %>
11
11
  <% end %>
12
12
  </div>
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: countries_regions_and_cities_by_peterconsuegra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Consuegra