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
Léo-Paul Géneau
gitlab-ce
Commits
cf3504ed
Commit
cf3504ed
authored
Dec 10, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ajax filter more consistent and only filter when typed
parent
a7ecbf7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
app/assets/javascripts/droplab/droplab_ajax_filter.js
app/assets/javascripts/droplab/droplab_ajax_filter.js
+12
-3
No files found.
app/assets/javascripts/droplab/droplab_ajax_filter.js
View file @
cf3504ed
...
...
@@ -12,7 +12,7 @@ require('../window')(function(w){
this
.
debounceTriggerWrapper
=
this
.
debounceTrigger
.
bind
(
this
);
this
.
hook
.
trigger
.
addEventListener
(
'
keydown.dl
'
,
this
.
debounceTriggerWrapper
);
this
.
hook
.
trigger
.
addEventListener
(
'
focus
'
,
this
.
debounceTriggerWrapper
);
this
.
trigger
();
this
.
trigger
(
true
);
},
notLoading
:
function
notLoading
()
{
...
...
@@ -22,6 +22,7 @@ require('../window')(function(w){
debounceTrigger
:
function
debounceTrigger
(
e
)
{
var
NON_CHARACTER_KEYS
=
[
16
,
17
,
18
,
20
,
37
,
38
,
39
,
40
,
91
,
93
];
var
invalidKeyPressed
=
NON_CHARACTER_KEYS
.
indexOf
(
e
.
detail
.
which
||
e
.
detail
.
keyCode
)
>
-
1
;
var
focusEvent
=
false
;
if
(
invalidKeyPressed
||
this
.
loading
)
{
return
;
}
...
...
@@ -30,10 +31,14 @@ require('../window')(function(w){
clearTimeout
(
this
.
timeout
);
}
this
.
timeout
=
setTimeout
(
this
.
trigger
.
bind
(
this
),
200
);
if
(
e
.
type
===
'
focus
'
)
{
focusEvent
=
true
;
}
this
.
timeout
=
setTimeout
(
this
.
trigger
.
bind
(
this
,
focusEvent
),
200
);
},
trigger
:
function
trigger
()
{
trigger
:
function
trigger
(
getEntireList
=
false
)
{
var
config
=
this
.
hook
.
config
.
droplabAjaxFilter
;
var
searchValue
=
this
.
trigger
.
value
;
...
...
@@ -45,6 +50,10 @@ require('../window')(function(w){
searchValue
=
config
.
searchValueFunction
();
}
if
(
getEntireList
)
{
searchValue
=
''
;
}
if
(
searchValue
===
config
.
searchKey
)
{
return
this
.
list
.
show
();
}
...
...
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