debian-mirror-gitlab/app/assets/javascripts/issue.js.coffee

30 lines
903 B
CoffeeScript
Raw Normal View History

2015-09-11 14:41:01 +05:30
#= require jquery.waitforimages
#= require task_list
2015-04-26 12:48:37 +05:30
class @Issue
2014-09-02 18:07:02 +05:30
constructor: ->
2015-09-11 14:41:01 +05:30
# Prevent duplicate event bindings
@disableTaskList()
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
if $("a.btn-close").length
2015-09-11 14:41:01 +05:30
@initTaskList()
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'
2015-04-26 12:48:37 +05:30
2015-09-11 14:41:01 +05:30
# 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()}
2015-04-26 12:48:37 +05:30
2015-09-11 14:41:01 +05:30
$.ajax
type: 'PATCH'
url: $('form.js-issuable-update').attr('action')
data: patchData