debian-mirror-gitlab/app/assets/javascripts/pages/admin/projects/index/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import Vue from 'vue';
2021-03-11 19:13:27 +05:30
import { BV_SHOW_MODAL } from '~/lib/utils/constants';
2018-03-17 18:26:18 +05:30
import csrf from '~/lib/utils/csrf';
2021-03-11 19:13:27 +05:30
import Translate from '~/vue_shared/translate';
2018-03-17 18:26:18 +05:30
import deleteProjectModal from './components/delete_project_modal.vue';
2021-04-17 20:07:23 +05:30
(() => {
2018-03-17 18:26:18 +05:30
Vue.use(Translate);
const deleteProjectModalEl = document.getElementById('delete-project-modal');
const deleteModal = new Vue({
el: deleteProjectModalEl,
2021-09-30 23:02:18 +05:30
data() {
return {
deleteProjectUrl: '',
projectName: '',
};
2018-03-17 18:26:18 +05:30
},
2020-11-24 15:15:51 +05:30
mounted() {
const deleteProjectButtons = document.querySelectorAll('.delete-project-button');
2021-03-08 18:12:59 +05:30
deleteProjectButtons.forEach((button) => {
2020-11-24 15:15:51 +05:30
button.addEventListener('click', () => {
const buttonProps = button.dataset;
deleteModal.deleteProjectUrl = buttonProps.deleteProjectUrl;
deleteModal.projectName = buttonProps.projectName;
2021-03-11 19:13:27 +05:30
this.$root.$emit(BV_SHOW_MODAL, 'delete-project-modal');
2020-11-24 15:15:51 +05:30
});
});
},
2018-03-17 18:26:18 +05:30
render(createElement) {
return createElement(deleteProjectModal, {
props: {
deleteProjectUrl: this.deleteProjectUrl,
projectName: this.projectName,
csrfToken: csrf.token,
},
});
},
});
2021-04-17 20:07:23 +05:30
})();