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/confirm_modal.js
parentab128cc125f9db0c3a1bd48845f90c3d61ef42c9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/confirm_modal.js')
-rw-r--r--app/assets/javascripts/confirm_modal.js53
1 files changed, 36 insertions, 17 deletions
diff --git a/app/assets/javascripts/confirm_modal.js b/app/assets/javascripts/confirm_modal.js
index 1c9346e35e0..ff29d5fa355 100644
--- a/app/assets/javascripts/confirm_modal.js
+++ b/app/assets/javascripts/confirm_modal.js
@@ -1,26 +1,45 @@
import Vue from 'vue';
import ConfirmModal from '~/vue_shared/components/confirm_modal.vue';
-const mountConfirmModal = button => {
- const props = {
- path: button.dataset.path,
- method: button.dataset.method,
- modalAttributes: JSON.parse(button.dataset.modalAttributes),
- };
-
+const mountConfirmModal = () => {
return new Vue({
+ data() {
+ return {
+ path: '',
+ method: '',
+ modalAttributes: null,
+ showModal: false,
+ };
+ },
+ mounted() {
+ document.querySelectorAll('.js-confirm-modal-button').forEach(button => {
+ button.addEventListener('click', e => {
+ e.preventDefault();
+
+ this.path = button.dataset.path;
+ this.method = button.dataset.method;
+ this.modalAttributes = JSON.parse(button.dataset.modalAttributes);
+ this.showModal = true;
+ });
+ });
+ },
+ methods: {
+ dismiss() {
+ this.showModal = false;
+ },
+ },
render(h) {
- return h(ConfirmModal, { props });
+ return h(ConfirmModal, {
+ props: {
+ path: this.path,
+ method: this.method,
+ modalAttributes: this.modalAttributes,
+ showModal: this.showModal,
+ },
+ on: { dismiss: this.dismiss },
+ });
},
}).$mount();
};
-export default () => {
- document.getElementsByClassName('js-confirm-modal-button').forEach(button => {
- button.addEventListener('click', e => {
- e.preventDefault();
-
- mountConfirmModal(button);
- });
- });
-};
+export default () => mountConfirmModal();