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
238328f5
Commit
238328f5
authored
8 years ago
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to pass input filter param
This allow us to set a different input to filter results
parent
761a8d98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+25
-3
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
238328f5
...
...
@@ -2,7 +2,9 @@ class GitLabDropdownFilter
BLUR_KEYCODES
=
[
27
,
40
]
constructor
:
(
@
dropdown
,
@
options
)
->
@
input
=
@
dropdown
.
find
(
".dropdown-input .dropdown-input-field"
)
{
@
input
}
=
@
options
# Key events
timeout
=
""
...
...
@@ -77,14 +79,30 @@ class GitLabDropdown
PAGE_TWO_CLASS
=
"is-page-two"
ACTIVE_CLASS
=
"is-active"
FILTER_INPUT
=
'.dropdown-input .dropdown-input-field'
constructor
:
(
@
el
,
@
options
)
->
self
=
@
@
dropdown
=
$
(
@
el
).
parent
()
# Set Defaults
{
# If no input is passed create a default one
@
filterInput
=
@
$
(
FILTER_INPUT
)
}
=
@
options
self
=
@
# If selector was passed
if
_
.
isString
(
@
filterInput
)
@
filterInput
=
@
$
(
@
filterInput
)
search_fields
=
if
@
options
.
search
then
@
options
.
search
.
fields
else
[];
if
@
options
.
data
# If data is an array
if
_
.
isArray
@
options
.
data
@
fullData
=
@
options
.
data
@
parseData
@
options
.
data
else
# Remote data
...
...
@@ -100,6 +118,7 @@ class GitLabDropdown
# Init filiterable
if
@
options
.
filterable
@
filter
=
new
GitLabDropdownFilter
@
dropdown
,
input
:
@
filterInput
remote
:
@
options
.
filterRemote
query
:
@
options
.
data
keys
:
@
options
.
search
.
fields
...
...
@@ -133,6 +152,9 @@ class GitLabDropdown
if
self
.
options
.
clicked
self
.
options
.
clicked
()
$
:
(
selector
)
->
$
(
selector
,
@
dropdown
)
toggleLoading
:
->
$
(
'.dropdown-menu'
,
@
dropdown
).
toggleClass
LOADING_CLASS
...
...
@@ -167,7 +189,7 @@ class GitLabDropdown
@
remote
.
execute
()
if
@
options
.
filterable
@
dropdown
.
find
(
".dropdown-input-field"
)
.
focus
()
@
filterInput
.
focus
()
hidden
:
=>
if
@
options
.
filterable
...
...
This diff is collapsed.
Click to expand it.
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