From ca71722c1eaa5c2aa4597bef38ca812c15294359 Mon Sep 17 00:00:00 2001 From: shpuld Date: Tue, 21 Feb 2017 15:13:19 +0200 Subject: [PATCH 01/29] Files dropped into post_status_form text box get sent to media_upload for attachment upload, media_upload reorganized a bit to allow reuse of existing code. --- src/components/media_upload/media_upload.js | 26 ++++++++++++++----- .../post_status_form/post_status_form.js | 7 +++++ .../post_status_form/post_status_form.vue | 4 +-- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/components/media_upload/media_upload.js b/src/components/media_upload/media_upload.js index 3f2e3964..3f6fec5b 100644 --- a/src/components/media_upload/media_upload.js +++ b/src/components/media_upload/media_upload.js @@ -3,12 +3,22 @@ import statusPosterService from '../../services/status_poster/status_poster.serv 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] + this.uploadFile(file) + }) + }, + data () { + return { + uploading: false + } + }, + methods: { + uploadFile(file) { + const self = this + const store = this.$store const formData = new FormData() formData.append('media', file) @@ -23,11 +33,15 @@ const mediaUpload = { self.$emit('upload-failed') self.uploading = false }) - }) + } }, - data () { - return { - uploading: false + props: [ + 'dropFiles' + ], + watch: { + 'dropFiles': function (fileInfos) { + if (!this.uploading) + this.uploadFile(fileInfos[0]) } } } diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 3365c569..e798b196 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -84,6 +84,7 @@ const PostStatusForm = { } return { + dropFiles: [], submitDisabled: false, newStatus: { status: statusText, @@ -141,6 +142,12 @@ 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 + } } } } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 1bad41c7..57572f65 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -2,7 +2,7 @@
- +
@@ -14,7 +14,7 @@
- +
From f385e64a7c3922fee229cd9bf907dd0949090f13 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 21 Feb 2017 15:23:46 +0100 Subject: [PATCH 02/29] Update vue-style-loader. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 568aa87a..52733425 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "sinon-chai": "^2.8.0", "url-loader": "^0.5.7", "vue-loader": "^11.1.0", - "vue-style-loader": "^1.0.0", + "vue-style-loader": "^2.0.0", "webpack": "^1.13.2", "webpack-dev-middleware": "^1.8.3", "webpack-hot-middleware": "^2.12.2", From 137a7e643d22be6461f79cc134df1e459c576228 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 21 Feb 2017 15:24:05 +0100 Subject: [PATCH 03/29] Remove flex from general attachments. --- src/components/attachment/attachment.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 738a1e86..e0eba6a9 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -16,8 +16,6 @@ - Don't know how to display this... -
@@ -38,12 +36,12 @@ flex-wrap: wrap; .attachment { flex: 1 0 30%; - display: flex; margin: 0.5em 0.8em 0.6em 0.1em; align-self: flex-start; &.html { flex-basis: 100%; + display: flex; } .hider { From 40fe40d96b2a4dadf706637954b529ee80af75a4 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 21 Feb 2017 15:24:35 +0100 Subject: [PATCH 04/29] Better attachment removal styling. --- src/components/post_status_form/post_status_form.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 1bad41c7..ebb92b26 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -6,11 +6,11 @@
@@ -52,6 +52,15 @@ .attachments { padding: 0.5em; + + i { + position: absolute; + margin: 10px; + padding: 5px; + background: rgba(230,230,230,0.6); + border-radius: 0.5em; + font-weight: bold; + } } form { From 892b826df59203a920bfebbd2ac37ef62dcf411b Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 21 Feb 2017 21:48:48 +0100 Subject: [PATCH 05/29] Small style adjustment, add meta-enter posting. --- src/components/media_upload/media_upload.js | 5 +++-- src/components/post_status_form/post_status_form.js | 2 +- src/components/post_status_form/post_status_form.vue | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/media_upload/media_upload.js b/src/components/media_upload/media_upload.js index 3f6fec5b..746970aa 100644 --- a/src/components/media_upload/media_upload.js +++ b/src/components/media_upload/media_upload.js @@ -16,7 +16,7 @@ const mediaUpload = { } }, methods: { - uploadFile(file) { + uploadFile (file) { const self = this const store = this.$store const formData = new FormData() @@ -40,8 +40,9 @@ const mediaUpload = { ], watch: { 'dropFiles': function (fileInfos) { - if (!this.uploading) + if (!this.uploading) { this.uploadFile(fileInfos[0]) + } } } } diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index e798b196..d55525bb 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -144,7 +144,7 @@ const PostStatusForm = { return fileTypeService.fileType(fileInfo.mimetype) }, fileDrop (e) { - if(e.dataTransfer.files.length > 0) { + if (e.dataTransfer.files.length > 0) { e.preventDefault() // allow dropping text like before this.dropFiles = e.dataTransfer.files } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index d9138109..eceef4a2 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -2,7 +2,7 @@
- +
From aa3512205dedff9df4b041ecd7eeb8c083e8ff2f Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 22 Feb 2017 10:32:09 +0100 Subject: [PATCH 06/29] Only save every minute. --- src/lib/persisted_state.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js index de1e5383..31ced37d 100644 --- a/src/lib/persisted_state.js +++ b/src/lib/persisted_state.js @@ -51,7 +51,7 @@ export default function createPersistedState ({ } return value && value !== 'undefined' ? JSON.parse(value) : undefined }, - setState = throttle(defaultSetState, 5000), + setState = throttle(defaultSetState, 60000), reducer = defaultReducer, storage = defaultStorage, subscriber = store => handler => store.subscribe(handler) From 874f9765318897bfde0cf80c9e75da9b3b66f25d Mon Sep 17 00:00:00 2001 From: shpuld Date: Wed, 22 Feb 2017 11:54:09 +0200 Subject: [PATCH 07/29] Hide Follow-button and 'Follows you' text when not logged in --- .../user_card_content/user_card_content.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index 59cee734..ee4384fa 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -7,18 +7,18 @@
{{user.name}}
@{{user.screen_name}}
-
+
Follows you!
-