Browse Source

Render html from JSON questions (#33)

* Render html from questions with example

* Render html for all question types
pull/35/head
kosiakkatrina 3 years ago committed by GitHub
parent
commit
0aa8d88ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/views/form/_checkbox_question.html.erb
  2. 2
      app/views/form/_date_question.html.erb
  3. 2
      app/views/form/_numeric_question.html.erb
  4. 2
      app/views/form/_radio_question.html.erb
  5. 2
      app/views/form/_text_question.html.erb
  6. 2
      config/forms/2021_2022.json

2
app/views/form/_checkbox_question.html.erb

@ -1,5 +1,5 @@
<%= f.govuk_check_boxes_fieldset question_key, <%= f.govuk_check_boxes_fieldset question_key,
legend: { text: question["header"], size: "l" }, legend: { text: question["header"].html_safe, size: "l" },
hint: { text: question["hint_text"] } do %> hint: { text: question["hint_text"] } do %>
<% question["answer_options"].map do |key, val| %> <% question["answer_options"].map do |key, val| %>

2
app/views/form/_date_question.html.erb

@ -1,5 +1,5 @@
<%= f.govuk_date_field question_key, <%= f.govuk_date_field question_key,
hint: { text: question["hint_text"] }, hint: { text: question["hint_text"] },
legend: { text: question["header"], size: "l"}, legend: { text: question["header"].html_safe, size: "l"},
width: 20 width: 20
%> %>

2
app/views/form/_numeric_question.html.erb

@ -1,5 +1,5 @@
<%= f.govuk_number_field question_key, <%= f.govuk_number_field question_key,
hint: { text: question["hint_text"] }, hint: { text: question["hint_text"] },
label: { text: question["header"], size: "l"}, label: { text: question["header"].html_safe, size: "l"},
min: question["min"], max: question["max"], step: question["step"], width: 20 min: question["min"], max: question["max"], step: question["step"], width: 20
%> %>

2
app/views/form/_radio_question.html.erb

@ -1,5 +1,5 @@
<%= f.govuk_radio_buttons_fieldset question_key, <%= f.govuk_radio_buttons_fieldset question_key,
legend: { text: question["header"], size: "l" }, legend: { text: question["header"].html_safe, size: "l" },
hint: { text: question["hint_text"] }, hint: { text: question["hint_text"] },
small: (question["answer_options"].size > 5) do %> small: (question["answer_options"].size > 5) do %>

2
app/views/form/_text_question.html.erb

@ -1,5 +1,5 @@
<%= f.govuk_text_field question_key, <%= f.govuk_text_field question_key,
hint: { text: question["hint_text"] }, hint: { text: question["hint_text"] },
label: { text: question["header"], size: "l"}, label: { text: question["header"].html_safe, size: "l"},
width: 20 width: 20
%> %>

2
config/forms/2021_2022.json

@ -337,7 +337,7 @@
"description": "", "description": "",
"questions":{ "questions":{
"medical_conditions": { "medical_conditions": {
"header": "Does anyone in the household have a physical condition, mental health condition, or other illness that they expect to last for 12 months or more?", "header": "Does anyone in the household have any of the following that they expect to last for 12 months or more:<ul><li>Physical Condition</li><li>Mental Health Condition</li><li>Other Illness</li></ul>",
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {

Loading…
Cancel
Save