From 134fcbcba1ae23abb2ba2ad7b80c058baf43fb33 Mon Sep 17 00:00:00 2001 From: Charles Holbrow Date: Thu, 21 Mar 2013 17:12:59 -0400 Subject: [PATCH] fixing filepicker upload behavior - keep upload botton visible when user cancels file picker dialog --- karmaworld/assets/js/lightboxupload.js | 15 +++++++++++---- karmaworld/templates/partial/add_note.html | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) 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 %}
-
+ -- 2.25.1