|
|
@ -8,11 +8,12 @@ |
|
|
|
<% question.answer_options.map do |key, val| %> |
|
|
|
<% question.answer_options.map do |key, val| %> |
|
|
|
<% if key.starts_with?("divider") %> |
|
|
|
<% if key.starts_with?("divider") %> |
|
|
|
<%= f.govuk_radio_divider %> |
|
|
|
<%= f.govuk_radio_divider %> |
|
|
|
|
|
|
|
<% else %> |
|
|
|
|
|
|
|
<% conditional_question = find_conditional_question(@page, question.conditional_for, val) %> |
|
|
|
|
|
|
|
<% if conditional_question.nil? %> |
|
|
|
|
|
|
|
<%= f.govuk_radio_button question.id, val, label: { text: val }, **stimulus_html_attributes(question) %> |
|
|
|
<% else %> |
|
|
|
<% else %> |
|
|
|
<%= f.govuk_radio_button question.id, val, label: { text: val }, **stimulus_html_attributes(question) do %> |
|
|
|
<%= f.govuk_radio_button question.id, val, label: { text: val }, **stimulus_html_attributes(question) do %> |
|
|
|
<% conditional_key = question.conditional_for&.find { |_, cval| cval.include? val }&.first %> |
|
|
|
|
|
|
|
<% if conditional_key %> |
|
|
|
|
|
|
|
<% conditional_question = @page.questions.find { |q| q.id == conditional_key } %> |
|
|
|
|
|
|
|
<%= render partial: "#{conditional_question.type}_question", locals: { question: conditional_question, caption: caption, page_header: page_header, f: f } %> |
|
|
|
<%= render partial: "#{conditional_question.type}_question", locals: { question: conditional_question, caption: caption, page_header: page_header, f: f } %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|