gamebrary/src/components/Settings/Releases.vue

95 lines
1.9 KiB
Vue
Raw Normal View History

2020-08-15 00:02:34 +00:00
<template lang="html">
<b-dropdown-item v-b-modal:releases>
<b-icon-mailbox class="mr-1" />
Releases
<b-modal
id="releases"
title="Releases"
modal-class="releases"
scrollable
hide-footer
size="lg"
2020-08-24 17:22:01 +00:00
@show="loadReleases"
2020-08-15 00:02:34 +00:00
>
<div v-if="releases">
<b-card
v-for="release in releases"
:key="release.id"
header-tag="header"
hide-footer
class="mb-3"
>
<template v-slot:header>
<h6 class="mb-0">
<b-badge>{{ release.tag_name }}</b-badge>
{{ release.name }}
</h6>
</template>
<small class="text-muted">
{{ $t('releases.published', { date: formatDate(release.published_at) }) }}
</small>
<b-card-text>
<vue-markdown :source="release.body" />
</b-card-text>
</b-card>
</div>
<b-card
v-else
v-for="n in 3"
:key="n"
header-tag="header"
class="mb-3"
hide-footer
>
<template v-slot:header>
<placeholder />
</template>
<b-card-text>
<placeholder :lines="3" />
</b-card-text>
</b-card>
</b-modal>
</b-dropdown-item>
</template>
<script>
import VueMarkdown from 'vue-markdown';
import moment from 'moment';
import Placeholder from '@/components/Placeholder';
export default {
components: {
VueMarkdown,
Placeholder,
},
data() {
return {
releases: null,
};
},
methods: {
formatDate(date) {
return moment(date).format('LL');
},
async loadReleases() {
this.releases = await this.$store.dispatch('LOAD_RELEASES');
},
},
};
</script>
<style lang="scss" rel="stylesheet/scss">
.releases img {
max-width: 100%;
margin-top: 1rem;
}
</style>