From: Seth Woodworth Date: Thu, 21 Mar 2013 16:46:03 +0000 (-0400) Subject: update lightboxupload javascript to work with new add-note partial X-Git-Tag: release-20150131~483^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=058fc844529fdcd5b67b191bd51917bab4a2a961;p=oweals%2Fkarmaworld.git update lightboxupload javascript to work with new add-note partial --- diff --git a/karmaworld/assets/js/lightboxupload.js b/karmaworld/assets/js/lightboxupload.js index 3243d66..d988e4b 100644 --- a/karmaworld/assets/js/lightboxupload.js +++ b/karmaworld/assets/js/lightboxupload.js @@ -8,6 +8,12 @@ $(function(){ $('#add-note-btn').click(function(){ // TODO: rewrite to .show the form with a slide transition $('#add-note-form').show(); + $('input#file_upload_input').click(); + }); + + // Submit the add-note form + $('#save-btn').click(function(){ + $('#add-note-form').submit(); }); // Dismiss x click @@ -16,9 +22,9 @@ $(function(){ }); var uploader = new qq.FileUploader( { - action: uploadUrl, // added to page via template var + action: ajax_upload_url, // added to page via template var element: $('#file-uploader')[0], - multiple: true, + multiple: false, onComplete: function( id, fileName, responseJSON ) { if( responseJSON.success ) { //console.log( "success!" ) ; @@ -32,6 +38,12 @@ $(function(){ console.log( "All complete!" ) ; // TODO: set a success state }, + onProgress: function(id, fileName, loaded, total) { + console.log("running onProgress " + fileName + " " + loaded); + console.log(String((100*loaded/total)+'%')); + $('#progress-fill').animate({ + width: String((100*loaded/total)+'%')}, 5000); + }, params: { 'csrf_token': csrf_token, 'csrf_name': 'csrfmiddlewaretoken',