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
Boxiang Sun
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
Show 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
...
@@ -67,8 +67,14 @@ class @SearchAutocomplete
getData
:
(
term
,
callback
)
->
getData
:
(
term
,
callback
)
->
_this
=
@
_this
=
@
# Do not trigger request if input is empty
unless
term
return
if
@
searchInput
.
val
()
is
''
return
unless
@
hasLocationBadge
()
if
contents
=
@
getCategoryContents
()
@
searchInput
.
data
(
'glDropdown'
).
filter
.
options
.
callback
contents
@
enableAutocomplete
()
return
# Prevent multiple ajax calls
# Prevent multiple ajax calls
return
if
@
loadingSuggestions
return
if
@
loadingSuggestions
...
@@ -122,6 +128,27 @@ class @SearchAutocomplete
...
@@ -122,6 +128,27 @@ class @SearchAutocomplete
).
always
->
).
always
->
_this
.
loadingSuggestions
=
false
_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
:
->
serializeState
:
->
{
{
# Search Criteria
# Search Criteria
...
@@ -209,6 +236,13 @@ class @SearchAutocomplete
...
@@ -209,6 +236,13 @@ class @SearchAutocomplete
@
isFocused
=
true
@
isFocused
=
true
@
wrap
.
addClass
(
'search-active'
)
@
wrap
.
addClass
(
'search-active'
)
if
@
hasLocationBadge
()
and
@
getValue
()
is
''
@
getData
()
getValue
:
->
return
@
searchInput
.
val
()
onClearInputClick
:
(
e
)
=>
onClearInputClick
:
(
e
)
=>
e
.
preventDefault
()
e
.
preventDefault
()
@
searchInput
.
val
(
''
).
focus
()
@
searchInput
.
val
(
''
).
focus
()
...
@@ -229,6 +263,10 @@ class @SearchAutocomplete
...
@@ -229,6 +263,10 @@ class @SearchAutocomplete
@
locationBadgeEl
.
text
(
badgeText
).
show
()
@
locationBadgeEl
.
text
(
badgeText
).
show
()
@
wrap
.
addClass
(
'has-location-badge'
)
@
wrap
.
addClass
(
'has-location-badge'
)
hasLocationBadge
:
->
return
@
wrap
.
is
'.has-location-badge'
restoreOriginalState
:
->
restoreOriginalState
:
->
inputs
=
Object
.
keys
@
originalState
inputs
=
Object
.
keys
@
originalState
...
@@ -257,13 +295,14 @@ class @SearchAutocomplete
...
@@ -257,13 +295,14 @@ class @SearchAutocomplete
@
getElement
(
"#
#{
input
}
"
).
val
(
''
)
@
getElement
(
"#
#{
input
}
"
).
val
(
''
)
removeLocationBadge
:
->
removeLocationBadge
:
->
@
locationBadgeEl
.
hide
()
# Reset state
@
locationBadgeEl
.
hide
()
@
resetSearchState
()
@
resetSearchState
()
@
wrap
.
removeClass
(
'has-location-badge'
)
@
wrap
.
removeClass
(
'has-location-badge'
)
@
disableAutocomplete
()
disableAutocomplete
:
->
disableAutocomplete
:
->
@
searchInput
.
addClass
(
'disabled'
)
@
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