diff options
| author | Roger Braun <roger@rogerbraun.net> | 2016-11-07 11:56:14 +0100 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2016-11-07 11:56:14 +0100 |
| commit | cf972e968cd1e059c4a7a05a9a3d42f3da05414b (patch) | |
| tree | 2d7d9ee5408397f1ac5d36fa98943158d5a105c4 /src/components/media_upload | |
| parent | acc439f26684d3d188542e904190532ac781c936 (diff) | |
| parent | 83e7add2c7cd3d7b878c82ffb86e09479bff3500 (diff) | |
Merge branch 'master' of ssh.gitgud.io:lambadalambda/pleroma-fe
Diffstat (limited to 'src/components/media_upload')
| -rw-r--r-- | src/components/media_upload/media_upload.js | 22 | ||||
| -rw-r--r-- | src/components/media_upload/media_upload.vue | 17 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/components/media_upload/media_upload.js b/src/components/media_upload/media_upload.js new file mode 100644 index 00000000..c24c71e9 --- /dev/null +++ b/src/components/media_upload/media_upload.js @@ -0,0 +1,22 @@ +/* eslint-env browser */ +import statusPosterService from '../../services/status_poster/status_poster.service.js' + +const mediaUpload = { + mounted () { + const store = this.$store + const input = this.$el.querySelector('input') + const self = this + + input.addEventListener('change', ({target}) => { + const file = target.files[0]; + const formData = new FormData(); + formData.append('media', file); + statusPosterService.uploadMedia({ store, formData }) + .then((fileData) => { + self.$emit('uploaded', fileData) + }) + }) + } +} + +export default mediaUpload diff --git a/src/components/media_upload/media_upload.vue b/src/components/media_upload/media_upload.vue new file mode 100644 index 00000000..a62d8316 --- /dev/null +++ b/src/components/media_upload/media_upload.vue @@ -0,0 +1,17 @@ +<template> + <div class="media-upload"> + <label class="btn btn-default"> + <i class="fa icon-upload"></i> + <input type=file style="position: fixed; top: -100em"></input> + </label> + </div> +</template> + +<script src="./media_upload.js" ></script> + +<style> + .media-upload { + font-size: 26px; + flex: 1; + } +</style> |
