rails_admin_china_city 0.1.0 → 0.1.1

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: e44db1315739ab06684cda5b7bc944073011fa97
4
- data.tar.gz: e742b333694006f5c0cc2e68cae08afdb81c2887
3
+ metadata.gz: fdf0d82ec789995a2557ea851e7aa187b25d5a63
4
+ data.tar.gz: 5e1c2a69062b4a6f362831f6a400b3365a5340ac
5
5
  SHA512:
6
- metadata.gz: 540f362e74615f9cb1cb44304c1756b95db090fc91750df25da5849f0fc345255480d109fd580395f49bbeb122d9707a69d33335880afedac5bed4a292b78e65
7
- data.tar.gz: 6e6de7ff4a1a34748f3d1cf20b90a0df12cf80d8b4062c4e394001382cfb3e6a6514442e0c83aee1d6525f6303c8da51633366ac43eea436aaabc243fc0ae996
6
+ metadata.gz: 20e734d3f3edec54a78cf200761cd33b3d6e1efe05fa64fbb9c953ed3296510966c11f427da6ec170857364ff0ea69886b7d653b21ff5b15f3d1b1e169a42b79
7
+ data.tar.gz: 79aba8902c53f79d9d03e4540e1c8b256735d4ae28c696a254776d75053946a6f9c6e87f8e8321ef1e9692558db230344161295487f023b9c701c390760b1b41
Binary file
Binary file
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)
@@ -0,0 +1,7 @@
1
+ require 'rails'
2
+ require 'rails_admin_china_city'
3
+
4
+ module RailsAdminChinaCity
5
+ class Engine < Rails::Engine
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsAdminChinaCity
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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