<!-- **Project: DMPRoadmap **Description: This block shows a question, its guidance, and options when multiple choice is selected. **Arguments transferred: 'question' **Copyright: Digital Curation Centre and University of California Curation Center --> <div class="question-div"> <table class="dmp_details_table phase"> <!--Question number --> <tr> <td class="first_template"><%= t('org_admin.questions.question_number_label')%></td> <td><%= question.number%></td> </tr> <!--Question text --> <tr> <td class="first_template"><%= t('org_admin.questions.question_text_label')%></td> <td><%= raw question.text %> </br> <div class="answer-readonly"> <% q_format = question.question_format %> <% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") then%> <ul class='options'> <% if question.options.is_a? Option then %> <li>- <%= question.options.text %></li> <% else %> <% if !question.options.to_a.nil? then %> <% question.options.to_a.sort_by{|op| op['number']}.each do |o| %> <li>- <%= o.text %></li> <%end%> <% end %> <% end %> </ul> <% end %> </div> </td> </tr> <!--Default value --> <%if q_format.title == t("helpers.text_field") || q_format.title == t("helpers.text_area") then %> <%if !question.default_value.nil? then %> <tr> <td class="first_template"><%= t('org_admin.questions.default_value_label')%></td> <td><%= raw question.default_value %></td> </tr> <%end%> <% end %> <!-- Question format --> <tr> <td class="first_template"><%= t('org_admin.questions.answer_format_label')%></td> <td><%= q_format.title %> </br> <% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") then%> <% if question.option_comment_display == true then%> <%= t("org_admin.questions.option_comment_display")%> <%else%> <%= t("org_admin.questions.option_comment_hide")%> <%end%> <%end%> <div class="add_space"></div> </td> </tr> <!-- Suggested answer or Example--> <% if (question.section.version.phase.dmptemplate.org_type != constant("organisation_types.funder") && question.section.organisation_id == current_user.organisation_id ) then%> <% suggested_answer = question.get_suggested_answer(current_user.organisation.id) %> <% if !suggested_answer.nil? && suggested_answer.text != "" then %> <tr> <td class="first_template"> <% if suggested_answer.is_example? then %> <%= t('org_admin.questions.example_answer_label')%> <%else%> <%= t('org_admin.questions.suggested_answer_label')%> <%end%> </td> <td><%= raw suggested_answer.text %></td> </tr> <%end%> <%end%> <!-- Guidance linked to this question --> <%if !question.guidance.nil? then %> <tr> <td class="first_template"><%= t('org_admin.questions.guidance_label')%></td> <td><%= raw question.guidance %></td> </tr> <%end%> <!-- Themes --> <% themes_q = question.themes %> <%if !themes_q.nil? then%> <tr> <td class="first_template"><%= t('org_admin.questions.themes_label')%></td> <td><% i = 1%> <% themes_q.each do |t|%> <%= t.title %> <% if themes_q.count > i then%> , <% i +=1 %> <% end %> <%end%> </td> </tr> <%end%> </table> <br/> <!-- Add suggested or example answers to a funders template--> <% if (question.section.version.phase.dmptemplate.org_type == constant("organisation_types.funder") && question.section.organisation_id != current_user.organisation_id ) then%> <% suggested_answer = question.get_suggested_answer(current_user.organisation.id) %> <% if !suggested_answer.nil? && suggested_answer.text != "" then %> <div id="show_suggested_answer_div_<%= question.id%>"> <%= render :partial => 'show_suggested_answer', locals: {suggested_answer: suggested_answer, question: question} %> </div> <div id="edit_suggested_answer_div_<%= question.id%>" style="display: none"> <%= render :partial => 'edit_suggested_answer', locals: {suggested_answer: suggested_answer, question: question} %> </div> <%end%> <div id="add_suggested_answer_block_<%= question.id%>" style="display: none"> <%= render :partial => 'add_suggested_answer', locals: {question: question} %> </div> <%end%> <br/> <!-- edit question button--> <%if (@edit == 'true'&& question.section.organisation_id == current_user.organisation_id) || (question.section.version.phase.dmptemplate.org_type == constant("organisation_types.funder") && question.section.organisation_id == current_user.organisation_id && current_user.org_type != constant("organisation_types.funder")) then%> <div class="move_2_right"> <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> <%= link_to t("org_admin.questions.question_edit_button"), '# ', :class => "btn btn-primary edit_question_button"%> <% if !question.section.version.published? then%> <%= link_to t("org_admin.questions.question_delete_button"), admin_destroyquestion_dmptemplate_path(:question_id => question.id), :confirm => t("org_admin.questions.delete_message", :question_text => question.text ), :method => :delete, :class => "btn btn-primary"%> <%end%> </div> <%elsif (@edit == 'false' && question.section.organisation_id != current_user.organisation_id )|| (question.section.version.phase.dmptemplate.org_type == constant("organisation_types.funder") && question.section.organisation_id != current_user.organisation_id ) then%> <% suggested_answer = question.get_suggested_answer(current_user.organisation.id) %> <% if suggested_answer.nil? then %> <div id="add_suggested_answer_button_<%= question.id%>"> <div class="move_2_right"> <%= hidden_field_tag :question_id, question.id, :class => "question_id" %> <%= link_to t("org_admin.questions.suggested_or_example_answer_button"), '# ', :class => "btn btn-primary add_suggested_answer_button"%> </div> </div> <%end%> <%end%> <div class="div_clear"></div> </div> <!--guidance block --> <%= render :partial => 'guidance_display', locals: {question: question}%>