Commit b1411e90 authored by Charles Bushong's avatar Charles Bushong

Changing some formatting for the Hound, modifying some UI text

parent 4cca1b05
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%li{class: ("active" if @scope == 'snippet_blobs')} %li{class: ("active" if @scope == 'snippet_blobs')}
= link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do
%i.icon-code %i.icon-code
Code Snippet Contents
.pull-right .pull-right
= @search_results.snippet_blobs_count = @search_results.snippet_blobs_count
%li{class: ("active" if @scope == 'snippet_titles')} %li{class: ("active" if @scope == 'snippet_titles')}
......
...@@ -37,10 +37,10 @@ module Gitlab ...@@ -37,10 +37,10 @@ module Gitlab
end end
def snippet_blobs def snippet_blobs
matching_snippets = Snippet.where(id: limit_snippet_ids).search_code(query).order('updated_at DESC') search = Snippet.where(id: limit_snippet_ids).search_code(query)
matching_snippets = matching_snippets.to_a search = search.order('updated_at DESC').to_a
snippets = [] snippets = []
matching_snippets.each { |e| snippets << chunk_snippet(e) } search.each { |e| snippets << chunk_snippet(e) }
snippets snippets
end end
...@@ -58,14 +58,14 @@ module Gitlab ...@@ -58,14 +58,14 @@ module Gitlab
surrounding_lines = 3 surrounding_lines = 3
used_lines = [] used_lines = []
lined_content = snippet.content.split("\n") lined_content = snippet.content.split("\n")
lined_content.each_with_index { |line, line_number| lined_content.each_with_index do |line, line_number|
used_lines.concat bounded_line_numbers( used_lines.concat bounded_line_numbers(
line_number, line_number,
0, 0,
lined_content.size, lined_content.size,
surrounding_lines surrounding_lines
) if line.include?(query) ) if line.include?(query)
} end
used_lines = used_lines.uniq.sort used_lines = used_lines.uniq.sort
...@@ -73,7 +73,7 @@ module Gitlab ...@@ -73,7 +73,7 @@ module Gitlab
snippet_chunks = [] snippet_chunks = []
snippet_start_line = 0 snippet_start_line = 0
last_line = -1 last_line = -1
used_lines.each { |line_number| used_lines.each do |line_number|
if last_line < 0 if last_line < 0
snippet_start_line = line_number snippet_start_line = line_number
snippet_chunk << lined_content[line_number] snippet_chunk << lined_content[line_number]
...@@ -88,7 +88,7 @@ module Gitlab ...@@ -88,7 +88,7 @@ module Gitlab
snippet_start_line = line_number snippet_start_line = line_number
end end
last_line = line_number last_line = line_number
} end
snippet_chunks << { snippet_chunks << {
data: snippet_chunk.join("\n"), data: snippet_chunk.join("\n"),
start_line: snippet_start_line + 1 start_line: snippet_start_line + 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment