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
522ef575
Commit
522ef575
authored
Jun 09, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor search autocomplete to support groups category contents.
parent
7df512d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
app/assets/javascripts/search_autocomplete.js.coffee
app/assets/javascripts/search_autocomplete.js.coffee
+19
-14
No files found.
app/assets/javascripts/search_autocomplete.js.coffee
View file @
522ef575
...
@@ -68,8 +68,6 @@ class @SearchAutocomplete
...
@@ -68,8 +68,6 @@ class @SearchAutocomplete
_this
=
@
_this
=
@
unless
term
unless
term
return
unless
@
hasLocationBadge
()
if
contents
=
@
getCategoryContents
()
if
contents
=
@
getCategoryContents
()
@
searchInput
.
data
(
'glDropdown'
).
filter
.
options
.
callback
contents
@
searchInput
.
data
(
'glDropdown'
).
filter
.
options
.
callback
contents
@
enableAutocomplete
()
@
enableAutocomplete
()
...
@@ -132,17 +130,21 @@ class @SearchAutocomplete
...
@@ -132,17 +130,21 @@ class @SearchAutocomplete
getCategoryContents
:
->
getCategoryContents
:
->
userId
=
gon
.
current_user_id
userId
=
gon
.
current_user_id
projectName
=
'Dashboard'
{
utils
,
projectOptions
,
groupOptions
,
dashboardOptions
}
=
gl
projectSlug
=
gl
.
utils
.
getProjectSlug
()
projectOptions
=
gl
.
projectOptions
?
[
projectSlug
]
if
projectSlug
and
projectOptions
if
utils
.
isInGroupsPage
()
and
groupOptions
{
issuesPath
,
mrPath
,
projectName
}
=
projectOptions
options
=
groupOptions
[
utils
.
getGroupSlug
()]
else
{
issuesPath
,
mrPath
}
=
gl
.
dashboardOptions
else
if
utils
.
isInProjectPage
()
and
projectOptions
options
=
projectOptions
[
utils
.
getProjectSlug
()]
else
if
dashboardOptions
options
=
dashboardOptions
return
[
{
issuesPath
,
mrPath
,
name
}
=
options
{
header
:
"Go to in
#{
projectName
}
"
}
items
=
[
{
header
:
"
#{
name
}
"
}
{
text
:
'Issues assigned to me'
,
url
:
"
#{
issuesPath
}
/?assignee_id=
#{
userId
}
"
}
{
text
:
'Issues assigned to me'
,
url
:
"
#{
issuesPath
}
/?assignee_id=
#{
userId
}
"
}
{
text
:
"Issues I've created"
,
url
:
"
#{
issuesPath
}
/?author_id=
#{
userId
}
"
}
{
text
:
"Issues I've created"
,
url
:
"
#{
issuesPath
}
/?author_id=
#{
userId
}
"
}
'separator'
'separator'
...
@@ -150,6 +152,10 @@ class @SearchAutocomplete
...
@@ -150,6 +152,10 @@ class @SearchAutocomplete
{
text
:
"Merge requests I've created"
,
url
:
"
#{
mrPath
}
/?author_id=
#{
userId
}
"
}
{
text
:
"Merge requests I've created"
,
url
:
"
#{
mrPath
}
/?author_id=
#{
userId
}
"
}
]
]
items
.
splice
0
,
1
unless
name
return
items
serializeState
:
->
serializeState
:
->
{
{
...
@@ -238,8 +244,7 @@ class @SearchAutocomplete
...
@@ -238,8 +244,7 @@ class @SearchAutocomplete
@
isFocused
=
true
@
isFocused
=
true
@
wrap
.
addClass
(
'search-active'
)
@
wrap
.
addClass
(
'search-active'
)
if
@
hasLocationBadge
()
and
@
getValue
()
is
''
@
getData
()
if
@
getValue
()
is
''
@
getData
()
getValue
:
->
return
@
searchInput
.
val
()
getValue
:
->
return
@
searchInput
.
val
()
...
...
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