BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9d9b7882
Commit
9d9b7882
authored
May 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix paginate of blobs, fixed preserve in dev mode for blob results
parent
46daf01a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
11 deletions
+5
-11
search_context.rb
app/contexts/search_context.rb
+1
-8
search_controller.rb
app/controllers/search_controller.rb
+2
-1
_blob.html.haml
app/views/search/_blob.html.haml
+1
-0
_result.html.haml
app/views/search/_result.html.haml
+1
-2
No files found.
app/contexts/search_context.rb
View file @
9d9b7882
...
...
@@ -17,14 +17,7 @@ class SearchContext
project
=
projects
.
first
if
projects
.
length
==
1
if
params
[
:search_code
].
present?
blobs
=
[]
unless
project
.
empty_repo?
blobs
=
project
.
repository
.
search_files
(
query
,
params
[
:repository_ref
])
blobs
=
Kaminari
.
paginate_array
(
blobs
).
page
(
params
[
:page
]).
per
(
20
)
end
result
[
:blobs
]
=
blobs
result
[
:blobs
]
=
project
.
repository
.
search_files
(
query
,
params
[
:repository_ref
])
unless
project
.
empty_repo?
else
result
[
:merge_requests
]
=
MergeRequest
.
where
(
project_id:
project_ids
).
search
(
query
).
limit
(
10
)
result
[
:issues
]
=
Issue
.
where
(
project_id:
project_ids
).
search
(
query
).
limit
(
10
)
...
...
app/controllers/search_controller.rb
View file @
9d9b7882
...
...
@@ -20,6 +20,7 @@ class SearchController < ApplicationController
@merge_requests
=
result
[
:merge_requests
]
@issues
=
result
[
:issues
]
@wiki_pages
=
result
[
:wiki_pages
]
@blobs
=
result
[
:blobs
]
@blobs
=
Kaminari
.
paginate_array
(
result
[
:blobs
]).
page
(
params
[
:page
]).
per
(
20
)
@total_results
=
@projects
.
count
+
@merge_requests
.
count
+
@issues
.
count
+
@wiki_pages
.
count
+
@blobs
.
total_count
end
end
app/views/search/_blob.html.haml
View file @
9d9b7882
...
...
@@ -7,4 +7,5 @@
=
blob
.
filename
.file_content.code.term
%div
{
class:
user_color_scheme_class
}
=
preserve
do
=
raw
blob
.
colorize
(
formatter: :gitlab
,
options:
{
first_line_number:
blob
.
startline
}
)
app/views/search/_result.html.haml
View file @
9d9b7882
%fieldset
%legend
Search results
%span
.cgray
(
#{
@
projects
.
count
+
@merge_requests
.
count
+
@issues
.
count
+
@wiki_pages
.
count
+
@blobs
.
total_count
}
)
%span
.cgray
(
#{
@
total_results
}
)
-
if
@project
%ul
.nav.nav-pills
...
...
@@ -12,7 +12,6 @@
=
link_to
search_path
(
params
.
merge
(
search_code:
nil
))
do
Everything else
.search_results
%ul
.bordered-list
-
@projects
.
each
do
|
project
|
...
...
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