scinote-web/app/views/result_comments/_list.html.erb
Luka Murn 24dd25d9f5 Add edit/delete result comment functionality
Lessons learned during this fix:
Don't use dependant: :destroy on both ends of association
between 2 ActiveRecords, or you will run into stack overflow.
2016-08-25 13:51:31 +02:00

16 lines
536 B
Plaintext

<% day = 366 %>
<% current_day = DateTime.current.strftime('%j').to_i %>
<% comments.each do |comment| %>
<% comment_day = comment.created_at.strftime('%j').to_i %>
<% if comment_day < current_day and comment_day < day %>
<% day = comment.created_at.strftime('%j').to_i %>
<li class="comment-date-separator">
<p class="text-center"><%= comment.created_at.strftime('%d.%m.%Y') %></p>
</li>
<% end %>
<li class="comment">
<%= render 'result_comments/comment.html.erb', comment: comment %>
</li>
<% end %>