2015-05-06 12:57:12 -04:00
|
|
|
#= require jquery.waitforimages
|
2015-05-06 15:31:08 -04:00
|
|
|
#= require task_list
|
2015-05-06 12:57:12 -04:00
|
|
|
|
2014-10-20 16:48:07 -04:00
|
|
|
class @Issue
|
2014-02-18 06:15:43 -05:00
|
|
|
constructor: ->
|
2015-04-29 16:47:31 -04:00
|
|
|
# Prevent duplicate event bindings
|
|
|
|
@disableTaskList()
|
2014-10-05 01:53:44 -04:00
|
|
|
|
2015-04-29 16:47:31 -04:00
|
|
|
if $("a.btn-close").length
|
|
|
|
@initTaskList()
|
2015-02-17 19:14:49 -05:00
|
|
|
|
2015-04-29 16:47:31 -04:00
|
|
|
initTaskList: ->
|
|
|
|
$('.issue-details .js-task-list-container').taskList('enable')
|
|
|
|
$(document).on 'tasklist:changed', '.issue-details .js-task-list-container', @updateTaskList
|
|
|
|
|
|
|
|
disableTaskList: ->
|
|
|
|
$('.issue-details .js-task-list-container').taskList('disable')
|
|
|
|
$(document).off 'tasklist:changed', '.issue-details .js-task-list-container'
|
|
|
|
|
|
|
|
# TODO (rspeicher): Make the issue description inline-editable like a note so
|
|
|
|
# that we can re-use its form here
|
|
|
|
updateTaskList: ->
|
|
|
|
patchData = {}
|
|
|
|
patchData['issue'] = {'description': $('.js-task-list-field', this).val()}
|
|
|
|
|
|
|
|
$.ajax
|
|
|
|
type: 'PATCH'
|
2015-06-26 09:05:30 -04:00
|
|
|
url: $('form.js-issuable-update').attr('action')
|
2015-04-29 16:47:31 -04:00
|
|
|
data: patchData
|