diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-11-06 17:52:37 -0600 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-11-06 17:52:37 -0600 |
commit | 843a15ae26262ff0ea4ad447f5313e50a94d3d06 (patch) | |
tree | 389d0171adf93c6a826f687933bf61aacc1f5241 | |
parent | c34a08bddf0ac04275eba5d857ecdda83fb11c90 (diff) | |
download | gitlab-ce-10-1-jivl-fix-cancel-button-file-upload-new-issue.tar.gz |
Solved conflicts10-1-jivl-fix-cancel-button-file-upload-new-issue
-rw-r--r-- | app/assets/javascripts/dropzone_input.js | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index c0645c48cfe..60d31bf7396 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -117,74 +117,8 @@ window.DropzoneInput = (function() { $('.dz-preview').remove(); $('.markdown-area').trigger('input'); -<<<<<<< HEAD $uploadingProgressContainer.addClass('hide'); $cancelButton.addClass('hide'); -======= - $uploadingErrorContainer.removeClass('hide'); - $uploadingErrorMessage.html(message); - $attachButton.addClass('hide'); - $cancelButton.addClass('hide'); - }, - totaluploadprogress(totalUploadProgress) { - updateAttachingMessage(this.files, $attachingFileMessage); - $uploadProgress.text(`${Math.round(totalUploadProgress)}%`); - }, - sending: () => { - // DOM elements already exist. - // Instead of dynamically generating them, - // we just either hide or show them. - $attachButton.addClass('hide'); - $uploadingErrorContainer.addClass('hide'); - $uploadingProgressContainer.removeClass('hide'); - $cancelButton.removeClass('hide'); - }, - removedfile: () => { - $attachButton.removeClass('hide'); - $cancelButton.addClass('hide'); - $uploadingProgressContainer.addClass('hide'); - $uploadingErrorContainer.addClass('hide'); - }, - queuecomplete: () => { - $('.dz-preview').remove(); - $('.markdown-area').trigger('input'); - - $uploadingProgressContainer.addClass('hide'); - $cancelButton.addClass('hide'); - }, - }); - - const child = $(dropzone[0]).children('textarea'); - - // removeAllFiles(true) stops uploading files (if any) - // and remove them from dropzone files queue. - $cancelButton.on('click', (e) => { - e.preventDefault(); - e.stopPropagation(); - Dropzone.forElement($formDropzone.get(0)).removeAllFiles(true); - }); - - // If 'error' event is fired, we store a failed files, - // clear dropzone files queue, change status of failed files to undefined, - // and add that files to the dropzone files queue again. - // addFile() adds file to dropzone files queue and upload it. - $retryLink.on('click', (e) => { - const dropzoneInstance = Dropzone.forElement(e.target.closest('.js-main-target-form').querySelector('.div-dropzone')); - const failedFiles = dropzoneInstance.files; - - e.preventDefault(); - - // 'true' parameter of removeAllFiles() cancels - // uploading of files that are being uploaded at the moment. - dropzoneInstance.removeAllFiles(true); - - failedFiles.map((failedFile) => { - const file = failedFile; - - if (file.status === Dropzone.ERROR) { - file.status = undefined; - file.accepted = undefined; ->>>>>>> 95f9f05378... Merge branch 'jivl-fix-cancel-button-file-upload-new-issue' into 'master' } }); @@ -193,11 +127,9 @@ window.DropzoneInput = (function() { // removeAllFiles(true) stops uploading files (if any) // and remove them from dropzone files queue. $cancelButton.on('click', (e) => { - const target = e.target.closest('.js-main-target-form').querySelector('.div-dropzone'); - e.preventDefault(); e.stopPropagation(); - Dropzone.forElement(target).removeAllFiles(true); + Dropzone.forElement($formDropzone.get(0)).removeAllFiles(true); }); // If 'error' event is fired, we store a failed files, |