2018-05-09 12:01:36 +05:30
|
|
|
<script>
|
|
|
|
import { mapState, mapActions } from 'vuex';
|
|
|
|
import createFlash from '~/flash';
|
|
|
|
import { s__ } from '~/locale';
|
|
|
|
import GlModal from '~/vue_shared/components/gl_modal.vue';
|
|
|
|
import Badge from './badge.vue';
|
|
|
|
import BadgeForm from './badge_form.vue';
|
|
|
|
import BadgeList from './badge_list.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BadgeSettings',
|
|
|
|
components: {
|
|
|
|
Badge,
|
|
|
|
BadgeForm,
|
|
|
|
BadgeList,
|
|
|
|
GlModal,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(['badgeInModal', 'isEditing']),
|
|
|
|
deleteModalText() {
|
|
|
|
return s__(
|
|
|
|
'Badges|You are going to delete this badge. Deleted badges <strong>cannot</strong> be restored.',
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(['deleteBadge']),
|
|
|
|
onSubmitModal() {
|
|
|
|
this.deleteBadge(this.badgeInModal)
|
|
|
|
.then(() => {
|
|
|
|
createFlash(s__('Badges|The badge was deleted.'), 'notice');
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
createFlash(s__('Badges|Deleting the badge failed, please try again.'));
|
|
|
|
throw error;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="badge-settings">
|
|
|
|
<gl-modal
|
|
|
|
id="delete-badge-modal"
|
|
|
|
:header-title-text="s__('Badges|Delete badge?')"
|
|
|
|
:footer-primary-button-text="s__('Badges|Delete badge')"
|
2018-11-08 19:23:39 +05:30
|
|
|
footer-primary-button-variant="danger"
|
2019-02-13 22:33:31 +05:30
|
|
|
@submit="onSubmitModal"
|
|
|
|
>
|
2018-05-09 12:01:36 +05:30
|
|
|
<div class="well">
|
|
|
|
<badge
|
|
|
|
:image-url="badgeInModal ? badgeInModal.renderedImageUrl : ''"
|
|
|
|
:link-url="badgeInModal ? badgeInModal.renderedLinkUrl : ''"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<p v-html="deleteModalText"></p>
|
|
|
|
</gl-modal>
|
|
|
|
|
2019-02-13 22:33:31 +05:30
|
|
|
<badge-form v-show="isEditing" :is-editing="true" />
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2019-02-13 22:33:31 +05:30
|
|
|
<badge-form v-show="!isEditing" :is-editing="false" />
|
2018-05-09 12:01:36 +05:30
|
|
|
<badge-list v-show="!isEditing" />
|
|
|
|
</div>
|
|
|
|
</template>
|