scinote-web/app/views/search/results/_comments.html.erb

106 lines
3.2 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% results.each do |comment| %>
<p>
<span class="fas fa-comment"></span>
<% if comment.is_a?(ProjectComment) && comment.project.present? %>
2016-02-12 23:52:43 +08:00
<%=t "search.index.comments.project" %>
<% elsif comment.is_a?(TaskComment) && comment.my_module.present? %>
2016-02-12 23:52:43 +08:00
<%=t "search.index.comments.my_module" %>
<% elsif comment.is_a?(StepComment) && comment.step.present? %>
2016-02-12 23:52:43 +08:00
<%=t "search.index.comments.step" %>
<% elsif comment.is_a?(ResultComment) && comment.result.present? %>
2016-02-12 23:52:43 +08:00
<%=t "search.index.comments.result" %>
<% end %>
</p>
<div class="row">
<p class="chat-bubble col-xs-4">
2016-07-21 19:11:15 +08:00
<%= highlight comment.message, @search_query.strip.split(/\s+/) %>
2016-02-12 23:52:43 +08:00
</p>
</div>
<p>
<span>
<%=t "search.index.created_by" %>
2016-07-21 19:11:15 +08:00
<%= highlight comment.user.full_name, @search_query.strip.split(/\s+/) %>
2016-02-12 23:52:43 +08:00
</span>
<br>
<span>
<%=t "search.index.created_at" %>
<%=l comment.created_at, format: :full %>
</span>
<br>
</p>
<p>
<% if comment.is_a?(ProjectComment) && comment.project.present? %>
2019-07-02 17:21:00 +08:00
<% project = comment.project %>
<% elsif comment.is_a?(TaskComment) && comment.my_module.present? %>
2019-07-02 17:21:00 +08:00
<% my_module = comment.my_module %>
<% experiment = my_module.experiment %>
<% project = experiment.project %>
<% elsif comment.is_a?(StepComment) && comment.step.present? %>
<% step = comment.step %>
<% my_module = step.protocol.my_module %>
<% experiment = my_module.experiment %>
<% project = experiment.project %>
<% elsif comment.is_a?(ResultComment) && comment.result.present? %>
<% result = comment.result %>
<% my_module = result.my_module %>
<% experiment = my_module.experiment %>
<% project = experiment.project %>
<% end %>
<% if result %>
2016-02-12 23:52:43 +08:00
<span>
2019-07-02 17:21:00 +08:00
<%=t "search.index.result" %>
<%= render partial: "search/results/partials/result_text.html.erb",
locals: { result: result, target: :comment } %>
2016-02-12 23:52:43 +08:00
</span>
2019-07-02 17:21:00 +08:00
<br>
<% end %>
<% if step %>
2016-02-12 23:52:43 +08:00
<span>
<%=t "search.index.step" %>
<%= render partial: "search/results/partials/step_text.html.erb",
2019-07-02 17:21:00 +08:00
locals: { step: step, target: :comment } %>
2016-02-12 23:52:43 +08:00
</span>
2019-07-02 17:21:00 +08:00
<br>
<% end %>
<% if my_module %>
2016-02-12 23:52:43 +08:00
<span>
2019-07-02 17:21:00 +08:00
<%=t "search.index.module" %>
<%= render partial: "search/results/partials/my_module_text.html.erb",
locals: { my_module: my_module, link_to_page: :canvas } %>
</span>
<br>
<% end %>
<% if experiment %>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb",
locals: { experiment: experiment } %>
2016-02-12 23:52:43 +08:00
</span>
2019-07-02 17:21:00 +08:00
<br>
2016-02-12 23:52:43 +08:00
<% end %>
2019-07-02 17:21:00 +08:00
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: project, link_to_page: :show } %>
</span>
<br>
<span>
<%=t "search.index.team" %>
<%= render partial: "search/results/partials/team_text.html.erb",
locals: { team: project.team } %>
</span>
2016-02-12 23:52:43 +08:00
</p>
<hr>
<% end %>