diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 12:07:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 12:07:30 +0300 |
commit | 5498125b82c1bad4c613cc4b90c7920d47d949d4 (patch) | |
tree | 03f35817fea072376372c2f280e62e08e9f8f145 /app/assets/javascripts/admin | |
parent | 2fff82c54ce215aceabe5b5236fafeea005d4eee (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/admin')
-rw-r--r-- | app/assets/javascripts/admin/topics/components/remove_avatar.vue | 67 | ||||
-rw-r--r-- | app/assets/javascripts/admin/topics/index.js | 22 |
2 files changed, 89 insertions, 0 deletions
diff --git a/app/assets/javascripts/admin/topics/components/remove_avatar.vue b/app/assets/javascripts/admin/topics/components/remove_avatar.vue new file mode 100644 index 00000000000..5e94d6185e0 --- /dev/null +++ b/app/assets/javascripts/admin/topics/components/remove_avatar.vue @@ -0,0 +1,67 @@ +<script> +import { uniqueId } from 'lodash'; +import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui'; +import { __ } from '~/locale'; +import csrf from '~/lib/utils/csrf'; + +export default { + components: { + GlButton, + GlModal, + }, + directives: { + GlModal: GlModalDirective, + }, + inject: ['path'], + data() { + return { + modalId: uniqueId('remove-topic-avatar-'), + }; + }, + methods: { + deleteApplication() { + this.$refs.deleteForm.submit(); + }, + }, + i18n: { + remove: __('Remove avatar'), + title: __('Confirm remove avatar'), + body: __('Avatar will be removed. Are you sure?'), + }, + 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" + >{{ $options.i18n.body }} + <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> diff --git a/app/assets/javascripts/admin/topics/index.js b/app/assets/javascripts/admin/topics/index.js new file mode 100644 index 00000000000..8fbcadf3369 --- /dev/null +++ b/app/assets/javascripts/admin/topics/index.js @@ -0,0 +1,22 @@ +import Vue from 'vue'; +import RemoveAvatar from './components/remove_avatar.vue'; + +export default () => { + const el = document.querySelector('.js-remove-topic-avatar'); + + if (!el) { + return false; + } + + const { path } = el.dataset; + + return new Vue({ + el, + provide: { + path, + }, + render(h) { + return h(RemoveAvatar); + }, + }); +}; |