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
Boxiang Sun
gitlab-ce
Commits
562a09c1
Commit
562a09c1
authored
Mar 08, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
milestone dropdown
parent
d6e5ed8a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
9 deletions
+44
-9
app/assets/javascripts/api.js.coffee
app/assets/javascripts/api.js.coffee
+13
-0
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+1
-1
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+4
-1
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+23
-0
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+3
-7
No files found.
app/assets/javascripts/api.js.coffee
View file @
562a09c1
...
...
@@ -5,6 +5,7 @@
group_projects_path
:
"/api/:version/groups/:id/projects.json"
projects_path
:
"/api/:version/projects.json"
labels_path
:
"/api/:version/projects/:id/labels"
milestones_path
:
"/api/:version/projects/:id/milestones"
group
:
(
group_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
group_path
)
...
...
@@ -74,6 +75,18 @@
).
done
(
labels
)
->
callback
(
labels
)
milestones
:
(
project_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
milestones_path
)
url
=
url
.
replace
(
':id'
,
project_id
)
$
.
ajax
(
url
:
url
data
:
private_token
:
gon
.
api_token
dataType
:
"json"
).
done
(
milestones
)
->
callback
(
milestones
)
# Return group projects list. Filtered by query
groupProjects
:
(
group_id
,
query
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
group_projects_path
)
...
...
app/assets/javascripts/gl_dropdown.js.coffee
View file @
562a09c1
...
...
@@ -148,7 +148,7 @@ class GitLabDropdown
html
=
@
options
.
renderRow
(
data
)
else
selected
=
if
@
options
.
isSelected
then
@
options
.
isSelected
(
data
)
else
false
url
=
if
@
options
.
url
then
@
options
.
url
(
data
)
else
""
url
=
if
@
options
.
url
then
@
options
.
url
(
data
)
else
"
#
"
text
=
if
@
options
.
text
then
@
options
.
text
(
data
)
else
""
cssClass
=
""
;
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
562a09c1
...
...
@@ -2,13 +2,16 @@ class @LabelsSelect
constructor
:
->
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
selectedLabel
=
$
(
dropdown
).
data
(
'selected'
)
$
(
dropdown
).
glDropdown
(
data
:
(
callback
)
->
Api
.
projectLabels
8
,
callback
renderRow
:
(
label
)
->
selected
=
if
label
.
name
is
selectedLabel
then
"is-active"
else
""
"<li>
<a href='#'>
<a href='#'
class='
#{
selected
}
'
>
#{
label
.
name
}
</a>
</li>"
...
...
app/assets/javascripts/milestone_select.js.coffee
0 → 100644
View file @
562a09c1
class
@
MilestoneSelect
constructor
:
->
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
selectedMilestone
=
$
(
dropdown
).
data
(
'selected'
)
$
(
dropdown
).
glDropdown
(
data
:
(
callback
)
->
Api
.
milestones
projectId
,
callback
filterable
:
true
search
:
fields
:
[
'name'
]
selectable
:
true
fieldName
:
$
(
dropdown
).
data
(
'field-name'
)
text
:
(
milestone
)
->
milestone
.
title
id
:
(
milestone
)
->
milestone
.
title
isSelected
:
(
milestone
)
->
milestone
.
title
is
selectedMilestone
clicked
:
->
$
(
dropdown
).
parents
(
'form'
).
submit
()
)
app/views/shared/issuable/_filter.html.haml
View file @
562a09c1
...
...
@@ -15,13 +15,8 @@
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
=
dropdown_tag
(
"Milestone"
,
title:
"Filter by milestone"
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
field_name:
"milestone_title"
})
do
%ul
-
@project
.
milestones
.
each
do
|
milestone
|
%li
%a
{
href:
"#"
,
data:
{
id:
milestone
.
id
}}
=
milestone
.
name
=
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
=
dropdown_tag
(
"Label"
,
title:
"Filter by label"
,
toggle_class:
"js-label-select"
,
filter:
true
,
dropdown_class:
"dropdown-menu-labels dropdown-menu-selectable"
,
...
...
@@ -55,6 +50,7 @@
:javascript
new
UsersSelect
();
new
LabelsSelect
();
new
MilestoneSelect
();
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
event
.
preventDefault
();
Turbolinks
.
visit
(
this
.
action
+
'
&
'
+
$
(
this
).
serialize
());
...
...
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