<%# locals: { research_outputs, questions, section } %> <% research_outputs.each do |research_output| %> <% section_has_common_answers = research_output.get_main().has_common_answers?(section[:id]) %> <%= research_output.get_main() %> <% if section_has_common_answers == false %> <div class="research-output"> <h3><%= research_output[:name] %></h3> <% end %> <% questions.each do |question| %> <% answer = section_has_common_answers ? @plan.answer(question[:id], false, research_output.get_main().id) : @plan.answer(question[:id], false, research_output[:id]) %> <% blank = answer.present? ? answer.is_blank? : true %> <% options = answer.present? ? answer.question_options : [] %> <% unless @show_unanswered == false && blank %> <div class="question"> <% if !@public_plan && @show_sections_questions%> <p> <h4><%= sanitize question[:text].to_s, scrubber: TableFreeScrubber.new %></h4> </p> <br> <% end %> <%# case where question has not been answered sufficiently to display%> <% if @show_unanswered && (answer.blank? || (options.blank? && blank))%> <p><%= _('Question not answered.') -%></p> <br /> <% else %> <%# case where Question has options %> <% if options.any? %> <ul> <% options.each do |opt| %> <li><%= opt.text %></li> <% end %> </ul> <% end %> <%# case for RDA answer display %> <% if question[:format].rda_metadata? && !blank %> <% ah = answer.answer_hash %> <% if ah['standards'].present? %> <ul> <% ah['standards'].each do |id, title| %> <li><%= title %></li> <% end %> </ul> <% end %> <p><%= sanitize ah['text'] %></p> <%# case for displaying comments OR text %> <% elsif !blank %> <p><%= sanitize answer.text %></p> <% end %> <br /> <% end %> </div> <% end %> <% end %> <!-- questions.each --> <% if !section_has_common_answers %> </div> <!-- .research_output --> <% end %> <% if section_has_common_answers %> <% break %> <!-- break if is research output has common answers, only display the first --> <% end %> <% end %><!-- research_outputs.each -->