diff --git a/app/views/templates/_edit_annotations.html.erb b/app/views/templates/_edit_annotations.html.erb new file mode 100644 index 0000000..108c19d --- /dev/null +++ b/app/views/templates/_edit_annotations.html.erb @@ -0,0 +1,102 @@ + + +<%= form_for(question, url: admin_updatequestion_template_path(question), html: { method: :put}) do |f| %> +
+ + <%= f.hidden_field :id,{ class: "quest_id" } %> + + + + + + + + + + + + + + + + + + + + + + + +
<%= t("org_admin.questions.question_number_label")%><%= question.number %> +
+
<%= t('org_admin.questions.question_text_label')%><%= raw question.text %> +
+
+ <% 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") %> +
    + <% if question.question_options.is_a? QuestionOption %> +
  • - <%= question.question_options.text %>
  • + <% else %> + <% if !question.question_options.to_a.nil? %> + <% question.question_options.to_a.sort_by{|op| op['number']}.each do |o| %> +
  • - <%= o.text %>
  • + <% end %> + <% end %> + <% end %> +
+ <% end %> +
+
<%= t("org_admin.questions.suggested_or_example_answer_label")%> +
+ <% suggested_answer = question.suggested_answers.find_by_org_id(current_user.org.id) %> + <% if suggested_answer.nil? %> + <% suggested_answer = question.suggested_answers.build %> + <% end %> + <%= f.fields_for :suggested_answers, suggested_answer do |s|%> + <%= s.hidden_field :org_id, value: current_user.org.id %> +
    +
  • <%= s.select :is_example, {t("org_admin.questions.example_answer_label") => true, t("org_admin.questions.suggested_answer_label") => false} %>
  • +
  • <%= s.text_area :text, rows: 5 %> +
  • +
+ <% end %> +
+
+ <%= link_to( image_tag("help_button.png"), "#", class: "suggested_answer_popover", rel: "popover", "data-html" => "true", "data-content" => t("org_admin.questions.suggested_answer_help_text_html"))%> +
+
+
+
<%= t("org_admin.questions.guidance_label")%> +
+ <%= text_area_tag("question-guidance-#{question.id}", question.guidance , class: "tinymce") %> +
+
+ <%= link_to( image_tag("help_button.png"), "#", class: "question_guidance_popover", rel: "popover", "data-html" => "true", "data-content" => t("org_admin.questions.question_guidance_help_text_html"))%> +
+
+
+
+
+ +
+ <%= f.submit t("helpers.submit.save"), class: "btn btn-primary" %> + <% if !question.section.phase.template.published? %> + <%= link_to t("helpers.submit.delete"), admin_destroyquestion_template_path(question_id: question.id), + confirm: t("org_admin.questions.delete_message", question_text: question.text ), method: :delete, class: "btn btn-primary"%> + <% end %> + <%= hidden_field_tag :question_id, question.id, class: "question_id" %> + <%= link_to t("helpers.submit.cancel"), "#", class: "btn cancel cancel_edit_question" %> +
+
+ + + +<%= render partial: "guidance_display", locals: {question: question} %> +<% end %> diff --git a/app/views/templates/_show_question.html.erb b/app/views/templates/_show_question.html.erb index 666512a..8d8579c 100644 --- a/app/views/templates/_show_question.html.erb +++ b/app/views/templates/_show_question.html.erb @@ -120,7 +120,7 @@
- <% if (@edit && question.modifiable) %> + <% if (@edit && question.section.modifiable) || question.section.phase.template.customization_of.present? %>
<%= 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"%> diff --git a/app/views/templates/_show_section.html.erb b/app/views/templates/_show_section.html.erb index 1c652ad..1544b83 100644 --- a/app/views/templates/_show_section.html.erb +++ b/app/views/templates/_show_section.html.erb @@ -29,7 +29,16 @@ <% section_questions.each do |question| %>
- <%= render partial: 'show_question', locals: {question: question}%> +
"> + + <%= render partial: 'show_question', locals: {question: question} %> +
+ <% if section.phase.template.customization_of.present? %> + + <% end %>
<% if last_question_id == question.id %>