From 3f51f0cf35cdb87448e77f04560326f66efb2a30 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Tue, 21 Dec 2021 13:25:03 +0000 Subject: [PATCH] Hint text isn't mandatory --- app/views/form/_checkbox_question.html.erb | 2 +- app/views/form/_date_question.html.erb | 2 +- app/views/form/_numeric_question.html.erb | 2 +- app/views/form/_radio_question.html.erb | 2 +- app/views/form/_select_question.html.erb | 2 +- app/views/form/_text_question.html.erb | 2 +- app/views/form/_textarea_question.html.erb | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/form/_checkbox_question.html.erb b/app/views/form/_checkbox_question.html.erb index 89121b376..053d4499e 100644 --- a/app/views/form/_checkbox_question.html.erb +++ b/app/views/form/_checkbox_question.html.erb @@ -1,7 +1,7 @@ <%= f.govuk_check_boxes_fieldset question.id.to_sym, caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, legend: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, - hint: { text: question.hint_text.html_safe } do %> + hint: { text: question.hint_text&.html_safe } do %> <% question.answer_options.map do |key, val| %> <% if key.starts_with?("divider") %> diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb index fd61d7666..b4f107cf6 100644 --- a/app/views/form/_date_question.html.erb +++ b/app/views/form/_date_question.html.erb @@ -1,7 +1,7 @@ <%= f.govuk_date_field question.id.to_sym, caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, legend: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, - hint: { text: question.hint_text.html_safe }, + hint: { text: question.hint_text&.html_safe }, width: 20, **stimulus_html_attributes(question) %> diff --git a/app/views/form/_numeric_question.html.erb b/app/views/form/_numeric_question.html.erb index fc7ce5bf3..905477169 100644 --- a/app/views/form/_numeric_question.html.erb +++ b/app/views/form/_numeric_question.html.erb @@ -1,7 +1,7 @@ <%= f.govuk_number_field question.id.to_sym, caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, label: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, - hint: { text: question.hint_text.html_safe }, + hint: { text: question.hint_text&.html_safe }, min: question.min, max: question.max, step: question.step, width: question.width, :readonly => question.read_only?, **stimulus_html_attributes(question) diff --git a/app/views/form/_radio_question.html.erb b/app/views/form/_radio_question.html.erb index e4b3e3f13..aef21a90d 100644 --- a/app/views/form/_radio_question.html.erb +++ b/app/views/form/_radio_question.html.erb @@ -1,7 +1,7 @@ <%= f.govuk_radio_buttons_fieldset question.id.to_sym, caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, legend: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, - hint: { text: question.hint_text.html_safe } do %> + hint: { text: question.hint_text&.html_safe } do %> <% question.answer_options.map do |key, val| %> <% if key.starts_with?("divider") %> diff --git a/app/views/form/_select_question.html.erb b/app/views/form/_select_question.html.erb index f4ef0ad45..d2eb7e079 100644 --- a/app/views/form/_select_question.html.erb +++ b/app/views/form/_select_question.html.erb @@ -5,5 +5,5 @@ :name, caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, label: { text: question.header, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, - hint: { text: question.hint_text.html_safe } + hint: { text: question.hint_text&.html_safe } %> diff --git a/app/views/form/_text_question.html.erb b/app/views/form/_text_question.html.erb index c992aa74a..76c690787 100644 --- a/app/views/form/_text_question.html.erb +++ b/app/views/form/_text_question.html.erb @@ -1,7 +1,7 @@ <%= f.govuk_text_field question.id.to_sym, caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, label: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, - hint: { text: question.hint_text.html_safe }, + hint: { text: question.hint_text&.html_safe }, width: question.width ? question.width : nil, **stimulus_html_attributes(question) %> diff --git a/app/views/form/_textarea_question.html.erb b/app/views/form/_textarea_question.html.erb index 0cf2099e8..1f062eb9f 100644 --- a/app/views/form/_textarea_question.html.erb +++ b/app/views/form/_textarea_question.html.erb @@ -1,7 +1,7 @@ <%= f.govuk_text_area question.id.to_sym, caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, label: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, - hint: { text: question.hint_text.html_safe }, + hint: { text: question.hint_text&.html_safe }, width: question.width ? question.width : nil, **stimulus_html_attributes(question) %>