Commit 47937802 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add js milestone class. Activate drag-drop for issues on milestone page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ad60701e
......@@ -21,6 +21,8 @@ class Dispatcher
Issues.init()
when 'projects:issues:show'
new Issue()
when 'projects:milestones:show'
new Milestone()
when 'projects:issues:new', 'projects:merge_requests:new'
GitLab.GfmAutoComplete.setup()
when 'dashboard:show'
......
class Milestone
@updateIssue: (li, issue_url, data) ->
$.ajax
type: "PUT"
url: issue_url
data: data
success: (data) ->
if data.saved == true
$(li).effect 'highlight'
else
new Flash("Issue update failed", 'alert')
dataType: "json"
constructor: ->
@bindSorting()
bindSorting: ->
$("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed, #issues-list-reopened").sortable(
connectWith: ".issues-sortable-list",
dropOnEmpty: true,
receive: (event, ui) ->
new_state = $(this).data('state')
issue_id = ui.item.data('iid')
issue_url = ui.item.data('url')
data = switch new_state
when 'ongoing'
"issue[assignee_id]=" + gon.current_user_id
when 'unassigned'
"issue[assignee_id]="
when 'closed'
"issue[state_event]=close"
when 'reopened'
"issue[state_event]=reopen"
Milestone.updateIssue(ui.item, issue_url, data)
).disableSelection()
@Milestone = Milestone
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment