metadata_presenter 0.10.0 → 0.11.0

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
  SHA256:
3
- metadata.gz: 1ef68ecaae97370722eab970f6dd1ce2490c35f762af5bb2ff7addbe51fded02
4
- data.tar.gz: 5a56f15853ed9becc11b70d0d0e1532ead81a098de1f7fbe3a1f1103a60c9a5d
3
+ metadata.gz: f28074c7149c34365903ebb2d3f63f679fe15a9365d9d8d52212bf46781506ae
4
+ data.tar.gz: b5c02391b3978aaadc551076f9b0823c6e73f585d7e401ac5980d976d6e568f2
5
5
  SHA512:
6
- metadata.gz: bccc48c9113831eed3a67fbb8aeb19ebc6f624b1526feb113578f67f4a1d6ab8989ff01f2d9f44176f03e80782fe8313f389979b042d749217b6c2d683dd8557
7
- data.tar.gz: 7d8aabc2e90780a6d01ae263abfc6b93e6dd9b888f3b7c5339b16305e3008feb16f0c4aee41d91429dd8e1e24384fea93c44827e44a093db7b6aff8554b97f18
6
+ metadata.gz: 2b94a8004d81073a597b09b27844d16d5833a8b68a458423afb330fe1fd880d3a4feea508d7f5ec00e290ce75b7f73e8dc3b5094b5276f75c8477241068ba14a
7
+ data.tar.gz: fb7392086d34f13606a4def4b0347190ec45a90fd2f3ec66271b1ef517a2923496e0ce131323ef8b6084491a93d570282204b33a4bf21d4515c0c1185d05fa3e
@@ -3,7 +3,7 @@ module MetadataPresenter
3
3
  def main_h1(component)
4
4
  if component.legend.present?
5
5
  content_tag(:legend, class: 'govuk-fieldset__legend govuk-fieldset__legend--l') do
6
- content_tag(:h1, class: 'govuk-fieldset__heading') do
6
+ content_tag(:h1, class: 'govuk-heading-xl') do
7
7
  component.legend
8
8
  end
9
9
  end
@@ -2,4 +2,18 @@ class MetadataPresenter::Component < MetadataPresenter::Metadata
2
2
  def to_partial_path
3
3
  "metadata_presenter/component/#{type}"
4
4
  end
5
+
6
+ def humanised_title
7
+ self.label || self.legend
8
+ end
9
+
10
+ def items
11
+ metadata.items.map do |item|
12
+ OpenStruct.new(
13
+ id: item['label'],
14
+ name: item['label'],
15
+ description: item['hint']
16
+ )
17
+ end
18
+ end
5
19
  end
@@ -115,7 +115,7 @@ module MetadataPresenter
115
115
  #
116
116
  def error_message_hash
117
117
  {
118
- control: component.label,
118
+ control: component.humanised_title,
119
119
  schema_key.to_sym => component.validation[schema_key]
120
120
  }
121
121
  end
@@ -0,0 +1,9 @@
1
+ <%=
2
+ f.govuk_collection_radio_buttons component.id.to_sym,
3
+ component.items,
4
+ :id,
5
+ :name,
6
+ :description,
7
+ legend: { text: input_title },
8
+ hint: { text: component.hint }
9
+ %>
@@ -31,7 +31,7 @@
31
31
  <% Array(page.components).each do |component| %>
32
32
  <div class="govuk-summary-list__row">
33
33
  <dt class="govuk-summary-list__key">
34
- <%= component.label %>
34
+ <%= component.humanised_title %>
35
35
  </dt>
36
36
 
37
37
  <dd class="govuk-summary-list__value">
@@ -3,7 +3,6 @@
3
3
  "_type": "radios",
4
4
  "errors": {},
5
5
  "hint": "Component hint",
6
- "label": "Component label",
7
6
  "items": [],
8
7
  "name": "component-name",
9
8
  "legend": "Required legend"
@@ -165,6 +165,42 @@
165
165
  "heading": "Family Hobbies",
166
166
  "url": "/family-hobbies"
167
167
  },
168
+ {
169
+ "_uuid": "4251b25e-08de-4dcb-8f2f-dd9848dcdca6",
170
+ "_id": "page.do-you-like-star-wars",
171
+ "_type": "page.singlequestion",
172
+ "components": [
173
+ {
174
+ "_id": "do-you-like-star-wars_radios_1",
175
+ "_type": "radios",
176
+ "errors": {},
177
+ "hint": "Component hint",
178
+ "legend": "Do you like Star Wars?",
179
+ "items": [
180
+ {
181
+ "_id": "do-you-like-star-wars_radio_1",
182
+ "_type": "radio",
183
+ "label": "Only on weekends",
184
+ "hint": "Optional item hint",
185
+ "value": "only-on-weekends"
186
+ },
187
+ {
188
+ "_id": "do-you-like-star-wars_radio_2",
189
+ "_type": "radio",
190
+ "label": "Hell no!",
191
+ "hint": "Optional item hint",
192
+ "value": "hell-no"
193
+ }
194
+ ],
195
+ "name": "do-you-like-star-wars_radios_1",
196
+ "validation": {
197
+ "required": true
198
+ }
199
+ }
200
+ ],
201
+ "heading": "Radio buttons",
202
+ "url": "/do-you-like-star-wars"
203
+ },
168
204
  {
169
205
  "_uuid": "e819d0c2-7062-4997-89cf-44d26d098404",
170
206
  "_id": "page._check-answers",
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metadata_presenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MoJ Online
@@ -248,6 +248,7 @@ files:
248
248
  - app/views/errors/404.html
249
249
  - app/views/layouts/metadata_presenter/application.html.erb
250
250
  - app/views/metadata_presenter/component/_number.html.erb
251
+ - app/views/metadata_presenter/component/_radios.html.erb
251
252
  - app/views/metadata_presenter/component/_text.html.erb
252
253
  - app/views/metadata_presenter/component/_textarea.html.erb
253
254
  - app/views/metadata_presenter/header/show.html.erb