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
iv
gitlab-ce
Commits
54797957
Commit
54797957
authored
Mar 08, 2016
by
Alfredo Sumaran
Committed by
Jacob Schatz
Mar 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak behaviours
parent
6a7f4a07
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
app/assets/javascripts/search_autocomplete.js.coffee
app/assets/javascripts/search_autocomplete.js.coffee
+15
-7
No files found.
app/assets/javascripts/search_autocomplete.js.coffee
View file @
54797957
...
@@ -25,7 +25,8 @@ class @SearchAutocomplete
...
@@ -25,7 +25,8 @@ class @SearchAutocomplete
@
saveOriginalState
()
@
saveOriginalState
()
if
@
locationBadgeEl
.
is
(
':empty'
)
# If there's no location badge
if
!
@
locationBadgeEl
.
children
().
length
@
createAutocomplete
()
@
createAutocomplete
()
@
bindEvents
()
@
bindEvents
()
...
@@ -65,7 +66,7 @@ class @SearchAutocomplete
...
@@ -65,7 +66,7 @@ class @SearchAutocomplete
createAutocomplete
:
->
createAutocomplete
:
->
@
query
=
"?project_id="
+
@
projectId
+
"&project_ref="
+
@
projectRef
@
query
=
"?project_id="
+
@
projectId
+
"&project_ref="
+
@
projectRef
@
catComplete
=
@
searchInput
.
catcomplete
@
searchInput
.
catcomplete
appendTo
:
'form.navbar-form'
appendTo
:
'form.navbar-form'
source
:
@
autocompletePath
+
@
query
source
:
@
autocompletePath
+
@
query
minLength
:
1
minLength
:
1
...
@@ -96,6 +97,7 @@ class @SearchAutocomplete
...
@@ -96,6 +97,7 @@ class @SearchAutocomplete
# Return false to avoid focus on the next element
# Return false to avoid focus on the next element
return
false
return
false
@
autocomplete
=
@
searchInput
.
data
'customCatcomplete'
bindEvents
:
->
bindEvents
:
->
@
searchInput
.
on
'keydown'
,
@
onSearchInputKeyDown
@
searchInput
.
on
'keydown'
,
@
onSearchInputKeyDown
...
@@ -112,14 +114,19 @@ class @SearchAutocomplete
...
@@ -112,14 +114,19 @@ class @SearchAutocomplete
# Remove tag when pressing backspace and input search is empty
# Remove tag when pressing backspace and input search is empty
if
e
.
keyCode
is
@
keyCode
.
BACKSPACE
and
e
.
currentTarget
.
value
is
''
if
e
.
keyCode
is
@
keyCode
.
BACKSPACE
and
e
.
currentTarget
.
value
is
''
@
removeLocationBadge
()
@
removeLocationBadge
()
@
destroyAutocomplete
()
#
@destroyAutocomplete()
@
searchInput
.
focus
()
@
searchInput
.
focus
()
else
if
e
.
keyCode
is
@
keyCode
.
ESCAPE
else
if
e
.
keyCode
is
@
keyCode
.
ESCAPE
@
restoreOriginalState
()
@
restoreOriginalState
()
else
else
# Create new autocomplete if hasn't been created yet and there's no badge
# Create new autocomplete if hasn't been created yet and there's no badge
if
!
@
catComplete
?
and
@
locationBadgeEl
.
is
(
':empty'
)
if
@
autocomplete
is
undefined
if
!
@
locationBadgeEl
.
children
().
length
@
createAutocomplete
()
@
createAutocomplete
()
else
# There's a badge
if
@
locationBadgeEl
.
children
().
length
@
destroyAutocomplete
()
onSearchInputFocus
:
=>
onSearchInputFocus
:
=>
@
wrap
.
addClass
(
'search-active'
)
@
wrap
.
addClass
(
'search-active'
)
...
@@ -181,5 +188,6 @@ class @SearchAutocomplete
...
@@ -181,5 +188,6 @@ class @SearchAutocomplete
location
.
href
=
result
.
url
location
.
href
=
result
.
url
destroyAutocomplete
:
->
destroyAutocomplete
:
->
@
catComplete
.
destroy
()
if
@
catComplete
?
@
autocomplete
.
destroy
()
if
@
autocomplete
isnt
undefined
@
catComplete
=
null
@
searchInput
.
attr
(
'autocomplete'
,
'off'
)
@
autocomplete
=
undefined
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