gitlab-org--gitlab-foss/app/views/search/results/_snippet_title.html.haml
Phil Hughes 2a60f4dea8 Reduce query count for snippet search
Recudes the number of queries within the snippet search from approx. 50
to approx. 14 by preloading the authors

Part of #27392
2017-02-16 08:47:48 +00:00

23 lines
864 B
Text

.search-result-row
%h4.snippet-title.term
= link_to reliable_snippet_path(snippet_title) do
= truncate(snippet_title.title, length: 60)
- if snippet_title.private?
%span.label.label-gray
%i.fa.fa-lock
private
%span.cgray.monospace.tiny.pull-right.term
= snippet_title.file_name
%small.pull-right.cgray
- if snippet_title.project_id?
= link_to snippet_title.project.name_with_namespace, namespace_project_path(snippet_title.project.namespace, snippet_title.project)
.snippet-info
= snippet_title.to_reference
%span
by
= link_to user_snippets_path(snippet_title.author) do
= image_tag avatar_icon(snippet_title.author), class: "avatar avatar-inline s16", alt: ''
= snippet_title.author_name
%span.light= time_ago_with_tooltip(snippet_title.created_at)