country-select 1.0.4 → 1.0.5

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.
Files changed (4) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +42 -0
  3. data/lib/country-select.rb +3 -0
  4. metadata +22 -39
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Michael Koziarski
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ # Country-Select
2
+
3
+ Provides a simple helper to get an HTML select list of countries. The list of countries comes from the ISO 3166 standard. While it is a relatively neutral source of country names, it will still offend some users.
4
+
5
+ Users are strongly advised to evaluate the suitability of this list given their user base.
6
+
7
+ ## Latest Changes
8
+
9
+ As of version 1.0.5 a runtime error will be raised if any of the user-supplied priority countries do not correlate with those in the main country list.
10
+
11
+ **Note:** this may cause existing applications using country-select to fail, but such failures will highlight incorrect usage, enabling the implementation to be corrected so that correct and accurate data may be gathered.
12
+
13
+ Thanks to Steve Purcell (http://github.com/purcell) for this addition.
14
+
15
+ ## Installation
16
+
17
+ Install as a gem using
18
+
19
+ gem install country-select
20
+
21
+ Or put the following in your Gemfile
22
+
23
+ gem 'country-select'
24
+
25
+ ## Example
26
+
27
+ Simple use supplying model and attribute as parameters:
28
+
29
+ country_select("user", "country_name")
30
+
31
+ Supplying priority countries to be placed at the top of the list:
32
+
33
+ country_select("user", "country_name", [ "United Kingdom", "France", "Germany" ])
34
+
35
+ ## Changelist
36
+
37
+ - **1.0.5** - runtime error raised if any priority countries do not match those in the main country list
38
+ - **1.0.4** - updated the country list to match the latest ISO 3166 specification
39
+ - **1.0.3** - changed gem name from 'iso-3166-country-select' to just 'country-select'
40
+ - **1.0.2** - forked the plugin and made it into a gem
41
+
42
+ Copyright (c) 2008 Michael Koziarski, released under the MIT license
@@ -15,6 +15,9 @@ module ActionView
15
15
  country_options = ""
16
16
 
17
17
  if priority_countries
18
+ if (unlisted = priority_countries - COUNTRIES).any?
19
+ raise RuntimeError.new("Supplied priority countries are not in the main list: #{unlisted}")
20
+ end
18
21
  country_options += options_for_select(priority_countries, selected)
19
22
  country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
20
23
  end
metadata CHANGED
@@ -1,68 +1,51 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: country-select
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.5
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 4
10
- version: 1.0.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael Koziarski
14
9
  - James Dean Shepherd
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-09-23 00:00:00 +01:00
13
+ date: 2011-10-13 00:00:00.000000000 +01:00
20
14
  default_executable:
21
15
  dependencies: []
22
-
23
- description: Provides a form helper to insert a country select box using the ISO 3166 country list
16
+ description: Provides a form helper to insert a country select box using the ISO 3166
17
+ country list
24
18
  email: jamesds2007@gmail.com
25
19
  executables: []
26
-
27
20
  extensions: []
28
-
29
21
  extra_rdoc_files: []
30
-
31
- files:
22
+ files:
32
23
  - lib/country-select.rb
24
+ - README.md
25
+ - MIT-LICENSE
33
26
  has_rdoc: true
34
27
  homepage: http://github.com/jamesds/country-select
35
28
  licenses: []
36
-
37
29
  post_install_message:
38
30
  rdoc_options: []
39
-
40
- require_paths:
31
+ require_paths:
41
32
  - lib
42
- required_ruby_version: !ruby/object:Gem::Requirement
33
+ required_ruby_version: !ruby/object:Gem::Requirement
43
34
  none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- hash: 3
48
- segments:
49
- - 0
50
- version: "0"
51
- required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
40
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
60
45
  requirements: []
61
-
62
46
  rubyforge_project:
63
- rubygems_version: 1.4.2
47
+ rubygems_version: 1.6.2
64
48
  signing_key:
65
49
  specification_version: 3
66
50
  summary: Country select box
67
51
  test_files: []
68
-