rails_admin_china_city 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/app/.DS_Store +0 -0
- data/app/views/.keep +0 -0
- data/app/views/rails_admin/main/_form_china_city_field.html.haml +23 -0
- data/lib/rails_admin_china_city/engine.rb +7 -0
- data/lib/rails_admin_china_city/version.rb +1 -1
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdf0d82ec789995a2557ea851e7aa187b25d5a63
|
4
|
+
data.tar.gz: 5e1c2a69062b4a6f362831f6a400b3365a5340ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e734d3f3edec54a78cf200761cd33b3d6e1efe05fa64fbb9c953ed3296510966c11f427da6ec170857364ff0ea69886b7d653b21ff5b15f3d1b1e169a42b79
|
7
|
+
data.tar.gz: 79aba8902c53f79d9d03e4540e1c8b256735d4ae28c696a254776d75053946a6f9c6e87f8e8321ef1e9692558db230344161295487f023b9c701c390760b1b41
|
data/.DS_Store
ADDED
Binary file
|
data/app/.DS_Store
ADDED
Binary file
|
data/app/views/.keep
ADDED
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%div.city-group.form-inline
|
2
|
+
= form.fields_for :address do |addr|
|
3
|
+
= addr.label "省"
|
4
|
+
= addr.select field.province_field, ChinaCity.list, {include_blank: true}, selected: field.province_value, class: "city-select form-control"
|
5
|
+
= addr.label "市"
|
6
|
+
= addr.select field.city_field, ChinaCity.list("#{field.province_value}"), {include_blank: true}, selected: field.city_value, class: "city-select form-control"
|
7
|
+
= addr.label "区"
|
8
|
+
= addr.select field.district_field, ChinaCity.list("#{field.city_value}"),{include_blank: true},selected:field.district_value , class: "city-select form-control "
|
9
|
+
|
10
|
+
:coffee
|
11
|
+
(($) ->
|
12
|
+
$.fn.china_city = () ->
|
13
|
+
@each ->
|
14
|
+
selects = $(@).find('.city-select')
|
15
|
+
selects.change ->
|
16
|
+
$this = $(@)
|
17
|
+
next_selects = selects.slice(selects.index(@) + 1) # empty all children city
|
18
|
+
$("option:gt(0)", next_selects).remove()
|
19
|
+
if next_selects.first()[0] and $this.val() # init next child
|
20
|
+
$.get "/china_city/\#{$(@).val()}", (data) ->
|
21
|
+
next_selects.first()[0].options.add(new Option(option[0], option[1])) for option in data
|
22
|
+
$(document).on 'rails_admin.dom_ready', -> $('.city-group').china_city()
|
23
|
+
)(jQuery)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_china_city
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- clownf
|
@@ -45,13 +45,18 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".DS_Store"
|
48
49
|
- ".gitignore"
|
49
50
|
- Gemfile
|
50
51
|
- README.md
|
51
52
|
- Rakefile
|
53
|
+
- app/.DS_Store
|
54
|
+
- app/views/.keep
|
55
|
+
- app/views/rails_admin/main/_form_china_city_field.html.haml
|
52
56
|
- bin/console
|
53
57
|
- bin/setup
|
54
58
|
- lib/rails_admin_china_city.rb
|
59
|
+
- lib/rails_admin_china_city/engine.rb
|
55
60
|
- lib/rails_admin_china_city/version.rb
|
56
61
|
- rails_admin_china_city.gemspec
|
57
62
|
homepage: https://github.com/clownf/rails_admin_china_city
|