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
ff86138d
Commit
ff86138d
authored
Mar 11, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sidebar milestone updatable via JSON
parent
1c8fff96
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
16 deletions
+18
-16
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+15
-7
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-4
app/controllers/projects/milestones_controller.rb
app/controllers/projects/milestones_controller.rb
+0
-1
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+1
-3
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-1
No files found.
app/assets/javascripts/milestone_select.js.coffee
View file @
ff86138d
class
@
MilestoneSelect
class
@
MilestoneSelect
constructor
:
(
@
opts
)
->
constructor
:
()
->
opts
=
@
opts
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
$dropdown
=
$
(
dropdown
)
$dropdown
=
$
(
dropdown
)
projectId
=
$dropdown
.
data
(
'project-id'
)
projectId
=
$dropdown
.
data
(
'project-id'
)
milestonesUrl
=
$dropdown
.
data
(
'milestones'
)
milestonesUrl
=
$dropdown
.
data
(
'milestones'
)
issueUpdateURL
=
$dropdown
.
data
(
'issueUpdate'
)
selectedMilestone
=
$dropdown
.
data
(
'selected'
)
selectedMilestone
=
$dropdown
.
data
(
'selected'
)
showNo
=
$dropdown
.
data
(
'show-no'
)
showNo
=
$dropdown
.
data
(
'show-no'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
...
@@ -57,12 +57,20 @@ class @MilestoneSelect
...
@@ -57,12 +57,20 @@ class @MilestoneSelect
milestone
.
title
is
selectedMilestone
milestone
.
title
is
selectedMilestone
clicked
:
(
e
)
->
clicked
:
(
e
)
->
if
$
(
dropdown
).
hasClass
"js-filter-submit"
&&
opts
.
submitForm
if
$
dropdown
.
hasClass
"js-filter-submit"
$
(
dropdown
)
.
parents
(
'form'
).
submit
()
$
dropdown
.
parents
(
'form'
).
submit
()
else
else
milestoneVal
=
$
(
@
)
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
closest
(
'.selectbox'
)
.
find
(
'input[type="hidden"]'
)
.
find
(
'input[type="hidden"]'
)
.
val
()
.
val
()
Api
.
issues
.
update
(
projectId
,
issuableId
,
milestone_id
:
milestoneVal
,
(
data
)
=>
console
.
log
'data'
,
data
)
)
$
.
ajax
(
type
:
'PUT'
url
:
issueUpdateURL
data
:
issue
:
milestone_id
:
selected
).
done
(
data
)
->
console
.
log
'databack'
,
data
)
\ No newline at end of file
app/controllers/projects/issues_controller.rb
View file @
ff86138d
...
@@ -108,10 +108,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -108,10 +108,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
end
end
format
.
json
do
format
.
json
do
render
json:
{
render
json:
@issue
saved:
@issue
.
valid?
,
assignee_avatar_url:
@issue
.
assignee
.
try
(
:avatar_url
)
}
end
end
end
end
end
end
...
...
app/controllers/projects/milestones_controller.rb
View file @
ff86138d
...
@@ -19,7 +19,6 @@ class Projects::MilestonesController < Projects::ApplicationController
...
@@ -19,7 +19,6 @@ class Projects::MilestonesController < Projects::ApplicationController
end
end
@milestones
=
@milestones
.
includes
(
:project
)
@milestones
=
@milestones
.
includes
(
:project
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
@milestones
=
@milestones
.
page
(
params
[
:page
])
@milestones
=
@milestones
.
page
(
params
[
:page
])
...
...
app/views/shared/issuable/_filter.html.haml
View file @
ff86138d
...
@@ -55,9 +55,7 @@
...
@@ -55,9 +55,7 @@
:javascript
:javascript
new
UsersSelect
();
new
UsersSelect
();
new
LabelsSelect
();
new
LabelsSelect
();
new
MilestoneSelect
({
new
MilestoneSelect
();
submitForm
:
true
});
new
IssueStatusSelect
();
new
IssueStatusSelect
();
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
ff86138d
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
.light
None
.light
None
.selectbox.hide-collapsed
.selectbox.hide-collapsed
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"milestone_id"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
),
use_id:
true
}})
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"milestone_id"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
on
),
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
),
use_id:
true
}})
-
if
issuable
.
project
.
labels
.
any?
-
if
issuable
.
project
.
labels
.
any?
.block.labels
.block.labels
...
...
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