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

46 lines
1.7 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
2018-03-27 19:54:05 +05:30
= image_tag avatar_icon_for_user(snippet.author), class: "avatar avatar-inline s16", alt: ''
2016-04-02 18:10:28 +05:30
= snippet.author_name
2017-08-17 22:00:37 +05:30
%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)
2017-08-17 22:00:37 +05:30
.file-holder
.js-file-title.file-title
= link_to snippet_path do
2015-04-26 12:48:37 +05:30
%i.fa.fa-file
2016-04-02 18:10:28 +05:30
%strong= snippet.file_name
2017-08-17 22:00:37 +05:30
- if markup?(snippet.file_name)
2019-05-18 00:54:41 +05:30
.file-content.md.md-file
2017-08-17 22:00:37 +05:30
- snippet_chunks.each do |chunk|
- unless chunk[:data].empty?
2019-03-02 22:35:43 +05:30
= markup(snippet.file_name, chunk[:data])
2017-08-17 22:00:37 +05:30
- else
.file-content.code
2019-03-02 22:35:43 +05:30
.nothing-here-block= _("Empty file")
2017-08-17 22:00:37 +05:30
- else
.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?
2017-08-17 22:00:37 +05:30
- Gitlab::Git::Util.count_lines(chunk[:data]).times do |index|
- offset = defined?(chunk[:start_line]) ? chunk[:start_line] : 1
- 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
.blob-content
- snippet_chunks.each do |chunk|
- unless chunk[:data].empty?
2018-12-13 13:39:08 +05:30
= highlight(snippet.file_name, chunk[:data])
2015-04-26 12:48:37 +05:30
- else
.file-content.code
2019-03-02 22:35:43 +05:30
.nothing-here-block= _("Empty file")