|
|
@ -4,7 +4,7 @@ class Form::Question |
|
|
|
:conditional_for, :readonly, :answer_options, :page, :check_answer_label, |
|
|
|
:conditional_for, :readonly, :answer_options, :page, :check_answer_label, |
|
|
|
:inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value, |
|
|
|
:inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value, |
|
|
|
:guidance_partial, :prefix, :suffix, :requires_js, :fields_added, :derived, |
|
|
|
:guidance_partial, :prefix, :suffix, :requires_js, :fields_added, :derived, |
|
|
|
:check_answers_card_number, :unresolved_hint_text, :question_number, :plain_label |
|
|
|
:check_answers_card_number, :unresolved_hint_text, :question_number, :hide_question_number_on_page, :plain_label, :error_label |
|
|
|
|
|
|
|
|
|
|
|
module GuidancePosition |
|
|
|
module GuidancePosition |
|
|
|
TOP = 1 |
|
|
|
TOP = 1 |
|
|
@ -41,7 +41,9 @@ class Form::Question |
|
|
|
@check_answers_card_number = hsh["check_answers_card_number"] || 0 |
|
|
|
@check_answers_card_number = hsh["check_answers_card_number"] || 0 |
|
|
|
@unresolved_hint_text = hsh["unresolved_hint_text"] |
|
|
|
@unresolved_hint_text = hsh["unresolved_hint_text"] |
|
|
|
@question_number = hsh["question_number"] |
|
|
|
@question_number = hsh["question_number"] |
|
|
|
|
|
|
|
@hide_question_number_on_page = hsh["hide_question_number_on_page"] || false |
|
|
|
@plain_label = hsh["plain_label"] |
|
|
|
@plain_label = hsh["plain_label"] |
|
|
|
|
|
|
|
@error_label = hsh["error_label"] |
|
|
|
@disable_clearing_if_not_routed_or_dynamic_answer_options = hsh["disable_clearing_if_not_routed_or_dynamic_answer_options"] |
|
|
|
@disable_clearing_if_not_routed_or_dynamic_answer_options = hsh["disable_clearing_if_not_routed_or_dynamic_answer_options"] |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -194,15 +196,15 @@ class Form::Question |
|
|
|
type == "radio" && RADIO_REFUSED_VALUE[id.to_sym]&.include?(value) |
|
|
|
type == "radio" && RADIO_REFUSED_VALUE[id.to_sym]&.include?(value) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def display_label |
|
|
|
def error_display_label |
|
|
|
check_answer_label || header || id.humanize |
|
|
|
error_label || check_answer_label || header || id.humanize |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def unanswered_error_message |
|
|
|
def unanswered_error_message |
|
|
|
return I18n.t("validations.declaration.missing") if id == "declaration" |
|
|
|
return I18n.t("validations.declaration.missing") if id == "declaration" |
|
|
|
return I18n.t("validations.privacynotice.missing") if id == "privacynotice" |
|
|
|
return I18n.t("validations.privacynotice.missing") if id == "privacynotice" |
|
|
|
|
|
|
|
|
|
|
|
I18n.t("validations.not_answered", question: display_label.downcase) |
|
|
|
I18n.t("validations.not_answered", question: error_display_label.downcase) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def suffix_label(log) |
|
|
|
def suffix_label(log) |
|
|
@ -241,8 +243,8 @@ class Form::Question |
|
|
|
selected_answer_option_is_derived?(log) || has_inferred_check_answers_value?(log) |
|
|
|
selected_answer_option_is_derived?(log) || has_inferred_check_answers_value?(log) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def question_number_string(conditional: false) |
|
|
|
def question_number_string(hidden: false) |
|
|
|
if @question_number && !conditional && form.start_date.year >= 2023 |
|
|
|
if @question_number && !hidden && form.start_date.year >= 2023 |
|
|
|
"Q#{@question_number}" |
|
|
|
"Q#{@question_number}" |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|