diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index 9c9f70e..13b475e 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -58,6 +58,7 @@ }).find(p_params[:plan_id]) @question = @answer.question @section = @plan.get_section(@question.section_id) + template = @section.phase.template render json: { "question" => { @@ -66,7 +67,7 @@ "locking" => @stale_answer ? render_to_string(partial: 'answers/locking', locals: { question: @question, answer: @stale_answer, user: @answer.user }, formats: [:html]) : nil, - "form" => render_to_string(partial: 'answers/new_edit', locals: { question: @question, answer: @answer, readonly: false, locking: false }, formats: [:html]), + "form" => render_to_string(partial: 'answers/new_edit', locals: { template: template, question: @question, answer: @answer, readonly: false, locking: false }, formats: [:html]), "answer_status" => render_to_string(partial: 'answers/status', locals: { answer: @answer}, formats: [:html]) }, "section" => { diff --git a/app/views/annotations/_show.html.erb b/app/views/annotations/_show.html.erb index b5085f4..407928a 100644 --- a/app/views/annotations/_show.html.erb +++ b/app/views/annotations/_show.html.erb @@ -1,12 +1,8 @@ <% org = template.org.abbreviation.present? ? template.org.abbreviation : template.org.name %> -<% if example_answer.present? || guidance.present? %> +<% if guidance.present? %> > - <% if example_answer.present? %> -
<%= _('Example answer') %>
-
<%= raw example_answer.text %>
- <% end %> <% if guidance.present? %> -
<%= _('Guidance') %>
+
<%= template.customization_of.nil? ? _('Guidance') : _('%{org} Guidance') % { org: guidance.org.short_name } %>
<%= raw guidance.text %>
<% end %> diff --git a/app/views/answers/_locking.html.erb b/app/views/answers/_locking.html.erb index e47642b..5018ff9 100644 --- a/app/views/answers/_locking.html.erb +++ b/app/views/answers/_locking.html.erb @@ -1,5 +1,6 @@

<%= _('The following answer cannot be saved') %>

- <%= render partial: '/answers/new_edit', locals: { question: question, answer: answer, readonly: true, locking: true } %> + <%# We do not need to re-show example answers in this lock conflict section so leave template nil %> + <%= render partial: '/answers/new_edit', locals: { template: nil, question: question, answer: answer, readonly: true, locking: true } %>

<%= _('since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again.') % { name: user.name} %>

\ No newline at end of file diff --git a/app/views/answers/_new_edit.html.erb b/app/views/answers/_new_edit.html.erb index 14e1513..9d2525d 100644 --- a/app/views/answers/_new_edit.html.erb +++ b/app/views/answers/_new_edit.html.erb @@ -1,4 +1,4 @@ -<%# locals: { question, answer, readonly, locking } %> +<%# locals: { template, question, answer, readonly, locking } %> @@ -64,15 +64,18 @@ <%= f.button(_('Save'), class: "btn btn-default", type: "submit") %> - <% annotation = question.first_example_answer %> - <% if annotation.present? && annotation.text.present? %> -
- - <%="#{annotation.org.abbreviation} "%> <%=_('example answer')%> - -
- <%= raw annotation.text %> + <% annotations = [question.first_example_answer] %> + <% annotations << question.get_example_answer(template.org.id) if template.present? && template.org.present? %> + <% annotations.each do |annotation| %> + <% if annotation.present? && annotation.org.present? %> +
+ + <%="#{annotation.org.abbreviation} "%> <%=_('example answer')%> + +
+ <%= raw annotation.text %> +
-
+ <% end %> <% end %> <% end %> diff --git a/app/views/phases/_edit_plan_answers.html.erb b/app/views/phases/_edit_plan_answers.html.erb index 1c746c2..224227e 100644 --- a/app/views/phases/_edit_plan_answers.html.erb +++ b/app/views/phases/_edit_plan_answers.html.erb @@ -63,7 +63,7 @@
" class="answer-locking">
" class="answer-form"> - <%= render(partial: '/answers/new_edit', locals: { question: question, answer: answer, readonly: readonly, locking: false }) %> + <%= render(partial: '/answers/new_edit', locals: { template: phase.template, question: question, answer: answer, readonly: readonly, locking: false }) %>
" class="mt-10"> <%= render(partial: '/answers/status', locals: { answer: answer }) %>