diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 15:08:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 15:08:48 +0300 |
commit | f7dae0cdcb70ecb71c1d65f099e9d96b27a4548c (patch) | |
tree | e53baffa847c4fd37c8e335e4d93d603c75f9f02 /app/assets/javascripts/confirm_modal.js | |
parent | b98fa9ef3d5bead417ae2f325cb64637883264e9 (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.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/assets/javascripts/confirm_modal.js b/app/assets/javascripts/confirm_modal.js new file mode 100644 index 00000000000..1c9346e35e0 --- /dev/null +++ b/app/assets/javascripts/confirm_modal.js @@ -0,0 +1,26 @@ +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), + }; + + return new Vue({ + render(h) { + return h(ConfirmModal, { props }); + }, + }).$mount(); +}; + +export default () => { + document.getElementsByClassName('js-confirm-modal-button').forEach(button => { + button.addEventListener('click', e => { + e.preventDefault(); + + mountConfirmModal(button); + }); + }); +}; |