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

confirm_modal.js « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1c9346e35e0d08b0d25f4b942891a366ab293766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
    });
  });
};