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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
5f4ce722
Commit
5f4ce722
authored
Apr 06, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display clear button only if input has a value
parent
ee87d15c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
app/assets/javascripts/search_autocomplete.js.coffee
app/assets/javascripts/search_autocomplete.js.coffee
+4
-3
app/assets/stylesheets/pages/search.scss
app/assets/stylesheets/pages/search.scss
+8
-8
No files found.
app/assets/javascripts/search_autocomplete.js.coffee
View file @
5f4ce722
...
@@ -142,7 +142,7 @@ class @SearchAutocomplete
...
@@ -142,7 +142,7 @@ class @SearchAutocomplete
@
searchInput
.
on
'keyup'
,
@
onSearchInputKeyUp
@
searchInput
.
on
'keyup'
,
@
onSearchInputKeyUp
@
searchInput
.
on
'click'
,
@
onSearchInputClick
@
searchInput
.
on
'click'
,
@
onSearchInputClick
@
searchInput
.
on
'focus'
,
@
onSearchInputFocus
@
searchInput
.
on
'focus'
,
@
onSearchInputFocus
@
clearInput
.
on
'click'
,
@
on
RemoveLocation
Click
@
clearInput
.
on
'click'
,
@
on
ClearInput
Click
onDocumentClick
:
(
e
)
=>
onDocumentClick
:
(
e
)
=>
if
not
$
.
contains
(
@
dropdown
[
0
],
e
.
target
)
and
@
isFocused
if
not
$
.
contains
(
@
dropdown
[
0
],
e
.
target
)
and
@
isFocused
...
@@ -189,6 +189,8 @@ class @SearchAutocomplete
...
@@ -189,6 +189,8 @@ class @SearchAutocomplete
# We should display the menu only when input is not empty
# We should display the menu only when input is not empty
@
enableAutocomplete
()
@
enableAutocomplete
()
@
wrap
.
toggleClass
'has-value'
,
!!
e
.
target
.
value
# Avoid falsy value to be returned
# Avoid falsy value to be returned
return
return
...
@@ -200,9 +202,8 @@ class @SearchAutocomplete
...
@@ -200,9 +202,8 @@ class @SearchAutocomplete
@
isFocused
=
true
@
isFocused
=
true
@
wrap
.
addClass
(
'search-active'
)
@
wrap
.
addClass
(
'search-active'
)
on
RemoveLocation
Click
:
(
e
)
=>
on
ClearInput
Click
:
(
e
)
=>
e
.
preventDefault
()
e
.
preventDefault
()
@
removeLocationBadge
()
@
searchInput
.
val
(
''
).
focus
()
@
searchInput
.
val
(
''
).
focus
()
onSearchInputBlur
:
(
e
)
=>
onSearchInputBlur
:
(
e
)
=>
...
...
app/assets/stylesheets/pages/search.scss
View file @
5f4ce722
...
@@ -144,16 +144,16 @@
...
@@ -144,16 +144,16 @@
color
:
$location-icon-active-color
;
color
:
$location-icon-active-color
;
}
}
}
}
}
&
.has-location-badg
e
{
&
.has-valu
e
{
.search-icon
{
.search-icon
{
display
:
none
;
display
:
none
;
}
}
.clear-icon
{
.clear-icon
{
cursor
:
pointer
;
cursor
:
pointer
;
display
:
block
;
display
:
block
;
}
}
}
}
}
...
...
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