scinote-web/app/views/reports/elements/_result_comments_element.html.erb
Luka Murn 53699193a2 Merge branch 'smart-annotations'
Conflicts:
	app/assets/javascripts/comments.js.erb
	app/assets/javascripts/protocols/index.js
	app/assets/javascripts/protocols/steps.js.erb
	app/assets/javascripts/samples/sample_datatable.js.erb
	app/controllers/my_module_comments_controller.rb
	app/controllers/project_comments_controller.rb
	app/controllers/result_comments_controller.rb
	app/controllers/step_comments_controller.rb
	app/datatables/sample_datatable.rb
	app/views/my_module_comments/_comment.html.erb
	app/views/project_comments/_comment.html.erb
	app/views/projects/show/_experiment.html.erb
	app/views/reports/elements/_experiment_element.html.erb
	app/views/reports/elements/_result_comments_element.html.erb
	app/views/reports/elements/_result_text_element.html.erb
	app/views/reports/elements/_step_checklist_element.html.erb
	app/views/reports/elements/_step_comments_element.html.erb
	app/views/reports/elements/_step_element.html.erb
	app/views/result_comments/_comment.html.erb
	app/views/results/_result_text.html.erb
	app/views/step_comments/_comment.html.erb
	app/views/steps/_step.html.erb
	db/schema.rb
2017-01-24 14:33:23 +01:00

50 lines
2.4 KiB
Plaintext

<% if result.blank? and @result.present? then result = @result end %>
<% if order.blank? and @order.present? then order = @order end %>
<% comments = 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 %>" data-name="<%=t "projects.reports.elements.result_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
<div class="report-element-header">
<div class="row">
<div class="pull-left comments-icon">
<span class="glyphicon glyphicon-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">
<% if comments.count == 0 %>
<em><%=t "projects.reports.elements.result_comments.no_comments" %></em>
<% else %>
<ul class="no-style comments-list">
<% comments.each do |comment| %>
<% comment_ts = comment.created_at %>
<li class="comment" data-ts="<%= comment_ts.to_i %>">
<span class="comment-prefix">
<em><%=t "projects.reports.elements.result_comments.comment_prefix", user: comment.user.full_name, date: l(comment_ts, format: :full_date), time: l(comment_ts, format: :time) %></em>
</span>
<span class="comment-message">
&nbsp;
<%= auto_link(smart_annotation_parser(simple_format(sanitize_input(comment.message))),
link: :urls,
sanitize: false,
html: { target: '_blank' }).html_safe %>
</span>
</li>
<% end %>
</ul>
<% end %>
</div>
</div>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>