scinote-web/app/views/reports/elements/_result_comments_element.html.erb
2019-06-14 16:20:13 +02:00

37 lines
1.8 KiB
Text

<% if result.blank? and @result.present? then result = @result end %>
<% if order.blank? and @order.present? then order = @order end %>
<% comments = result.result_comments.order(created_at: order) %>
<% timestamp = Time.current + 1.year %>
<div class="report-element report-comments-element report-result-comments-element" data-ts="<%= timestamp.to_i %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-type="result_comments" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-name="<%=t "projects.reports.elements.result_comments.sidebar_name" %>" data-icon-class="fas fa-comment">
<div class="report-element-header">
<div class="row">
<div class="pull-left comments-icon">
<span class="fas fa-comment"></span>
</div>
<div class="pull-left comments-name">
<%=t "projects.reports.elements.result_comments.name", result: result.name %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true, show_move_up: false, show_move_down: false } %>
</div>
</div>
</div>
<div class="report-element-body">
<div class="row">
<div class="col-xs-12 comments-container simple">
<% if comments.count == 0 %>
<em><%=t "projects.reports.elements.result_comments.no_comments" %></em>
<% else %>
<ul class="no-style content-comments">
<% comments.each do |comment| %>
<%= render partial: 'shared/comments/item.html.erb', locals: { comment: comment, readonly: true, report: true } %>
<% end %>
</ul>
<% end %>
</div>
</div>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>