monkeeShark/src/web/app/desktop/views/components/post-form-window.vue

60 lines
1.4 KiB
Vue
Raw Normal View History

2018-02-11 15:17:51 +00:00
<template>
2018-02-11 15:58:02 +00:00
<mk-window ref="window" is-modal @closed="$destroy">
2018-02-11 15:17:51 +00:00
<span slot="header">
<span v-if="!parent.opts.reply">%i18n:desktop.tags.mk-post-form-window.post%</span>
<span v-if="parent.opts.reply">%i18n:desktop.tags.mk-post-form-window.reply%</span>
2018-02-11 15:23:05 +00:00
<span :class="$style.count" v-if="media.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.attaches%'.replace('{}', media.length) }}</span>
<span :class="$style.count" v-if="uploadings.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.uploading-media%'.replace('{}', uploadings.length) }}<mk-ellipsis/></span>
2018-02-11 15:17:51 +00:00
</span>
<div slot="content">
2018-02-11 15:23:05 +00:00
<mk-post-preview v-if="parent.opts.reply" :class="$style.postPreview" :post="reply"/>
<mk-post-form ref="form"
:reply="reply"
2018-02-11 15:58:02 +00:00
@posted="$refs.window.close"
2018-02-11 15:23:05 +00:00
@change-uploadings="onChangeUploadings"
@change-attached-media="onChangeMedia"/>
2018-02-11 15:17:51 +00:00
</div>
</mk-window>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: ['reply'],
data() {
return {
uploadings: [],
media: []
};
},
mounted() {
(this.$refs.form as any).focus();
},
methods: {
onChangeUploadings(media) {
this.uploadings = media;
},
onChangeMedia(media) {
this.media = media;
}
}
});
</script>
<style lang="stylus" module>
2018-02-11 15:23:05 +00:00
.count
2018-02-11 15:17:51 +00:00
margin-left 8px
opacity 0.8
&:before
content '('
&:after
content ')'
.postPreview
margin 16px 22px
</style>