au_state_select 1.1 → 1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1cca2e92ecd74c8f158506e4bcae5c49e955212
4
- data.tar.gz: 863ef1485387bfeebd3bcdf34b2c3ddcc3839de2
3
+ metadata.gz: 54980a071b0097856c01c7ef49e005bc8138f29f
4
+ data.tar.gz: 2597a1b2b589add45dd68c5de9018ac9b31df824
5
5
  SHA512:
6
- metadata.gz: 00e42e305a0759b42b8e7d267482e985802f81995ac67947ee1a665426c6ef6c4d4bd4206f03bc000688fc5045e0203be8a54b180f4df11b0c5965d23da93e9b
7
- data.tar.gz: 74f8740e4f41076e03d2c87cb6293fedfd651a9d19fdf7702e1f329b98d5a7a8af58ce434f2afc0a4bb2f24cde36bbbf42cbd72548d3df9c33c8adff6bf6ac98
6
+ metadata.gz: 6f4268bdfecdf6df8d1c7c2708395873626f16057fd33c479cae9e9a7ab99c74b44b109c156b00c55043d897667da2bec33fd8b8abea4a329c5b4b1568736ec5
7
+ data.tar.gz: 48723b83fd4634371b3c49e5e1920190635a3cfe858ab088f2d99043f075013748bf041dd4f8d615d45e61e409f6ed485c93543a09d9f4b4da794964353dbfe4
@@ -13,23 +13,27 @@ module AUStateSelect
13
13
  def state_select(priority_states, options, html_options)
14
14
  selected = object.send(@method_name) if object.respond_to?(@method_name)
15
15
 
16
- countries = ""
16
+ states = ""
17
17
 
18
18
  if options.present? and (options[:include_blank] or (options[:prompt] and !selected))
19
- option = options[:include_blank] == true ? "" : options[:include_blank]
20
- countries += "<option>#{option}</option>\n"
19
+ if options[:include_blank].present?
20
+ option = options[:include_blank] == true ? "" : options[:include_blank]
21
+ elsif options[:prompt].present?
22
+ option = options[:prompt] == true ? "Please Select" : options[:prompt]
23
+ end
24
+ states += "<option>#{option}</option>\n"
21
25
  end
22
26
 
23
27
  if priority_states
24
- countries += options_for_select(priority_states, selected)
25
- countries += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
28
+ states += options_for_select(priority_states, selected)
29
+ states += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
26
30
  end
27
- countries = countries + options_for_select([['Australian Capital Territory', 'ACT'],['New South Wales', 'NSW'],['Northern Territory', 'NT'],['Queensland', 'QLD'],['South Australia', 'SA'],['Tasmania', 'TAS'],['Victoria', 'VIC'],['Western Australia', 'WA']], selected)
31
+ states = states + options_for_select([['Australian Capital Territory', 'ACT'],['New South Wales', 'NSW'],['Northern Territory', 'NT'],['Queensland', 'QLD'],['South Australia', 'SA'],['Tasmania', 'TAS'],['Victoria', 'VIC'],['Western Australia', 'WA']], selected)
28
32
 
29
33
  html_options = html_options.stringify_keys
30
34
  add_default_name_and_id(html_options)
31
35
 
32
- content_tag(:select, countries.html_safe, html_options)
36
+ content_tag(:select, states.html_safe, html_options)
33
37
  end
34
38
  end
35
39
 
@@ -1,3 +1,3 @@
1
1
  module AuStateSelect
2
- VERSION = "1.1"
2
+ VERSION = "1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: au_state_select
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Zhang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler