Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
778 B

module QuestionViewHelper
def caption(caption_text, page_header, conditional)
return nil unless caption_text && page_header.blank? && !conditional
{ text: caption_text.html_safe, size: "l" }
end
def legend(question, page_header, conditional)
{
text: [question.question_number_string(conditional:), question.header.html_safe].compact.join(" - "),
size: label_size(page_header, conditional, question),
tag: label_tag(page_header, conditional),
}
end
private
def label_size(page_header, conditional, question)
return if question.plain_label.present?
page_header.blank? && !conditional ? "l" : "m"
end
def label_tag(page_header, conditional)
return "" if conditional
page_header.blank? ? "h1" : "div"
end
end