Code Monkey home page Code Monkey logo

china_city's People

Contributors

cassiuschen avatar dalezhang avatar huhuanming avatar lionzixuanyuan avatar liyaodong avatar saberma avatar topcatv avatar yuc-zhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

china_city's Issues

默认值设置错误

默认值设置:第一级为 “湖南省” (430000) , 第二级为 “长沙市” (430100)
根据教程设置了list 过滤后,用户编辑省市县,修改省份为湖北省后,第二级市竟然还是原来的湖南(长沙、株洲、湘潭等)!第三级也存在同样问题。

请问怎么避免出现“市辖区”

你好,我有个问题
比如选择河北省 石家庄市,区域里会出现市辖区,如何能避免出现“市辖区”这个选项呢?

谢谢

有bug

d767e822-0723-4519-ba70-691a7ac8d52f
在新建的form里面,选择province,后面的两个select没任何数据。在修改的form里面,因为有默认值广东省-云浮市-新兴县,当改变province默认值的时候,就出现图片的情况。浏览器关于js没报任何错误
环境
ruby 2.0
rails 4.2.4
我的代码:

<div class="city-group" style="padding-top:8px;">
   <div class="col-sm-4">
      <%= f.select(:province, ChinaCity.list.collect {|p| [ p[0], p[1] ] }, { :prompt => "--省份--" }, { :class => "city-select form-control" }) %>
    </div>
    <div class="col-sm-4">
       <%= f.select(:city, ChinaCity.list(@shop.province).collect {|p| [ p[0], p[1] ] }, { :prompt => "--省份--" }, { :class => "city-select form-control" }) %>
    </div>
    <div class="col-sm-4">
        <%= f.select(:district, ChinaCity.list(@shop.city).collect {|p| [ p[0], p[1] ] }, { :prompt => "--省份--" }, { :class => "city-select form-control" }) %>
    </div>
</div>

To update datasource:db/areas.json

非常好的一个插件。

不过,目前来看,数据方面需要做一次更新了。
比如一些城市的区域已经划分的更多了,(可能行政区域上并没有划分开来),如果也能加进来做选择就更妥了。
如深圳共十二个区政府(包括市辖区):
原六个区:福田区,罗湖区,南山区,盐田区,龙岗区,宝安区
后新增四个区:光明新区,坪山新区,龙华新区,大鹏新区
但好像又还有一个最近的:前海
http://www.baoan.gov.cn/, 下面有一个各区政府说明。

请问这个gem怎么使用啊?

首先,我是新手,如果问到的是低级问题,请见谅
我的代码如下

= form_tag deliver_addresses_path, method: :post, html: {class: "form-horizontal"}  do 
  .city-group
    select.city-select
      option --省份--
      = options_for_select(ChinaCity.list)
    select.city-select
      option --城市--
    select.city-select
      option --地区--
  .form-group
    = text_field_tag :address, params[:address], placeholder: t('.address'), class: "form-control"
  .form-group
    = text_field_tag :name, params[:name], placeholder: t('.name'), class: "form-control"  
  .form-group            
    = text_field_tag :mobile, params[:mobile], placeholder: t('.mobile'), class: "form-control"
  .form-group            
    = text_field_tag :phone, params[:phone], placeholder: t('.phone'), class: "form-control"
  .form-group            
    = text_field_tag :postcode, params[:postcode], placeholder: t('.postcode'), class: "form-control"

= submit_tag t(".submit"), class: "btn btn-primary", data: { disabled_with: t(".submit_loading") }

我怎么把这个选择后的属性city属性一起发送到后台,或者说是选择后的city属性插入到:address里面?

请支持增加一个选项来使用外部地区数据

我写了一个 https://github.com/wongyouth/chinacity 用来从统计局官网取得最新的地区数据。

通过对比发现china_cityareas.json 地区数据不是最新的,原本想递交PR,更新下最新数据。但是这样就可能导致已经在使用的Rails应用的数据关联失效。

所以是否能增加一个option来指定一个外部数据文件而不是china_city附带的地区数据。

每个城市下面都有一个「市辖区」

我发现在选择了省份、城市以后,区域选择中总是有一个「市辖区」。这个是设计吗?好像不符合习惯啊,比如我在淘宝编辑收获地址的时候就没有「市辖区」的选项。

无法选择街道

当选择‘街道’的时候,出来的options都是区的列表。不知道是不是我用错方法了?

<div class="city-group">
  <select name="province" id="" class="city-select">
    <option value="">--省份--</option>
    <%= options_for_select(ChinaCity.list) %>
  </select>
  <select name="city" id="" class="city-select">
     <option value="">--城市--</option>
     <%= options_for_select(ChinaCity.list) %>
  </select>
  <select name="area" id="" class="city-select">
     <option value="">--地区--</option>
     <%= options_for_select(ChinaCity.list) %>
  </select>
  <select name="street" id="" class="city-select">
     <option value="">--街道--</option>
     <%= options_for_select(ChinaCity.list) %>
  </select>
</div>

LoadError: cannot load such file -- gb2260

rake db:drop 
rake aborted!
LoadError: cannot load such file -- gb2260
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/china_city-0.0.5/lib/tasks/china_city_tasks.rake:1:in `<top (required)>'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `block in load'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/engine.rb:658:in `block in run_tasks_blocks'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/engine.rb:658:in `each'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/engine.rb:658:in `run_tasks_blocks'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/application.rb:451:in `block in run_tasks_blocks'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/engine/railties.rb:13:in `each'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/engine/railties.rb:13:in `each'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/application.rb:451:in `run_tasks_blocks'
/home/pc/.rvm/gems/ruby-2.2.2@leadings_development/gems/railties-4.2.5/lib/rails/engine.rb:453:in `load_tasks'
/RAILS_PATH/Rakefile:6:in `<top (required)>'
(See full trace by running task with --trace)

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can image, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Thank you.

很实用的一个Gem,节省了许多时间。谢谢。

使用Bootstrap,在小屏模式下不能选择地址。

使用bootstrap,页面为两栏,只要将页面宽度缩小,自动堆叠成一栏后,省市区的下拉框就点不出来。放大又可以点击。

<%= simple_form_for(object) do |f| %>
  <%= f.error_notification %>
  
  <div class="form-inputs row">
    <div class="city-group mgt5 col-xs-12">
      <%= label_tag(:province, "省市区 ") %>
      <%= select_tag "province", options_for_select(ChinaCity.list          , object.province)   ,
                     class: 'city-select form-control ', prompt: "--省份--", name: "custom[province]" %>
      <%= select_tag "city"    , options_for_select(ChinaCity.list(object.province), object.city)   ,
                     class: 'city-select form-control', prompt: "--城市--", name: "custom[city]"  %>
      <%= select_tag "district", options_for_select(ChinaCity.list(object.city), object.district)   ,
                     class: 'city-select form-control', prompt: "--地区--", name: "custom[district]"  %>
    </div>
  </div>

  <%= render partial: "divs/forms/button" %>

<% end %>

<%= javascript_include_tag 'select_city' %>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.