blob: bbbaa288b89041a0005ffbc4377a08e2d215a7ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
|