Add js milestone class. Activate drag-drop for issues on milestone page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
ad60701e9e
commit
47937802a2
2 changed files with 42 additions and 0 deletions
|
@ -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'
|
||||
|
|
40
app/assets/javascripts/milestone.js.coffee
Normal file
40
app/assets/javascripts/milestone.js.coffee
Normal file
|
@ -0,0 +1,40 @@
|
|||
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
|
Loading…
Reference in a new issue