Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-06 12:08:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-06 12:08:13 +0300
commit8e94dad32b10edebf79285c083176c2b7005ef64 (patch)
tree3bb66395f2962063ca0d20f98b35ac852d801c7e /app/assets/javascripts/vue_shared
parentab128cc125f9db0c3a1bd48845f90c3d61ef42c9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared')
-rw-r--r--app/assets/javascripts/vue_shared/components/confirm_modal.vue41
1 files changed, 25 insertions, 16 deletions
diff --git a/app/assets/javascripts/vue_shared/components/confirm_modal.vue b/app/assets/javascripts/vue_shared/components/confirm_modal.vue
index 21722f62133..c77827205d6 100644
--- a/app/assets/javascripts/vue_shared/components/confirm_modal.vue
+++ b/app/assets/javascripts/vue_shared/components/confirm_modal.vue
@@ -9,34 +9,43 @@ export default {
props: {
modalAttributes: {
type: Object,
- required: true,
+ required: false,
+ default: () => {
+ return {};
+ },
},
path: {
type: String,
- required: true,
+ required: false,
+ default: '',
},
method: {
type: String,
- required: true,
+ required: false,
+ default: '',
+ },
+ showModal: {
+ type: Boolean,
+ required: false,
+ default: false,
},
},
- data() {
- return {
- isDismissed: false,
- };
- },
- mounted() {
- this.openModal();
+ watch: {
+ showModal(val) {
+ if (val) {
+ // Wait for v-if to render
+ this.$nextTick(() => {
+ this.openModal();
+ });
+ }
+ },
},
methods: {
openModal() {
this.$refs.modal.show();
},
submitModal() {
- this.$refs.form.requestSubmit();
- },
- dismiss() {
- this.isDismissed = true;
+ this.$refs.form.submit();
},
},
csrf,
@@ -45,11 +54,11 @@ export default {
<template>
<gl-modal
- v-if="!isDismissed"
+ v-if="showModal"
ref="modal"
v-bind="modalAttributes"
@primary="submitModal"
- @canceled="dismiss"
+ @canceled="$emit('dismiss')"
>
<form ref="form" :action="path" method="post">
<!-- Rails workaround for <form method="delete" />