From e21a60096c397f949848db0de4699eb41a7623de Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 6 Nov 2016 19:30:35 +0100 Subject: [PATCH] Add media upload to PostStatusForm. --- .../post_status_form/post_status_form.js | 17 +++++++++++++++-- .../post_status_form/post_status_form.vue | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 2c015154..30a7cd40 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -1,4 +1,6 @@ import statusPoster from '../../services/status_poster/status_poster.service.js' +import MediaUpload from '../media_upload/media_upload.vue' + import { reject, map, uniqBy } from 'lodash'; const buildMentionsString = ({user, attentions}, currentUser) => { @@ -23,6 +25,9 @@ const PostStatusForm = { 'repliedUser', 'attentions' ], + components: { + MediaUpload + }, data () { let statusText = '' @@ -33,7 +38,8 @@ const PostStatusForm = { return { newStatus: { - status: statusText + status: statusText, + files: [] } } }, @@ -41,11 +47,18 @@ const PostStatusForm = { postStatus (newStatus) { statusPoster.postStatus({ status: newStatus.status, + media: newStatus.files, store: this.$store, inReplyToStatusId: this.replyTo }) - this.newStatus = { } + this.newStatus = { + status: '', + files: [] + } this.$emit('posted') + }, + addMediaFile (fileInfo) { + this.newStatus.files.push(fileInfo) } } } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index d2106d5a..943bf422 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -10,7 +10,7 @@
- +