Newer
Older
dmpopidor / app / views / phases / _note.html.erb
  <% if answer.present? && answer.notes.any? %>
    <% notes = answer.notes.all.to_a.sort! {|x,y| y.updated_at <=> x.updated_at } %>
    <% questionid = question.id %>
    <%= hidden_field_tag :question_id, questionid, class: "question_id" %>

    <!-- add note -->
    <div id="add_comment_button_top_div_<%= questionid %>" class="move_2_right" >
      <%= link_to _('Add a comment'),
          "#question-form-#{questionid}",
          class: "link-as-button add_comment_button right",
          onclick: "add_note_button(#{questionid})",
          role: "button"
      %>
    </div>

    <div class="div_clear"></div>

    <!-- list of notes, view and edit a note -->
    <%= render :partial => "/notes/list", locals: {question_id: question.id, notes: notes, plan: plan} %>


    <div class="div_clear"></div>

    <!-- add a note block -->
    <div id="add_comment_block_div_<%= questionid %>" style="display: none">
      <%= render :partial => "/notes/add", locals: {answer: answer, question: question, plan_id: plan.id }%>
    </div>
  <% else%>
    <%= render :partial => "/notes/add", locals: {answer: answer, question: question, plan_id: plan.id }%>
  <% end%>