Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
b1411e90
Commit
b1411e90
authored
Sep 02, 2014
by
Charles Bushong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing some formatting for the Hound, modifying some UI text
parent
4cca1b05
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
app/views/search/_snippet_filter.html.haml
app/views/search/_snippet_filter.html.haml
+1
-1
lib/gitlab/snippet_search_results.rb
lib/gitlab/snippet_search_results.rb
+7
-7
No files found.
app/views/search/_snippet_filter.html.haml
View file @
b1411e90
...
@@ -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'
)}
...
...
lib/gitlab/snippet_search_results.rb
View file @
b1411e90
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment