diff options
author | Fatih Acet <acetfatih@gmail.com> | 2019-01-16 03:34:30 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-01-31 01:18:14 +0300 |
commit | b72f52f12303ae06015491844ed9dcf404cee1de (patch) | |
tree | af10753838c2c306e71741185fb45dd798cc8ddc | |
parent | 515f4b46ab06af1e7201a27f5a931c4763643c8e (diff) |
Disable tasklist items while request is being done
-rw-r--r-- | app/assets/javascripts/task_list.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/app/assets/javascripts/task_list.js b/app/assets/javascripts/task_list.js index 10368ecf248..af2359d606f 100644 --- a/app/assets/javascripts/task_list.js +++ b/app/assets/javascripts/task_list.js @@ -34,8 +34,16 @@ export default class TaskList { ); } - disable() { + disableTaskListItems() { $(`${this.selector} .js-task-list-container`).taskList('disable'); + } + + enableTaskListItems() { + $(`${this.selector} .js-task-list-container`).taskList('enable'); + } + + disable() { + this.disableTaskListItems(); $(document).off('tasklist:changed', `${this.selector} .js-task-list-container`); } @@ -47,12 +55,20 @@ export default class TaskList { lock_version: this.lockVersion, }; + this.disableTaskListItems(); + return axios .patch($target.data('updateUrl') || $('form.js-issuable-update').attr('action'), patchData) - .catch(({ response }) => this.onError(response.data)); .then(({ data }) => { this.lockVersion = data.lock_version; + this.enableTaskListItems(); + return this.onSuccess(data); }) + .catch(({ response }) => { + this.enableTaskListItems(); + + return this.onError(response.data); + }); } } |