govuk_elements_form_builder 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fd74da74ab30234815107cffece6456ee7aa1c8
4
- data.tar.gz: 0033ba79bac042304bd9d54d3223300c8299f550
3
+ metadata.gz: 475401203a5c26078dbc79f8f6d6c494b01728a5
4
+ data.tar.gz: e61aa54296d87f99ac76edd48fb39cf9279e5ceb
5
5
  SHA512:
6
- metadata.gz: eefccc8724fe53d9c0d0b18c9b0fc6248510e62fafb91d2c22aae4877381a7d5d27473f04a818f47872d880fdb24e3fdd5866d71f0de619fdae2871f90c6a375
7
- data.tar.gz: 998622aee024ff43f0777839a41ae4ceab91548acea038436733df4f60f5794d59a853b0fe0fb36dcd57e494fc95a59173af868d348eb7ce642025392863b070
6
+ metadata.gz: 76a3eaeb0c325a24b1071df6e1d7db2a6c9653b14910b0ef373c4b00a6c1b17ddfa7b87de92877b62ac501761cc217efa68060e13bbc6a095a6313bd04bc01d5
7
+ data.tar.gz: 27f5f53f9da16ab85175ab5410ebc7d1be5e54d8b9d9919b93ec4153bcc16d55cacdb5c5c057148d63ab296613e1e0942a6470f8399d748ce48f2816e2735810
@@ -104,9 +104,17 @@ module GovukElementsFormBuilder
104
104
  def radio_inputs attribute, options
105
105
  choices = options[:choices] || [ :yes, :no ]
106
106
  choices.map do |choice|
107
- label(attribute, class: 'block-label selection-button-radio', value: choice) do |tag|
108
- input = radio_button(attribute, choice)
109
- input + localized_label("#{attribute}.#{choice}")
107
+ value = choice.send(options[:value_method] || :to_s)
108
+ label attribute,
109
+ class: 'block-label selection-button-radio',
110
+ value: value do |tag|
111
+ input = radio_button(attribute, value)
112
+ text = if options.has_key? :text_method
113
+ choice.send(options[:text_method])
114
+ else
115
+ localized_label("#{attribute}.#{choice}")
116
+ end
117
+ input + text
110
118
  end
111
119
  end
112
120
  end
@@ -1,3 +1,3 @@
1
1
  module GovukElementsFormBuilder
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_elements_form_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair Laing
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-14 00:00:00.000000000 Z
12
+ date: 2017-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails