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
Tatuya Kamada
gitlab-ce
Commits
0e78d00b
Commit
0e78d00b
authored
Sep 09, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7695 from coverer/search_wiki
Added search wiki feature
parents
04cf0745
9edf6d4d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
2 deletions
+34
-2
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+2
-1
app/views/search/_project_filter.html.haml
app/views/search/_project_filter.html.haml
+6
-0
app/views/search/results/_wiki_blob.html.haml
app/views/search/results/_wiki_blob.html.haml
+9
-0
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+17
-1
No files found.
app/controllers/search_controller.rb
View file @
0e78d00b
...
@@ -10,7 +10,8 @@ class SearchController < ApplicationController
...
@@ -10,7 +10,8 @@ class SearchController < ApplicationController
@search_results
=
if
@project
@search_results
=
if
@project
return
access_denied!
unless
can?
(
current_user
,
:download_code
,
@project
)
return
access_denied!
unless
can?
(
current_user
,
:download_code
,
@project
)
unless
%w(blobs notes issues merge_requests)
.
include?
(
@scope
)
unless
%w(blobs notes issues merge_requests wiki_blobs)
.
include?
(
@scope
)
@scope
=
'blobs'
@scope
=
'blobs'
end
end
...
...
app/views/search/_project_filter.html.haml
View file @
0e78d00b
...
@@ -23,3 +23,9 @@
...
@@ -23,3 +23,9 @@
Comments
Comments
.pull-right
.pull-right
=
@search_results
.
notes_count
=
@search_results
.
notes_count
%li
{
class:
(
"active"
if
@scope
==
'wiki_blobs'
)}
=
link_to
search_filter_path
(
scope:
'wiki_blobs'
)
do
Wiki
.pull-right
=
@search_results
.
wiki_blobs_count
app/views/search/results/_wiki_blob.html.haml
0 → 100644
View file @
0e78d00b
.blob-result
.file-holder
.file-title
=
link_to
project_wiki_path
(
@project
,
wiki_blob
.
filename
)
do
%i
.icon-file
%strong
=
wiki_blob
.
filename
.file-content.code.term
=
render
'shared/file_hljs'
,
blob:
wiki_blob
,
first_line_number:
wiki_blob
.
startline
lib/gitlab/project_search_results.rb
View file @
0e78d00b
...
@@ -14,13 +14,16 @@ module Gitlab
...
@@ -14,13 +14,16 @@ module Gitlab
notes
.
page
(
page
).
per
(
per_page
)
notes
.
page
(
page
).
per
(
per_page
)
when
'blobs'
when
'blobs'
Kaminari
.
paginate_array
(
blobs
).
page
(
page
).
per
(
per_page
)
Kaminari
.
paginate_array
(
blobs
).
page
(
page
).
per
(
per_page
)
when
'wiki_blobs'
Kaminari
.
paginate_array
(
wiki_blobs
).
page
(
page
).
per
(
per_page
)
else
else
super
super
end
end
end
end
def
total_count
def
total_count
@total_count
||=
issues_count
+
merge_requests_count
+
blobs_count
+
notes_count
@total_count
||=
issues_count
+
merge_requests_count
+
blobs_count
+
notes_count
+
wiki_blobs_count
end
end
def
blobs_count
def
blobs_count
...
@@ -31,6 +34,10 @@ module Gitlab
...
@@ -31,6 +34,10 @@ module Gitlab
@notes_count
||=
notes
.
count
@notes_count
||=
notes
.
count
end
end
def
wiki_blobs_count
@wiki_blobs_count
||=
wiki_blobs
.
count
end
private
private
def
blobs
def
blobs
...
@@ -41,6 +48,15 @@ module Gitlab
...
@@ -41,6 +48,15 @@ module Gitlab
end
end
end
end
def
wiki_blobs
if
!
project
.
wiki_enabled?
[]
else
Repository
.
new
(
ProjectWiki
.
new
(
project
).
path_with_namespace
).
search_files
(
query
)
end
end
def
notes
def
notes
Note
.
where
(
project_id:
limit_project_ids
).
search
(
query
).
order
(
'updated_at DESC'
)
Note
.
where
(
project_id:
limit_project_ids
).
search
(
query
).
order
(
'updated_at DESC'
)
end
end
...
...
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