debian-mirror-gitlab/app/views/search/results/_snippet_blob.html.haml

53 lines
1.9 KiB
Text
Raw Normal View History

2016-04-02 18:10:28 +05:30
- snippet_blob = chunk_snippet(snippet_blob, @search_term)
- snippet = snippet_blob[:snippet_object]
- snippet_chunks = snippet_blob[:snippet_chunks]
2015-04-26 12:48:37 +05:30
.search-result-row
%span
2016-04-02 18:10:28 +05:30
= snippet.title
2015-04-26 12:48:37 +05:30
by
2016-04-02 18:10:28 +05:30
= link_to user_snippets_path(snippet.author) do
= image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: ''
= snippet.author_name
%span.light #{time_ago_with_tooltip(snippet.created_at)}
2015-04-26 12:48:37 +05:30
%h4.snippet-title
2016-04-02 18:10:28 +05:30
- snippet_path = reliable_snippet_path(snippet)
2015-04-26 12:48:37 +05:30
= link_to snippet_path do
.file-holder
.file-title
%i.fa.fa-file
2016-04-02 18:10:28 +05:30
%strong= snippet.file_name
- if markup?(snippet.file_name)
2015-04-26 12:48:37 +05:30
.file-content.wiki
2016-04-02 18:10:28 +05:30
- snippet_chunks.each do |chunk|
- unless chunk[:data].empty?
= render_markup(snippet.file_name, chunk[:data])
2015-04-26 12:48:37 +05:30
- else
.file-content.code
.nothing-here-block Empty file
- else
2016-02-05 20:25:01 +05:30
.file-content.code.js-syntax-highlight
.line-numbers
2016-04-02 18:10:28 +05:30
- snippet_chunks.each do |chunk|
- unless chunk[:data].empty?
- chunk[:data].lines.to_a.size.times do |index|
- offset = defined?(chunk[:start_line]) ? chunk[:start_line] : 1
2016-02-05 20:25:01 +05:30
- i = index + offset
= link_to snippet_path+"#L#{i}", id: "L#{i}", rel: "#L#{i}", class: "diff-line-num" do
%i.fa.fa-link
= i
2016-04-02 18:10:28 +05:30
- unless snippet == snippet_chunks.last
2016-02-05 20:25:01 +05:30
%a.diff-line-num
= "."
%pre.code
%code
2016-04-02 18:10:28 +05:30
- snippet_chunks.each do |chunk|
- unless chunk[:data].empty?
= chunk[:data]
- unless chunk == snippet_chunks.last
2015-04-26 12:48:37 +05:30
%a
2016-02-05 20:25:01 +05:30
= "..."
- else
.file-content.code
.nothing-here-block Empty file