BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0b76f655
Commit
0b76f655
authored
Mar 21, 2017
by
Alfredo Sumaran
Committed by
Lin Jen-Shin
Mar 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'add-filter-focus-style' into 'master'
Add filter focus for filtered search visual tokens See merge request !9875
parent
d950c6d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
4 deletions
+52
-4
filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+26
-0
filters.scss
app/assets/stylesheets/framework/filters.scss
+14
-4
filtered_search_manager_spec.js
...vascripts/filtered_search/filtered_search_manager_spec.js
+12
-0
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
0b76f655
...
...
@@ -37,6 +37,8 @@
this
.
unselectEditTokensWrapper
=
this
.
unselectEditTokens
.
bind
(
this
);
this
.
editTokenWrapper
=
this
.
editToken
.
bind
(
this
);
this
.
tokenChange
=
this
.
tokenChange
.
bind
(
this
);
this
.
addInputContainerFocusWrapper
=
this
.
addInputContainerFocus
.
bind
(
this
);
this
.
removeInputContainerFocusWrapper
=
this
.
removeInputContainerFocus
.
bind
(
this
);
this
.
filteredSearchInput
.
form
.
addEventListener
(
'submit'
,
this
.
handleFormSubmit
);
this
.
filteredSearchInput
.
addEventListener
(
'input'
,
this
.
setDropdownWrapper
);
...
...
@@ -47,11 +49,13 @@
this
.
filteredSearchInput
.
addEventListener
(
'keyup'
,
this
.
checkForBackspaceWrapper
);
this
.
filteredSearchInput
.
addEventListener
(
'click'
,
this
.
tokenChange
);
this
.
filteredSearchInput
.
addEventListener
(
'keyup'
,
this
.
tokenChange
);
this
.
filteredSearchInput
.
addEventListener
(
'focus'
,
this
.
addInputContainerFocusWrapper
);
this
.
tokensContainer
.
addEventListener
(
'click'
,
FilteredSearchManager
.
selectToken
);
this
.
tokensContainer
.
addEventListener
(
'dblclick'
,
this
.
editTokenWrapper
);
this
.
clearSearchButton
.
addEventListener
(
'click'
,
this
.
clearSearchWrapper
);
document
.
addEventListener
(
'click'
,
gl
.
FilteredSearchVisualTokens
.
unselectTokens
);
document
.
addEventListener
(
'click'
,
this
.
unselectEditTokensWrapper
);
document
.
addEventListener
(
'click'
,
this
.
removeInputContainerFocusWrapper
);
document
.
addEventListener
(
'keydown'
,
this
.
removeSelectedTokenWrapper
);
}
...
...
@@ -65,11 +69,13 @@
this
.
filteredSearchInput
.
removeEventListener
(
'keyup'
,
this
.
checkForBackspaceWrapper
);
this
.
filteredSearchInput
.
removeEventListener
(
'click'
,
this
.
tokenChange
);
this
.
filteredSearchInput
.
removeEventListener
(
'keyup'
,
this
.
tokenChange
);
this
.
filteredSearchInput
.
removeEventListener
(
'focus'
,
this
.
addInputContainerFocusWrapper
);
this
.
tokensContainer
.
removeEventListener
(
'click'
,
FilteredSearchManager
.
selectToken
);
this
.
tokensContainer
.
removeEventListener
(
'dblclick'
,
this
.
editTokenWrapper
);
this
.
clearSearchButton
.
removeEventListener
(
'click'
,
this
.
clearSearchWrapper
);
document
.
removeEventListener
(
'click'
,
gl
.
FilteredSearchVisualTokens
.
unselectTokens
);
document
.
removeEventListener
(
'click'
,
this
.
unselectEditTokensWrapper
);
document
.
removeEventListener
(
'click'
,
this
.
removeInputContainerFocusWrapper
);
document
.
removeEventListener
(
'keydown'
,
this
.
removeSelectedTokenWrapper
);
}
...
...
@@ -113,6 +119,26 @@
}
}
addInputContainerFocus
()
{
const
inputContainer
=
this
.
filteredSearchInput
.
closest
(
'.filtered-search-input-container'
);
if
(
inputContainer
)
{
inputContainer
.
classList
.
add
(
'focus'
);
}
}
removeInputContainerFocus
(
e
)
{
const
inputContainer
=
this
.
filteredSearchInput
.
closest
(
'.filtered-search-input-container'
);
const
isElementInFilteredSearch
=
inputContainer
&&
inputContainer
.
contains
(
e
.
target
);
const
isElementInDynamicFilterDropdown
=
e
.
target
.
closest
(
'.filter-dropdown'
)
!==
null
;
const
isElementInStaticFilterDropdown
=
e
.
target
.
closest
(
'ul[data-dropdown]'
)
!==
null
;
if
(
!
isElementInFilteredSearch
&&
!
isElementInDynamicFilterDropdown
&&
!
isElementInStaticFilterDropdown
&&
inputContainer
)
{
inputContainer
.
classList
.
remove
(
'focus'
);
}
}
static
selectToken
(
e
)
{
const
button
=
e
.
target
.
closest
(
'.selectable'
);
...
...
app/assets/stylesheets/framework/filters.scss
View file @
0b76f655
...
...
@@ -172,16 +172,26 @@
}
}
&
:hover
{
@extend
.form-control
:hover
;
}
&
.focus
,
&
.focus
:hover
{
border-color
:
$dropdown-input-focus-border
;
box-shadow
:
0
0
4px
$search-input-focus-shadow-color
;
}
&
.focus
.fa-filter
{
color
:
$common-gray-dark
;
}
.form-control
{
position
:
relative
;
min-width
:
200px
;
padding
:
5px
25px
6px
0
;
border-color
:
transparent
;
&
:focus
~
.fa-filter
{
color
:
$common-gray-dark
;
}
&
:focus
,
&
:hover
{
outline
:
none
;
...
...
spec/javascripts/filtered_search/filtered_search_manager_spec.js
View file @
0b76f655
...
...
@@ -243,5 +243,17 @@ const FilteredSearchSpecHelper = require('../helpers/filtered_search_spec_helper
expect
(
gl
.
FilteredSearchVisualTokens
.
unselectTokens
).
toHaveBeenCalled
();
});
});
describe
(
'toggleInputContainerFocus'
,
()
=>
{
it
(
'toggles on focus'
,
()
=>
{
input
.
focus
();
expect
(
document
.
querySelector
(
'.filtered-search-input-container'
).
classList
.
contains
(
'focus'
)).
toEqual
(
true
);
});
it
(
'toggles on blur'
,
()
=>
{
input
.
blur
();
expect
(
document
.
querySelector
(
'.filtered-search-input-container'
).
classList
.
contains
(
'focus'
)).
toEqual
(
false
);
});
});
});
})();
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