From: Charles Holbrow Date: Thu, 21 Mar 2013 21:12:59 +0000 (-0400) Subject: fixing filepicker upload behavior - keep upload botton visible when user cancels... X-Git-Tag: release-20150131~477 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=134fcbcba1ae23abb2ba2ad7b80c058baf43fb33;p=oweals%2Fkarmaworld.git fixing filepicker upload behavior - keep upload botton visible when user cancels file picker dialog --- diff --git a/karmaworld/assets/js/lightboxupload.js b/karmaworld/assets/js/lightboxupload.js index a49f996..0dd9476 100644 --- a/karmaworld/assets/js/lightboxupload.js +++ b/karmaworld/assets/js/lightboxupload.js @@ -12,14 +12,11 @@ $(function(){ var hash = window.location.hash.substring(1); if (hash === 'add-note'){ $('#add-note-form').show(); - $('div.upload-status').hide(); $('#add-note-btn').hide(); } } $('#add-note-btn').click(function(){ - // hide the button added by qq - $('#file-uploader').hide(); // show the add note form // TODO: rewrite to .show the form with a slide transition $('#add-note-form').show(); @@ -43,8 +40,18 @@ $(function(){ onSubmit: function (id, fileName) { $('#file-uploader').hide(); $('div.upload-status').show(); + // hide the button added by qq + $('#file-uploader').hide(); + // show the progress bar + $('div.upload-status').show(); + console.log('fileName:', fileName); + }, + onError: function (id, fileName, errorReason) { + console.log('FileUploader error:', errorReason); + }, + onCancel: function (id, fileName) { + console.log('FileUploader cancel:', onCancel); }, - onComplete: function( id, fileName, responseJSON ) { if( responseJSON.success ) { console.log("responseJSON.note_url " + responseJSON.note_url); diff --git a/karmaworld/templates/partial/add_note.html b/karmaworld/templates/partial/add_note.html index 58c025e..202297a 100644 --- a/karmaworld/templates/partial/add_note.html +++ b/karmaworld/templates/partial/add_note.html @@ -9,7 +9,7 @@
{% csrf_token %}
-
+