countries 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/countries.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  require File.expand_path('../lib/countries/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["hexorx", "Joe Corcoran"]
5
+ gem.authors = ["Josh Robinson", "Joe Corcoran"]
6
6
  gem.email = ["hexorx@gmail.com"]
7
7
  gem.description = %q{All sorts of useful information about every country packaged as pretty little country objects. It includes data from ISO 3166}
8
8
  gem.summary = %q{Gives you a country object full of all sorts of useful information.}
@@ -8,14 +8,21 @@ module ActionView
8
8
  end
9
9
 
10
10
  def country_options_for_select(selected = nil, priority_countries = nil)
11
- country_options = "".html_safe
11
+ country_options = ""
12
12
 
13
13
  if priority_countries
14
- priority_countries = [*priority_countries].map {|x| [x.html_safe,ISO3166::Country::NameIndex[x]] }
14
+ priority_countries = [*priority_countries].map {|x| [x,ISO3166::Country::NameIndex[x]] }
15
15
  country_options += options_for_select(priority_countries, selected)
16
- country_options += raw("<option value=\"\" disabled=\"disabled\">-------------</option>\n")
16
+ country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
17
+
18
+ # prevent selected from being included twice in the HTML which causes
19
+ # some browsers to select the second selected option (not priority)
20
+ # which makes it harder to select an alternative priority country
21
+ selected = nil if priority_countries.include?([ISO3166::Country[selected].name, selected])
17
22
  end
18
23
 
24
+ country_options = country_options.html_safe if country_options.respond_to?(:html_safe)
25
+
19
26
  countries = ISO3166::Country::Names.map{|(name,alpha2)| [name.html_safe,alpha2] }
20
27
 
21
28
  return country_options + options_for_select(countries, selected)
@@ -1,3 +1,3 @@
1
1
  module Countries
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: countries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - hexorx
8
+ - Josh Robinson
9
9
  - Joe Corcoran
10
10
  autorequire:
11
11
  bindir: bin