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
Jérome Perrin
gitlab-ce
Commits
15e0ab49
Commit
15e0ab49
authored
May 15, 2014
by
NotSqrt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ability to search in issue descriptions and comments
parent
41ca07e6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
app/services/search/global_service.rb
app/services/search/global_service.rb
+1
-0
app/services/search/project_service.rb
app/services/search/project_service.rb
+4
-2
app/views/search/_project_results.html.haml
app/views/search/_project_results.html.haml
+1
-0
app/views/search/results/_note.html.haml
app/views/search/results/_note.html.haml
+9
-0
No files found.
app/services/search/global_service.rb
View file @
15e0ab49
...
...
@@ -28,6 +28,7 @@ module Search
projects:
[],
merge_requests:
[],
issues:
[],
notes:
[],
total_results:
0
,
}
end
...
...
app/services/search/project_service.rb
View file @
15e0ab49
...
...
@@ -18,8 +18,9 @@ module Search
result
[
:total_results
]
=
blobs
.
total_count
else
result
[
:merge_requests
]
=
project
.
merge_requests
.
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:issues
]
=
project
.
issues
.
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:total_results
]
=
%w(issues merge_requests)
.
sum
{
|
items
|
result
[
items
.
to_sym
].
size
}
result
[
:issues
]
=
project
.
issues
.
where
(
"title like :query OR description like :query "
,
query:
"%
#{
query
}
%"
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:notes
]
=
Note
.
where
(
noteable_type:
'issue'
).
where
(
project_id:
project
.
id
).
where
(
"note like :query"
,
query:
"%
#{
query
}
%"
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:total_results
]
=
%w(issues merge_requests notes)
.
sum
{
|
items
|
result
[
items
.
to_sym
].
size
}
end
result
...
...
@@ -30,6 +31,7 @@ module Search
merge_requests:
[],
issues:
[],
blobs:
[],
notes:
[],
total_results:
0
,
}
end
...
...
app/views/search/_project_results.html.haml
View file @
15e0ab49
...
...
@@ -15,3 +15,4 @@
%ul
.bordered-list
=
render
partial:
"search/results/merge_request"
,
collection:
@search_results
[
:merge_requests
]
=
render
partial:
"search/results/issue"
,
collection:
@search_results
[
:issues
]
=
render
partial:
"search/results/note"
,
collection:
@search_results
[
:notes
]
app/views/search/results/_note.html.haml
0 → 100644
View file @
15e0ab49
%li
note on issue:
=
link_to
[
note
.
project
,
note
.
noteable
]
do
%span
##{note.noteable.iid}
%strong
.term
=
truncate
note
.
noteable
.
title
,
length:
50
%span
.light
(
#{
note
.
project
.
name_with_namespace
}
)
-
if
note
.
noteable
.
closed?
%span
.label
Closed
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