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 +4 -4
- data/Gemfile.lock +3 -1
- data/lib/countries_regions_and_cities_by_peterconsuegra/version.rb +1 -1
- data/templates/_peterconsuegra_city_select.html.erb +1 -1
- data/templates/_peterconsuegra_country_select.html.erb +9 -10
- data/templates/_peterconsuegra_region_select.html.erb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c98927b759e582fb6de9b590ce6e93628073ca2b76be0b80a0c4a17de60962cf
|
4
|
+
data.tar.gz: 398e821986ac1f8adecbf4c834c3d482a205d54b88d6f2e84a97e71450000a9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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)
|
@@ -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
|
10
|
+
function region_select_logic(){
|
11
11
|
|
12
|
-
$('select#
|
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#
|
24
|
+
$('select#country').change(function(event) {
|
26
25
|
|
27
26
|
selected_country = $(this).val();
|
28
|
-
$('select
|
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
|
-
|
31
|
+
region_select_logic();
|
33
32
|
});
|
34
33
|
})
|
35
34
|
|
36
|
-
|
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
|
|