diff options
| author | Roger Braun <roger@rogerbraun.net> | 2017-02-26 11:39:42 +0100 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2017-02-26 11:39:42 +0100 |
| commit | 290180a987ecb4949fc877c512f3cff120bcbc70 (patch) | |
| tree | 7217c877059e94bd9a435021b7e2cd42b66e24cb /src/components/post_status_form | |
| parent | 7661357cf669ef57bfdd3e39c0c5574094984de4 (diff) | |
| parent | bebd5c3328422aacf65996776e282d032347c5c9 (diff) | |
Merge branch 'develop' into feature/hash-routed
Diffstat (limited to 'src/components/post_status_form')
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 12 | ||||
| -rw-r--r-- | src/components/post_status_form/post_status_form.vue | 25 |
2 files changed, 29 insertions, 8 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 3365c569..01aeeb68 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -49,7 +49,7 @@ const defaultCollection = { menuContainer: document.body, // column to search against in the object (accepts function or string) - lookup: ({name, screen_name}) => `${name} (@${screen_name})`, + lookup: ({name, screen_name}) => `${name} (@${screen_name})`, // eslint-disable-line camelcase // column that contains the content to insert by default fillAttr: 'screen_name', @@ -84,6 +84,7 @@ const PostStatusForm = { } return { + dropFiles: [], submitDisabled: false, newStatus: { status: statusText, @@ -141,6 +142,15 @@ const PostStatusForm = { }, type (fileInfo) { return fileTypeService.fileType(fileInfo.mimetype) + }, + fileDrop (e) { + if (e.dataTransfer.files.length > 0) { + e.preventDefault() // allow dropping text like before + this.dropFiles = e.dataTransfer.files + } + }, + fileDrag (e) { + e.dataTransfer.dropEffect = 'copy' } } } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 1bad41c7..07280a41 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -2,20 +2,20 @@ <div class="post-status-form"> <form @submit.prevent="postStatus(newStatus)"> <div class="form-group" > - <textarea v-model="newStatus.status" placeholder="Just landed in L.A." rows="3" class="form-control" @keyup.ctrl.enter="postStatus(newStatus)"></textarea> + <textarea v-model="newStatus.status" placeholder="Just landed in L.A." rows="3" class="form-control" @keyup.meta.enter="postStatus(newStatus)" @keyup.ctrl.enter="postStatus(newStatus)" @drop="fileDrop" @dragover.prevent="fileDrag"></textarea> </div> <div class="attachments"> <div class="attachment" v-for="file in newStatus.files"> + <i class="fa icon-cancel" @click="removeMediaFile(file)"></i> <img class="thumbnail media-upload" :src="file.image" v-if="type(file) === 'image'"></img> <video v-if="type(file) === 'video'" :src="file.image" controls></video> <audio v-if="type(file) === 'audio'" :src="file.image" controls></audio> <a v-if="type(file) === 'unknown'" :href="file.image">{{file.url}}</a> - <i class="fa icon-cancel" @click="removeMediaFile(file)"></i> </div> </div> <div class='form-bottom'> - <media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit"></media-upload> - <button :disabled="submitDisabled" type="submit" class="btn btn-default">Submit</button> + <media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit" :drop-files="dropFiles"></media-upload> + <button :disabled="submitDisabled" type="submit" class="btn btn-default base05 base01-background">Submit</button> </div> </form> </div> @@ -52,6 +52,15 @@ .attachments { padding: 0.5em; + + i { + position: absolute; + margin: 10px; + padding: 5px; + background: rgba(230,230,230,0.6); + border-radius: 5px; + font-weight: bold; + } } form { @@ -68,10 +77,12 @@ } form textarea { - border: none; - border-radius: 2px; + border: solid; + border-width: 1px; + border-color: silver; + border-radius: 5px; line-height:16px; - padding: 0.5em; + padding: 5px; resize: vertical; } |
