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
8ca880c3
Commit
8ca880c3
authored
Mar 08, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly fitlers remotely
parent
562a09c1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
23 deletions
+64
-23
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+24
-12
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+1
-1
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+2
-2
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+28
-7
app/helpers/dropdowns_helper.rb
app/helpers/dropdowns_helper.rb
+1
-1
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+8
-0
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
8ca880c3
class
GitLabDropdownFilter
BLUR_KEYCODES
=
[
27
,
40
]
constructor
:
(
@
dropdown
,
@
remote
,
@
data
,
@
callback
)
->
constructor
:
(
@
dropdown
,
@
remote
,
@
query
,
@
data
,
@
callback
)
->
@
input
=
@
dropdown
.
find
(
".dropdown-input-field"
)
# Key events
timeout
=
""
@
input
.
on
"keyup"
,
(
e
)
=>
blur_field
=
@
shouldBlur
e
.
keyCode
search_text
=
@
input
.
val
()
clearTimeout
timeout
timeout
=
setTimeout
=>
blur_field
=
@
shouldBlur
e
.
keyCode
search_text
=
@
input
.
val
()
if
blur_field
@
input
.
blur
()
if
blur_field
@
input
.
blur
()
if
@
remote
@
remote
search_text
,
(
data
)
=>
@
callback
(
data
)
else
@
filter
search_text
if
@
remote
@
query
search_text
,
(
data
)
=>
@
callback
(
data
)
else
@
filter
search_text
,
250
shouldBlur
:
(
keyCode
)
->
return
BLUR_KEYCODES
.
indexOf
(
keyCode
)
>=
0
...
...
@@ -38,7 +42,7 @@ class GitLabDropdownRemote
@
options
.
beforeSend
()
# Fetch the data by calling the data funcfion
@
dataEndpoint
(
data
)
=>
@
dataEndpoint
""
,
(
data
)
=>
if
@
options
.
success
@
options
.
success
(
data
)
...
...
@@ -86,13 +90,14 @@ class GitLabDropdown
# Init filiterable
if
@
options
.
filterable
@
filter
=
new
GitLabDropdownFilter
@
dropdown
,
@
options
.
query
,
=>
@
filter
=
new
GitLabDropdownFilter
@
dropdown
,
@
options
.
filterRemote
,
@
options
.
data
,
=>
return
@
fullData
,
(
data
)
=>
@
parseData
data
# Event listeners
$
(
@
el
).
parent
().
on
"shown.bs.dropdown"
,
@
opened
$
(
@
el
).
parent
().
on
"hidden.bs.dropdown"
,
@
hidden
if
@
options
.
selectable
@
dropdown
.
on
"click"
,
"a"
,
(
e
)
->
...
...
@@ -124,6 +129,13 @@ class GitLabDropdown
if
@
remote
@
remote
.
execute
()
if
@
options
.
filterable
@
dropdown
.
find
(
".dropdown-input-field"
).
focus
()
hidden
:
=>
if
@
options
.
filterable
@
dropdown
.
find
(
".dropdown-input-field"
).
blur
().
val
(
""
)
# Render the full menu
renderMenu
:
(
html
)
->
menu_html
=
""
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
8ca880c3
...
...
@@ -5,7 +5,7 @@ class @LabelsSelect
selectedLabel
=
$
(
dropdown
).
data
(
'selected'
)
$
(
dropdown
).
glDropdown
(
data
:
(
callback
)
->
data
:
(
term
,
callback
)
->
Api
.
projectLabels
8
,
callback
renderRow
:
(
label
)
->
selected
=
if
label
.
name
is
selectedLabel
then
"is-active"
else
""
...
...
app/assets/javascripts/milestone_select.js.coffee
View file @
8ca880c3
...
...
@@ -5,11 +5,11 @@ class @MilestoneSelect
selectedMilestone
=
$
(
dropdown
).
data
(
'selected'
)
$
(
dropdown
).
glDropdown
(
data
:
(
callback
)
->
data
:
(
term
,
callback
)
->
Api
.
milestones
projectId
,
callback
filterable
:
true
search
:
fields
:
[
'
nam
e'
]
fields
:
[
'
titl
e'
]
selectable
:
true
fieldName
:
$
(
dropdown
).
data
(
'field-name'
)
text
:
(
milestone
)
->
...
...
app/assets/javascripts/users_select.js.coffee
View file @
8ca880c3
...
...
@@ -6,20 +6,41 @@ class @UsersSelect
$
(
'.js-user-search'
).
each
(
i
,
dropdown
)
=>
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
showNullUser
=
$
(
dropdown
).
data
(
'null-user'
)
showAnyUser
=
$
(
dropdown
).
data
(
'any-user'
)
firstUser
=
$
(
dropdown
).
data
(
'first-user'
)
selectedId
=
$
(
dropdown
).
data
(
'selected'
)
$
(
dropdown
).
glDropdown
(
data
:
(
callback
)
=>
@
users
""
,
(
users
)
=>
if
showNullUser
users
.
unshift
(
name
:
'Unassigned'
,
id
:
0
)
data
:
(
term
,
callback
)
=>
@
users
term
,
(
users
)
=>
if
term
.
length
is
0
if
firstUser
# Move current user to the front of the list
for
obj
,
index
in
users
if
obj
.
username
==
firstUser
users
.
splice
(
index
,
1
)
users
.
unshift
(
obj
)
break
if
showNullUser
users
.
unshift
(
name
:
'Unassigned'
,
id
:
0
)
if
showAnyUser
name
=
showAnyUser
name
=
'Any User'
if
name
==
true
anyUser
=
{
name
:
name
,
id
:
null
}
users
.
unshift
(
anyUser
)
# Send the data back
callback
users
filterable
:
true
filterRemote
:
true
search
:
fields
:
[
'name'
,
'username'
]
selectable
:
true
...
...
app/helpers/dropdowns_helper.rb
View file @
8ca880c3
...
...
@@ -17,7 +17,7 @@ module DropdownsHelper
output
+=
content_tag
:div
,
class:
"dropdown-title"
do
title_output
=
content_tag
(
:span
,
title
)
title_output
+=
content_tag
:button
,
class:
"dropdown-title-button dropdown-menu-close"
,
aria:
{
label:
"close"
}
do
title_output
+=
content_tag
:button
,
class:
"dropdown-title-button dropdown-menu-close"
,
aria:
{
label:
"close"
}
,
type:
"button"
do
icon
(
'times'
)
end
.
html_safe
end
...
...
app/views/shared/issuable/_filter.html.haml
View file @
8ca880c3
...
...
@@ -7,18 +7,26 @@
class:
"check_all_issues left"
.issues-other-filters
.filter-item.inline
-
if
params
[
:author_id
]
=
hidden_field_tag
(
:author_id
,
params
[
:author_id
])
=
dropdown_tag
(
"Author"
,
toggle_class:
"js-user-search"
,
title:
"Filter by author"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search authors"
,
data:
{
any_user:
"Any Author"
,
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
selected:
params
[
:author_id
],
field_name:
"author_id"
})
.filter-item.inline
-
if
params
[
:assignee_id
]
=
hidden_field_tag
(
:assignee_id
,
params
[
:assignee_id
])
=
dropdown_tag
(
"Assignee"
,
toggle_class:
"js-user-search"
,
title:
"Filter by assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable"
,
placeholder:
"Search assignee"
,
data:
{
any_user:
"Any Author"
,
first_user:
true
,
null_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
selected:
params
[
:assignee_id
],
field_name:
"assignee_id"
})
.filter-item.inline.milestone-filter
-
if
params
[
:milestone_title
]
=
hidden_field_tag
(
:milestone_title
,
params
[
:milestone_title
])
=
dropdown_tag
(
"Milestone"
,
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
@project
.
id
})
.filter-item.inline.labels-filter
-
if
params
[
:label_name
]
=
hidden_field_tag
(
:label_name
,
params
[
:label_name
])
=
dropdown_tag
(
"Label"
,
title:
"Filter by label"
,
toggle_class:
"js-label-select"
,
filter:
true
,
dropdown_class:
"dropdown-menu-labels dropdown-menu-selectable"
,
placeholder:
"Search labels"
,
footer_content:
true
,
data:
{
field_name:
"label_name"
,
selected:
params
[
:label_name
],
project_id:
@project
.
id
})
do
%ul
.dropdown-footer-list
...
...
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