بدون توضیح

motephyr fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش
app fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش
bin ac02c77b22 change china_city to taiwan_city 10 سال پیش
config ac02c77b22 change china_city to taiwan_city 10 سال پیش
db 8cc5a049e2 config rspec. 11 سال پیش
gemfiles 64dd58f355 update version v0.0.4 10 سال پیش
lib fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش
spec fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش
.gitignore 21230b97bd init. 11 سال پیش
.rspec 8cc5a049e2 config rspec. 11 سال پیش
.travis.yml 6832f25df0 use j6. 10 سال پیش
Appraisals 9e7898be25 add appraisals config: support rails3.1, 3.2, and 4.0 10 سال پیش
Gemfile fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش
Gemfile.lock fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش
MIT-LICENSE 8e4256923e add MIT licentse to gemspec. 11 سال پیش
README.md fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش
Rakefile ac02c77b22 change china_city to taiwan_city 10 سال پیش
taiwan_city.gemspec fd8a203134 fix source,readme,gemspec,和其他發現未修改的部分 10 سال پیش

README.md

TaiwanCity 台灣縣市下拉列表

此rubygem 程式結構以china_city做參考,保留大部分原文說明。只在不同處做修改

支持 Rails3.1, Rails3.2, Rails4.0。

请留意,Rails3.1 与 Ruby2.0 不兼容,sprockets 无法正常解析 application.js,请使用 Ruby1.9。

简介

这是一个基于 Rails Engine 开发的插件,為 Rails 專案增加縣,市區二級下拉列表。

安装

Gemfile

gem 'taiwan_city'

app/assets/javascripts/application.js

//= require 'jquery'
//= require 'taiwan_city/jquery.taiwan_city'

config/routes.rb

mount TaiwanCity::Engine => '/taiwan_city'

使用

在页面中加入选择框,示例代码使用 slim 格式

  .city-group
    select.city-select
      option --省份--
      = options_for_select(TaiwanCity.list)
    select.city-select
      option --城市--
    select.city-select
      option --地区--

请留意:所有选择框都要有 city-select class,并都包含于 class='city-group' 的 DOM 元素之下。

選擇後的值為台灣的郵遞區號。

贡献

git clone git@github.com:saberma/taiwan_city.git
cd taiwan_city
rake appraisal:install
cd spec/dummy
rails server # http://localhost:3000/taiwan_city

测试

rvm use 2.0.0
rake appraisal:rails4 spec
rake appraisal:rails32 spec
rvm use 1.9.3
bundle install
rake appraisal:rails31 spec

感謝作者