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
Jérome Perrin
gitlab-ce
Commits
dd86ce3f
Commit
dd86ce3f
authored
Jun 11, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort issues in milestone
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
1f5891e9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
4 deletions
+34
-4
app/assets/javascripts/milestone.js.coffee
app/assets/javascripts/milestone.js.coffee
+16
-0
app/controllers/projects/milestones_controller.rb
app/controllers/projects/milestones_controller.rb
+11
-1
app/views/projects/milestones/_issue.html.haml
app/views/projects/milestones/_issue.html.haml
+1
-1
app/views/projects/milestones/_issues.html.haml
app/views/projects/milestones/_issues.html.haml
+1
-1
config/routes.rb
config/routes.rb
+5
-1
No files found.
app/assets/javascripts/milestone.js.coffee
View file @
dd86ce3f
...
...
@@ -11,6 +11,18 @@ class Milestone
new
Flash
(
"Issue update failed"
,
'alert'
)
dataType
:
"json"
@
sortIssues
:
(
data
)
->
sort_issues_url
=
location
.
href
+
"/sort_issues"
$
.
ajax
type
:
"PUT"
url
:
sort_issues_url
data
:
data
success
:
(
data
)
->
if
data
.
saved
!=
true
new
Flash
(
"Issues update failed"
,
'alert'
)
dataType
:
"json"
@
updateMergeRequest
:
(
li
,
merge_request_url
,
data
)
->
$
.
ajax
type
:
"PUT"
...
...
@@ -31,6 +43,10 @@ class Milestone
$
(
"#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed"
).
sortable
(
connectWith
:
".issues-sortable-list"
,
dropOnEmpty
:
true
,
update
:
(
event
,
ui
)
->
data
=
$
(
this
).
sortable
(
"serialize"
)
Milestone
.
sortIssues
(
data
)
receive
:
(
event
,
ui
)
->
new_state
=
$
(
this
).
data
(
'state'
)
issue_id
=
ui
.
item
.
data
(
'iid'
)
...
...
app/controllers/projects/milestones_controller.rb
View file @
dd86ce3f
class
Projects::MilestonesController
<
Projects
::
ApplicationController
before_filter
:module_enabled
before_filter
:milestone
,
only:
[
:edit
,
:update
,
:destroy
,
:show
]
before_filter
:milestone
,
only:
[
:edit
,
:update
,
:destroy
,
:show
,
:sort_issues
]
# Allow read any milestone
before_filter
:authorize_read_milestone!
...
...
@@ -72,6 +72,16 @@ class Projects::MilestonesController < Projects::ApplicationController
end
end
def
sort_issues
@issues
=
@milestone
.
issues
.
where
(
id:
params
[
'sortable_issue'
])
@issues
.
each
do
|
issue
|
issue
.
position
=
params
[
'sortable_issue'
].
index
(
issue
.
id
.
to_s
)
+
1
issue
.
save
end
render
json:
{
saved:
true
}
end
protected
def
milestone
...
...
app/views/projects/milestones/_issue.html.haml
View file @
dd86ce3f
%li
{
class:
'issue-row'
,
'data-iid'
=>
issue
.
iid
,
'data-url'
=>
project_issue_path
(
@project
,
issue
)
}
%li
{
id:
dom_id
(
issue
,
'sortable'
),
class:
'issue-row'
,
'data-iid'
=>
issue
.
iid
,
'data-url'
=>
project_issue_path
(
@project
,
issue
)
}
%span
.str-truncated
=
link_to
[
@project
,
issue
]
do
%span
.cgray
##{issue.iid}
...
...
app/views/projects/milestones/_issues.html.haml
View file @
dd86ce3f
.panel.panel-default
.panel-heading
=
title
%ul
{
class:
"well-list issues-sortable-list"
,
id:
"issues-list-#{id}"
,
"data-state"
=>
id
}
-
issues
.
each
do
|
issue
|
-
issues
.
sort_by
(
&
:position
).
each
do
|
issue
|
=
render
'issue'
,
issue:
issue
%li
.light
Drag and drop available
config/routes.rb
View file @
dd86ce3f
...
...
@@ -278,7 +278,11 @@ Gitlab::Application.routes.draw do
end
resources
:team
,
controller:
'team_members'
,
only:
[
:index
]
resources
:milestones
,
except:
[
:destroy
],
constraints:
{
id:
/\d+/
}
resources
:milestones
,
except:
[
:destroy
],
constraints:
{
id:
/\d+/
}
do
member
do
put
:sort_issues
end
end
resources
:labels
,
only:
[
:index
]
do
collection
do
...
...
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