<% results.each do |comment| %>

<% if comment.is_a?(ProjectComment) && comment.project.present? %> <%=t "search.index.comments.project" %> <% elsif comment.is_a?(TaskComment) && comment.my_module.present? %> <%=t "search.index.comments.my_module" %> <% elsif comment.is_a?(StepComment) && comment.step.present? %> <%=t "search.index.comments.step" %> <% elsif comment.is_a?(ResultComment) && comment.result.present? %> <%=t "search.index.comments.result" %> <% end %>

<%= highlight comment.message, @search_query.strip.split(/\s+/) %>

<%=t "search.index.created_by" %> <%= highlight comment.user.full_name, @search_query.strip.split(/\s+/) %>
<%=t "search.index.created_at" %> <%=l comment.created_at, format: :full %>

<% if comment.is_a?(ProjectComment) && comment.project.present? %> <%=t "search.index.project" %> <%= render partial: "search/results/partials/project_text.html.erb", locals: { project: comment.project, link_to_page: :root } %> <% elsif comment.is_a?(TaskComment) && comment.my_module.present? %> <%=t "search.index.module" %> <%= render partial: "search/results/partials/my_module_text.html.erb", locals: { my_module: comment.my_module, link_to_page: :canvas } %> <% elsif comment.is_a?(StepComment) && comment.step.present? %> <%=t "search.index.step" %> <%= render partial: "search/results/partials/step_text.html.erb", locals: { step: comment.step, target: :comment } %> <% elsif comment.is_a?(ResultComment) && comment.result.present? %> <%=t "search.index.result" %> <%= render partial: "search/results/partials/result_text.html.erb", locals: { result: comment.result, target: :comment } %> <% end %>


<% end %>