2018-02-11 16:17:51 +01:00
|
|
|
<template>
|
2018-02-11 16:58:02 +01:00
|
|
|
<mk-window ref="window" is-modal @closed="$destroy">
|
2018-02-11 16:17:51 +01:00
|
|
|
<span slot="header">
|
2018-03-05 00:44:37 +01:00
|
|
|
<span :class="$style.icon" v-if="geo">%fa:map-marker-alt%</span>
|
2018-02-14 11:21:15 +01:00
|
|
|
<span v-if="!reply">%i18n:desktop.tags.mk-post-form-window.post%</span>
|
|
|
|
<span v-if="reply">%i18n:desktop.tags.mk-post-form-window.reply%</span>
|
2018-02-11 16:23:05 +01: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 16:17:51 +01:00
|
|
|
</span>
|
2018-02-16 09:01:36 +01:00
|
|
|
|
|
|
|
<mk-post-preview v-if="reply" :class="$style.postPreview" :post="reply"/>
|
|
|
|
<mk-post-form ref="form"
|
|
|
|
:reply="reply"
|
|
|
|
@posted="onPosted"
|
|
|
|
@change-uploadings="onChangeUploadings"
|
2018-03-05 00:44:37 +01:00
|
|
|
@change-attached-media="onChangeMedia"
|
2018-03-05 06:09:12 +01:00
|
|
|
@geo-attached="onGeoAttached"
|
|
|
|
@geo-dettached="onGeoDettached"/>
|
2018-02-11 16:17:51 +01:00
|
|
|
</mk-window>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['reply'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
uploadings: [],
|
2018-03-05 00:44:37 +01:00
|
|
|
media: [],
|
|
|
|
geo: null
|
2018-02-11 16:17:51 +01:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-02-18 10:40:24 +01:00
|
|
|
this.$nextTick(() => {
|
2018-02-14 11:03:48 +01:00
|
|
|
(this.$refs.form as any).focus();
|
|
|
|
});
|
2018-02-11 16:17:51 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2018-02-16 07:38:12 +01:00
|
|
|
onChangeUploadings(files) {
|
|
|
|
this.uploadings = files;
|
2018-02-11 16:17:51 +01:00
|
|
|
},
|
|
|
|
onChangeMedia(media) {
|
|
|
|
this.media = media;
|
2018-02-14 11:30:35 +01:00
|
|
|
},
|
2018-03-05 00:44:37 +01:00
|
|
|
onGeoAttached(geo) {
|
|
|
|
this.geo = geo;
|
|
|
|
},
|
2018-03-05 06:09:12 +01:00
|
|
|
onGeoDettached() {
|
|
|
|
this.geo = null;
|
|
|
|
},
|
2018-02-14 11:30:35 +01:00
|
|
|
onPosted() {
|
|
|
|
(this.$refs.window as any).close();
|
2018-02-11 16:17:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" module>
|
2018-03-05 00:44:37 +01:00
|
|
|
.icon
|
|
|
|
margin-right 8px
|
|
|
|
|
2018-02-11 16:23:05 +01:00
|
|
|
.count
|
2018-02-11 16:17:51 +01:00
|
|
|
margin-left 8px
|
|
|
|
opacity 0.8
|
|
|
|
|
|
|
|
&:before
|
|
|
|
content '('
|
|
|
|
|
|
|
|
&:after
|
|
|
|
content ')'
|
|
|
|
|
|
|
|
.postPreview
|
|
|
|
margin 16px 22px
|
|
|
|
|
|
|
|
</style>
|