From 7a379267035c182beea3e691a0a2c25dfc3b8e0f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 15 Apr 2019 19:39:54 -0600 Subject: [PATCH] Update ComposeModal.vue component --- .../assets/js/components/ComposeModal.vue | 97 +++++++++++-------- 1 file changed, 57 insertions(+), 40 deletions(-) diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index 4d200647a..0ff342d84 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -25,43 +25,53 @@
-
-

Click here to add photos.

+
+
+
+ +

Uploading...

+
+
-
- - - -
- -
-
-
-
-
- + + +
+
+ +
@@ -84,7 +94,7 @@
-
+

@@ -101,7 +111,7 @@

-
+
@@ -234,7 +247,9 @@ export default { carouselCursor: 0, visibility: 'public', mediaDrawer: false, - composeState: 'publish' + composeState: 'publish', + uploading: false, + uploadProgress: 0 } }, @@ -323,6 +338,7 @@ export default { $(document).on('change', '.file-input', function(e) { let io = document.querySelector('.file-input'); Array.prototype.forEach.call(io.files, function(io, i) { + self.uploading = true; if(self.media && self.media.length + i >= self.config.uploader.album_limit) { swal('Error', 'You can only upload ' + self.config.uploader.album_limit + ' photos per album', 'error'); return; @@ -341,6 +357,7 @@ export default { let xhrConfig = { onUploadProgress: function(e) { let progress = Math.round( (e.loaded * 100) / e.total ); + self.uploadProgress = progress; } }; @@ -349,8 +366,8 @@ export default { self.ids.push(e.data.id); self.media.push(e.data); setTimeout(function() { - self.mediaDrawer = true; - }, 1000); + self.uploading = false; + }, 500); }).catch(function(e) { swal('Oops, something went wrong!', 'An unexpected error occurred.', 'error'); });