diff options
| author | Roger Braun <roger@rogerbraun.net> | 2016-11-06 19:30:35 +0100 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2016-11-06 19:30:35 +0100 |
| commit | e21a60096c397f949848db0de4699eb41a7623de (patch) | |
| tree | 3f2c52634a04ac908f06f547607fe90631e68a37 /src | |
| parent | 7e2e2d3ec3e7eb79674777c63f0d89e6d55fbbd0 (diff) | |
Add media upload to PostStatusForm.
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 17 | ||||
| -rw-r--r-- | src/components/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 @@ </div> </div> <div class='form-bottom'> - <media-upload files="newStatus.files"></media-upload> + <media-upload v-on:uploaded="addMediaFile"></media-upload> <button type="submit" class="btn btn-default" >Submit</button> </div> </form> |
