summaryrefslogtreecommitdiff
path: root/app/views/search
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/search')
-rw-r--r--app/views/search/results/_blob.html.haml18
-rw-r--r--app/views/search/results/_blob_data.html.haml9
-rw-r--r--app/views/search/results/_wiki_blob.html.haml15
3 files changed, 19 insertions, 23 deletions
diff --git a/app/views/search/results/_blob.html.haml b/app/views/search/results/_blob.html.haml
index de473c23d66..fdcd126e7a3 100644
--- a/app/views/search/results/_blob.html.haml
+++ b/app/views/search/results/_blob.html.haml
@@ -1,13 +1,5 @@
-- file_name, blob = blob
-.blob-result
- .file-holder
- .js-file-title.file-title
- - ref = @search_results.repository_ref
- - blob_link = project_blob_path(@project, tree_join(ref, file_name))
- = link_to blob_link do
- %i.fa.fa-file
- %strong
- = file_name
- - if blob
- .file-content.code.term
- = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, blob_link: blob_link
+- project = find_project_for_result_blob(blob)
+- file_name, blob = parse_search_result(blob)
+- blob_link = project_blob_path(project, tree_join(blob.ref, file_name))
+
+= render partial: 'search/results/blob_data', locals: { blob: blob, project: project, file_name: file_name, blob_link: blob_link }
diff --git a/app/views/search/results/_blob_data.html.haml b/app/views/search/results/_blob_data.html.haml
new file mode 100644
index 00000000000..0115be41ff1
--- /dev/null
+++ b/app/views/search/results/_blob_data.html.haml
@@ -0,0 +1,9 @@
+.blob-result
+ .file-holder
+ .js-file-title.file-title
+ = link_to blob_link do
+ %i.fa.fa-file
+ = search_blob_title(project, file_name)
+ - if blob.data
+ .file-content.code.term
+ = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline
diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml
index 16a0e432d62..4346217c230 100644
--- a/app/views/search/results/_wiki_blob.html.haml
+++ b/app/views/search/results/_wiki_blob.html.haml
@@ -1,10 +1,5 @@
-- wiki_blob = parse_search_result(wiki_blob)
-.blob-result
- .file-holder
- .js-file-title.file-title
- = link_to project_wiki_path(@project, wiki_blob.basename) do
- %i.fa.fa-file
- %strong
- = wiki_blob.basename
- .file-content.code.term
- = render 'shared/file_highlight', blob: wiki_blob, first_line_number: wiki_blob.startline
+- project = find_project_for_result_blob(wiki_blob)
+- file_name, wiki_blob = parse_search_result(wiki_blob)
+- wiki_blob_link = project_wiki_path(project, wiki_blob.basename)
+
+= render partial: 'search/results/blob_data', locals: { blob: wiki_blob, project: project, file_name: file_name, blob_link: wiki_blob_link }