Browse Source

Enable dividers in radio button and checkbox answer options

pull/23/head
baarkerlounger 3 years ago
parent
commit
50b102e8f9
  1. 14
      app/views/form/_checkbox_question.html.erb
  2. 14
      app/views/form/_radio_question.html.erb
  3. 4
      config/forms/2021_2022.json

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

@ -1,5 +1,15 @@
<% answer_options = question["answer_options"].map { |k, v| OpenStruct.new(id: k.to_i, value: v) } %>
<%= f.govuk_check_boxes_fieldset question_key,
legend: { text: question["header"], size: "l" },
hint: { text: question["hint_text"] } do %>
<% question["answer_options"].map do |key, val| %>
<% if key == "divider" %>
<%= f.govuk_check_box_divider %>
<% else %>
<%= f.govuk_check_box question_key, key, label: { text: val } %>
<% end %>
<% end %>
<% end %>
<%= f.govuk_collection_check_boxes question_key, answer_options, :id, :value, legend: { text: question["header"], size: "l" }, hint: { text: question["hint_text"] } %>
<%= f.hidden_field :previous_page, value: page_key %>
<%= f.hidden_field :case_log_id, value: case_log_id %>

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

@ -1,5 +1,15 @@
<% answer_options = question["answer_options"].map { |k, v| OpenStruct.new(id: k.to_i, value: v) } %>
<%= f.govuk_radio_buttons_fieldset question_key,
legend: { text: question["header"], size: "l" },
hint: { text: question["hint_text"] } do %>
<% question["answer_options"].map do |key, val| %>
<% if key == "divider" %>
<%= f.govuk_radio_divider %>
<% else %>
<%= f.govuk_radio_button question_key, key, label: { text: val } %>
<% end %>
<% end %>
<% end %>
<%= f.govuk_collection_radio_buttons question_key, answer_options, :id, :value, legend: { text: question["header"], size: "l" }, hint: { text: question["hint_text"] } %>
<%= f.hidden_field :previous_page, value: page_key %>
<%= f.hidden_field :case_log_id, value: case_log_id %>

4
config/forms/2021_2022.json

@ -368,7 +368,9 @@
"2": "Level access housing",
"3": "Other disability requirements",
"4": "No disability requirements",
"divider": true,
"5": "Do not know",
"divider": true,
"6": "Prefer not to say"
}
}
@ -393,6 +395,7 @@
"7": "Mental health - such as depression, anxiety, schizophrenia or bipolar",
"8": "Socially or behaviourally - such as those associated with autism spectral disorder (ASD) including Aspergers’ or attention deficit hyperactivity disorder (ADHD))",
"9": "Other",
"divider": true,
"10": "Prefer not to say"
}
}
@ -1550,6 +1553,7 @@
"1": "Living in insanitary or overcrowded or unsatisfactory housing",
"2": "A need to move on medical and welfare grounds (including a disability)",
"3": "A need to move to avoid hardship to themselves or others",
"divider": true,
"4": "Do not know"
}
}

Loading…
Cancel
Save