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.
16 lines
469 B
16 lines
469 B
3 years ago
|
module ConditionalQuestionsHelper
|
||
|
def conditional_questions_for_page(page)
|
||
|
page["questions"].values.map { |question|
|
||
|
question["conditional_for"]
|
||
|
}.compact.map(&:keys).flatten
|
||
|
end
|
||
|
|
||
|
def display_question_key_div(page_info, question_key)
|
||
|
if conditional_questions_for_page(page_info).include?(question_key)
|
||
|
"<div id=#{question_key}_div style='display:none;'>".html_safe
|
||
|
else
|
||
|
"<div id=#{question_key}_div>".html_safe
|
||
|
end
|
||
|
end
|
||
|
end
|