gitlab-org--gitlab-foss/app/assets/javascripts/issue.js.coffee

30 lines
903 B
CoffeeScript
Raw Normal View History

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
constructor: ->
2015-04-29 16:47:31 -04:00
# Prevent duplicate event bindings
@disableTaskList()
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'
url: $('form.js-issuable-update').attr('action')
2015-04-29 16:47:31 -04:00
data: patchData