3 // Show the 'add note' form
4 // first, instantiate the fileuploader on page load
5 // TODO: connect it to the '^ save' form submit
6 // Show the upload lightbox on upload button click
8 $('#add-note-btn').click(function(){
9 // TODO: rewrite to .show the form with a slide transition
10 $('#add-note-form').show();
14 $(".lightbox_close").click(function() {
15 $(".modal_content").hide();
18 var uploader = new qq.FileUploader( {
19 action: uploadUrl, // added to page via template var
20 element: $('#file-uploader')[0],
22 onComplete: function( id, fileName, responseJSON ) {
23 if( responseJSON.success ) {
24 //console.log( "success!" ) ;
25 $('form#upload_form').attr('action', responseJSON.note_url);
26 $('input.submit_upload').show();
29 onAllComplete: function( uploads ) {
30 // uploads is an array of maps
31 // the maps look like this: { file: FileObject, response: JSONServerResponse }
32 console.log( "All complete!" ) ;
33 // TODO: set a success state
36 'csrf_token': csrf_token,
37 'csrf_name': 'csrfmiddlewaretoken',
38 'csrf_xname': 'X-CSRFToken',
39 'course_id': courseId, // added to page via template var