BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ed610043
Commit
ed610043
authored
Jun 11, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'milestone-issue-position' into 'master'
Milestone issues sorting Now issues save sort position inside milestone lists Part of #1207
parents
5117bf6f
dd86ce3f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
4 deletions
+34
-4
milestone.js.coffee
app/assets/javascripts/milestone.js.coffee
+16
-0
milestones_controller.rb
app/controllers/projects/milestones_controller.rb
+11
-1
_issue.html.haml
app/views/projects/milestones/_issue.html.haml
+1
-1
_issues.html.haml
app/views/projects/milestones/_issues.html.haml
+1
-1
routes.rb
config/routes.rb
+5
-1
No files found.
app/assets/javascripts/milestone.js.coffee
View file @
ed610043
...
...
@@ -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 @
ed610043
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 @
ed610043
%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 @
ed610043
.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 @
ed610043
...
...
@@ -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