diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-29 17:00:30 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-06 12:58:27 -0400 |
commit | ce29e5cd8f09212afd3274326917c364272a6e39 (patch) | |
tree | d1ebc66e36295916867d58ede3648df89950fda6 /app/assets/javascripts/merge_request.js.coffee | |
parent | 922497560eb7d619a6064d7b1d44c831ccd64ea9 (diff) | |
download | gitlab-ce-ce29e5cd8f09212afd3274326917c364272a6e39.tar.gz |
Update task list behavior for Merge Requests
Diffstat (limited to 'app/assets/javascripts/merge_request.js.coffee')
-rw-r--r-- | app/assets/javascripts/merge_request.js.coffee | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee index ae5d088d593..c8affba5b29 100644 --- a/app/assets/javascripts/merge_request.js.coffee +++ b/app/assets/javascripts/merge_request.js.coffee @@ -17,8 +17,11 @@ class @MergeRequest disableButtonIfEmptyField '#commit_message', '.accept_merge_request' + # Prevent duplicate event bindings + @disableTaskList() + if $("a.btn-close").length - $("li.task-list-item input:checkbox").prop("disabled", false) + @initTaskList() $('.merge-request-details').waitForImages -> $('.issuable-affix').affix offset: @@ -77,9 +80,6 @@ class @MergeRequest this.$('.remove_source_branch_in_progress').hide() this.$('.remove_source_branch_widget.failed').show() - $('.task-list-item input:checkbox').off('change') - $('.task-list-item input:checkbox').change('merge_request', updateTaskState) - activateTab: (action) -> this.$('.merge-request-tabs li').removeClass 'active' this.$('.tab-content').hide() @@ -156,3 +156,22 @@ class @MergeRequest else setTimeout(merge_request.mergeInProgress, 3000) dataType: 'json' + + initTaskList: -> + $('.merge-request-details .js-task-list-container').taskList('enable') + $(document).on 'tasklist:changed', '.merge-request-details .js-task-list-container', @updateTaskList + + disableTaskList: -> + $('.merge-request-details .js-task-list-container').taskList('disable') + $(document).off 'tasklist:changed', '.merge-request-details .js-task-list-container' + + # TODO (rspeicher): Make the merge request description inline-editable like a + # note so that we can re-use its form here + updateTaskList: -> + patchData = {} + patchData['merge_request'] = {'description': $('.js-task-list-field', this).val()} + + $.ajax + type: 'PATCH' + url: $('form.js-merge-request-update').attr('action') + data: patchData |