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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
495d27be
Commit
495d27be
authored
Jun 07, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show category search content in the search dropdown.
parent
5b64e486
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
5 deletions
+44
-5
app/assets/javascripts/search_autocomplete.js.coffee
app/assets/javascripts/search_autocomplete.js.coffee
+44
-5
No files found.
app/assets/javascripts/search_autocomplete.js.coffee
View file @
495d27be
...
...
@@ -67,8 +67,14 @@ class @SearchAutocomplete
getData
:
(
term
,
callback
)
->
_this
=
@
# Do not trigger request if input is empty
return
if
@
searchInput
.
val
()
is
''
unless
term
return
unless
@
hasLocationBadge
()
if
contents
=
@
getCategoryContents
()
@
searchInput
.
data
(
'glDropdown'
).
filter
.
options
.
callback
contents
@
enableAutocomplete
()
return
# Prevent multiple ajax calls
return
if
@
loadingSuggestions
...
...
@@ -122,6 +128,27 @@ class @SearchAutocomplete
).
always
->
_this
.
loadingSuggestions
=
false
getCategoryContents
:
->
userId
=
gon
.
current_user_id
projectSlug
=
gl
.
utils
.
getProjectSlug
()
projectOptions
=
gl
.
projectOptions
[
projectSlug
]
return
null
if
not
projectSlug
or
not
projectOptions
{
issuesPath
,
mrPath
,
projectName
}
=
projectOptions
return
[
{
header
:
"Go to in
#{
projectName
}
"
}
{
text
:
'Issues assigned to me'
,
url
:
"
#{
issuesPath
}
/?assignee_id=
#{
userId
}
"
}
{
text
:
"Issues I've created"
,
url
:
"
#{
issuesPath
}
/?author_id=
#{
userId
}
"
}
'separator'
{
text
:
'Merge requests assigned to me'
,
url
:
"
#{
mrPath
}
/?assignee_id=
#{
userId
}
"
}
{
text
:
"Merge requests I've created"
,
url
:
"
#{
mrPath
}
/?author_id=
#{
userId
}
"
}
]
serializeState
:
->
{
# Search Criteria
...
...
@@ -209,6 +236,13 @@ class @SearchAutocomplete
@
isFocused
=
true
@
wrap
.
addClass
(
'search-active'
)
if
@
hasLocationBadge
()
and
@
getValue
()
is
''
@
getData
()
getValue
:
->
return
@
searchInput
.
val
()
onClearInputClick
:
(
e
)
=>
e
.
preventDefault
()
@
searchInput
.
val
(
''
).
focus
()
...
...
@@ -229,6 +263,10 @@ class @SearchAutocomplete
@
locationBadgeEl
.
text
(
badgeText
).
show
()
@
wrap
.
addClass
(
'has-location-badge'
)
hasLocationBadge
:
->
return
@
wrap
.
is
'.has-location-badge'
restoreOriginalState
:
->
inputs
=
Object
.
keys
@
originalState
...
...
@@ -257,13 +295,14 @@ class @SearchAutocomplete
@
getElement
(
"#
#{
input
}
"
).
val
(
''
)
removeLocationBadge
:
->
@
locationBadgeEl
.
hide
()
# Reset state
@
locationBadgeEl
.
hide
()
@
resetSearchState
()
@
wrap
.
removeClass
(
'has-location-badge'
)
@
disableAutocomplete
()
disableAutocomplete
:
->
@
searchInput
.
addClass
(
'disabled'
)
...
...
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