Commit 5082b8d8 authored by Kushal Pandya's avatar Kushal Pandya

Move modal dialog to app root component

parent b10ea6e3
<script> <script>
import { s__ } from '~/locale'; import tooltip from '~/vue_shared/directives/tooltip';
import tooltip from '~/vue_shared/directives/tooltip'; import icon from '~/vue_shared/components/icon.vue';
import icon from '~/vue_shared/components/icon.vue'; import eventHub from '../event_hub';
import modal from '~/vue_shared/components/modal.vue'; import { COMMON_STR } from '../constants';
import eventHub from '../event_hub';
import { COMMON_STR } from '../constants';
export default { export default {
components: { components: {
icon, icon,
modal, },
directives: {
tooltip,
},
props: {
parentGroup: {
type: Object,
required: false,
default: () => ({}),
}, },
directives: { group: {
tooltip, type: Object,
required: true,
}, },
props: { },
parentGroup: { computed: {
type: Object, leaveBtnTitle() {
required: false, return COMMON_STR.LEAVE_BTN_TITLE;
default: () => ({}),
},
group: {
type: Object,
required: true,
},
}, },
data() { editBtnTitle() {
return { return COMMON_STR.EDIT_BTN_TITLE;
modalStatus: false,
};
}, },
computed: { },
leaveBtnTitle() { methods: {
return COMMON_STR.LEAVE_BTN_TITLE; onLeaveGroup() {
}, eventHub.$emit('showLeaveGroupModal', this.group, this.parentGroup);
editBtnTitle() {
return COMMON_STR.EDIT_BTN_TITLE;
},
leaveConfirmationMessage() {
return s__(`GroupsTree|Are you sure you want to leave the "${this.group.fullName}" group?`);
},
}, },
methods: { },
onLeaveGroup() { };
this.modalStatus = true;
},
leaveGroup() {
this.modalStatus = false;
eventHub.$emit('leaveGroup', this.group, this.parentGroup);
},
},
};
</script> </script>
<template> <template>
...@@ -78,14 +63,5 @@ ...@@ -78,14 +63,5 @@
class="leave-group btn no-expand"> class="leave-group btn no-expand">
<icon name="leave"/> <icon name="leave"/>
</a> </a>
<modal
v-show="modalStatus"
:primary-button-label="__('Leave')"
kind="warning"
:title="__('Are you sure?')"
:text="__('Are you sure you want to leave this group?')"
:body="leaveConfirmationMessage"
@submit="leaveGroup"
/>
</div> </div>
</template> </template>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment