diff options
author | Phil Hughes <me@iamphill.com> | 2017-05-26 09:29:06 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-26 09:29:06 +0100 |
commit | 6becf288190b6883f71ae4b980db3239cd63f831 (patch) | |
tree | e8ed6cbe3d661954ec96d35eb72f1381bd0637fb | |
parent | 3ce6658d8df4c7370f2d5a8b497fddb9b6283083 (diff) | |
download | gitlab-ce-issue-edit-inline-project-move-warning.tar.gz |
use formState to update loading of save buttonissue-edit-inline-project-move-warning
[ci skip]
-rw-r--r-- | app/assets/javascripts/issue_show/components/app.vue | 3 | ||||
-rw-r--r-- | app/assets/javascripts/issue_show/components/edit_actions.vue | 18 | ||||
-rw-r--r-- | app/assets/javascripts/issue_show/stores/index.js | 1 |
3 files changed, 7 insertions, 15 deletions
diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue index 9753dc49cf5..ed367c780c6 100644 --- a/app/assets/javascripts/issue_show/components/app.vue +++ b/app/assets/javascripts/issue_show/components/app.vue @@ -114,6 +114,7 @@ export default { description: this.state.descriptionText, lockedWarningVisible: false, move_to_project_id: 0, + updateLoading: false, }); } }, @@ -125,7 +126,7 @@ export default { confirm('Are you sure you want to move this issue to another project?') : true; // eslint-disable-line no-alert if (!canPostUpdate) { - eventHub.$emit('enable.submit.btn'); + this.store.formState.updateLoading = false; return; } diff --git a/app/assets/javascripts/issue_show/components/edit_actions.vue b/app/assets/javascripts/issue_show/components/edit_actions.vue index df93d18774f..0750d21c15d 100644 --- a/app/assets/javascripts/issue_show/components/edit_actions.vue +++ b/app/assets/javascripts/issue_show/components/edit_actions.vue @@ -15,7 +15,6 @@ data() { return { deleteLoading: false, - updateLoading: false, }; }, computed: { @@ -24,11 +23,8 @@ }, }, methods: { - enableSubmit() { - this.updateLoading = false; - }, updateIssuable() { - this.updateLoading = true; + this.formState.updateLoading = true; eventHub.$emit('update.issuable'); }, closeForm() { @@ -43,12 +39,6 @@ } }, }, - created() { - eventHub.$on('enable.submit.btn', this.enableSubmit); - }, - beforeDestroy() { - eventHub.$off('enable.submit.btn', this.enableSubmit); - }, }; </script> @@ -56,15 +46,15 @@ <div class="prepend-top-default append-bottom-default clearfix"> <button class="btn btn-save pull-left" - :class="{ disabled: updateLoading || !isSubmitEnabled }" + :class="{ disabled: formState.updateLoading || !isSubmitEnabled }" type="submit" - :disabled="updateLoading || !isSubmitEnabled" + :disabled="formState.updateLoading || !isSubmitEnabled" @click.prevent="updateIssuable"> Save changes <i class="fa fa-spinner fa-spin" aria-hidden="true" - v-if="updateLoading"> + v-if="formState.updateLoading"> </i> </button> <button diff --git a/app/assets/javascripts/issue_show/stores/index.js b/app/assets/javascripts/issue_show/stores/index.js index 76abcc64ed3..fbb95866671 100644 --- a/app/assets/javascripts/issue_show/stores/index.js +++ b/app/assets/javascripts/issue_show/stores/index.js @@ -19,6 +19,7 @@ export default class Store { description: '', lockedWarningVisible: false, move_to_project_id: 0, + updateLoading: false, }; } |