2022-05-07 20:08:51 +05:30
|
|
|
<script>
|
|
|
|
import { uniqueId } from 'lodash';
|
2022-06-21 17:19:12 +05:30
|
|
|
import { GlButton, GlModal, GlModalDirective, GlSprintf } from '@gitlab/ui';
|
2022-05-07 20:08:51 +05:30
|
|
|
import { __ } from '~/locale';
|
|
|
|
import csrf from '~/lib/utils/csrf';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlButton,
|
|
|
|
GlModal,
|
2022-06-21 17:19:12 +05:30
|
|
|
GlSprintf,
|
2022-05-07 20:08:51 +05:30
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
GlModal: GlModalDirective,
|
|
|
|
},
|
2022-06-21 17:19:12 +05:30
|
|
|
inject: ['path', 'name'],
|
2022-05-07 20:08:51 +05:30
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
modalId: uniqueId('remove-topic-avatar-'),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
deleteApplication() {
|
|
|
|
this.$refs.deleteForm.submit();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
i18n: {
|
|
|
|
remove: __('Remove avatar'),
|
2022-06-21 17:19:12 +05:30
|
|
|
title: __('Remove topic avatar'),
|
|
|
|
body: __('Topic avatar for %{name} will be removed. This cannot be undone.'),
|
2022-05-07 20:08:51 +05:30
|
|
|
},
|
|
|
|
modal: {
|
|
|
|
actionPrimary: {
|
|
|
|
text: __('Remove'),
|
|
|
|
attributes: {
|
|
|
|
variant: 'danger',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
actionSecondary: {
|
|
|
|
text: __('Cancel'),
|
|
|
|
attributes: {
|
|
|
|
variant: 'default',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
csrf,
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<gl-button v-gl-modal="modalId" variant="danger" category="secondary" class="gl-mt-2">{{
|
|
|
|
$options.i18n.remove
|
|
|
|
}}</gl-button>
|
|
|
|
<gl-modal
|
|
|
|
:title="$options.i18n.title"
|
|
|
|
:action-primary="$options.modal.actionPrimary"
|
|
|
|
:action-secondary="$options.modal.actionSecondary"
|
|
|
|
:modal-id="modalId"
|
|
|
|
size="sm"
|
|
|
|
@primary="deleteApplication"
|
2022-06-21 17:19:12 +05:30
|
|
|
><gl-sprintf :message="$options.i18n.body"
|
|
|
|
><template #name>{{ name }}</template></gl-sprintf
|
|
|
|
>
|
2022-05-07 20:08:51 +05:30
|
|
|
<form ref="deleteForm" method="post" :action="path">
|
|
|
|
<input type="hidden" name="_method" value="delete" />
|
|
|
|
<input type="hidden" name="authenticity_token" :value="$options.csrf.token" />
|
|
|
|
</form>
|
|
|
|
</gl-modal>
|
|
|
|
</div>
|
|
|
|
</template>
|