/
publish-modal.vue
53 lines (49 loc) · 1.31 KB
/
publish-modal.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
<div>
<modal :title="_('Publish')"
class="modal-warning post-publish-modal"
v-ref:modal>
<div class="modal-body">
<p class="lead text-center">
{{ _('You are about to publish this post') }}
</p>
<p class="lead text-center">
{{ _('Are you sure?') }}
</p>
</div>
<footer class="modal-footer text-center">
<button type="button" class="btn btn-outline pull-left"
@click="$refs.modal.close">
{{ _('Cancel') }}
</button>
<button type="button" class="btn btn-outline"
@click="confirm">
{{ _('Confirm') }}
</button>
</footer>
</modal>
</div>
</template>
<script>
import API from 'api';
import Modal from 'components/modal.vue';
export default {
components: {Modal},
props: {
post: Object,
},
methods: {
confirm() {
API.posts.publish_post({post: this.post.id}, (response) => {
this.post.on_fetched(response);
this.$dispatch('notify', {
autoclose: true,
title: this._('Post published'),
});
this.$refs.modal.close();
this.$go({name: 'post', params: {oid: this.post.id}});
});
}
}
};
</script>