Skip to content

Commit d1fe0eb

Browse files
committed
first commit
0 parents  commit d1fe0eb

File tree

9 files changed

+1180
-0
lines changed

9 files changed

+1180
-0
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.gem
2+
*.rbc
3+
.bundle
4+
.config
5+
.yardoc
6+
Gemfile.lock
7+
InstalledFiles
8+
_yardoc
9+
coverage
10+
doc/
11+
lib/bundler/man
12+
pkg
13+
rdoc
14+
spec/reports
15+
test/tmp
16+
test/version_tmp
17+
tmp

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in rails_country_select.gemspec
4+
gemspec

LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2013 Ruben Espinosa
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# RailsCountrySelect
2+
This project is based on Rails 2 plugin created by LukeCarrier [rails-country-select](https://github.com/rderoldan1/rails-country-select/blob/master/lib/country_definitions.rb)
3+
Select tag in order to choose a country in your forms, provides 4 options.
4+
1. Country Name.
5+
2. Cod
6+
3. ISO cod 2 chars ('CO', 'AF', 'AX', 'AL')
7+
4. ISO cod 3 chars ('COL', 'AFG', 'ALA', ALB')
8+
9+
## Installation
10+
11+
Add this line to your application's Gemfile:
12+
13+
gem 'rails_country_select'
14+
15+
And then execute:
16+
17+
$ bundle
18+
19+
Or install it yourself as:
20+
21+
$ gem install rails_country_select
22+
23+
## Usage
24+
25+
### Basic
26+
value : country cod number
27+
text : country name
28+
```ruby
29+
<%= form_for @user do |f| %>
30+
<%= f.country_select :country %>
31+
<% end %>
32+
```
33+
34+
HTML generated
35+
```html
36+
<select id="cliente_nacionalidad" name="user[country]">
37+
<option value="4">Afghanistan</option>
38+
<option value="248">Albania</option>
39+
<option value="8">Åland Islands</option>
40+
<option value="12">Algeria</option>
41+
``
42+
43+
### Advanced
44+
values, keys : [:names, :nums, :alpha2s, :alpha3s]
45+
selected : set default value
46+
prompt : message
47+
```ruby
48+
<%= form_for @user do |f| %>
49+
<%= f.country_select :country, {:keys => :names, :values => :alpha2s, :selected => "CO"}, :prompt => "Choose a country"
50+
<% end %>
51+
```
52+
53+
HTML generated
54+
```html
55+
<select id="cliente_nacionalidad" name="user[country]" prompt="Choose a country" value="CO">
56+
<option value="AF">Afghanistan</option>
57+
<option value="AL">Albania</option>
58+
<option value="AX">Åland Islands</option>
59+
<option value="DZ">Algeria</option>
60+
``
61+
## Contributing
62+
63+
1. Fork it
64+
2. Create your feature branch (`git checkout -b my-new-feature`)
65+
3. Commit your changes (`git commit -am 'Add some feature'`)
66+
4. Push to the branch (`git push origin my-new-feature`)
67+
5. Create new Pull Request

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require "bundler/gem_tasks"

0 commit comments

Comments
 (0)