From: Charles Holbrow Date: Thu, 21 Mar 2013 19:27:04 +0000 (-0400) Subject: \#add-note fragment functionality four course-detail.html X-Git-Tag: release-20150131~480 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4349a6e6591bd6a4bbdd3e10b34593bb12916abb;p=oweals%2Fkarmaworld.git \#add-note fragment functionality four course-detail.html --- diff --git a/karmaworld/assets/js/course-addNote.js b/karmaworld/assets/js/course-addNote.js deleted file mode 100644 index 0433394..0000000 --- a/karmaworld/assets/js/course-addNote.js +++ /dev/null @@ -1,8 +0,0 @@ -if(window.location.hash) { - - // Get the first hasgh, remove the # character - var hash = window.location.hash.substring(1); - if (hash === 'add-note'){ - alert('Adding a note!'); - } -} diff --git a/karmaworld/assets/js/lightboxupload.js b/karmaworld/assets/js/lightboxupload.js index 582d30c..9d4e183 100644 --- a/karmaworld/assets/js/lightboxupload.js +++ b/karmaworld/assets/js/lightboxupload.js @@ -5,6 +5,19 @@ $(function(){ // TODO: connect it to the '^ save' form submit // Show the upload lightbox on upload button click + // check if we arrived at this page planning on uploading a note + if(window.location.hash) { + + // Get the first hasgh, remove the # character + var hash = window.location.hash.substring(1); + if (hash === 'add-note'){ + + $('#add-note-form').show(); + $('#file-uploader').show(); + $('div.upload-status').hide(); + } + } + $('#add-note-btn').click(function(){ // show the add note form // TODO: rewrite to .show the form with a slide transition @@ -26,6 +39,11 @@ $(function(){ element: $('#file-uploader')[0], multiple: false, + onSubmit: function (id, fileName) { + $('#file-uploader').hide(); + $('div.upload-status').show(); + }, + onComplete: function( id, fileName, responseJSON ) { if( responseJSON.success ) { // activate the form for submitting diff --git a/karmaworld/templates/courses/course_detail.html b/karmaworld/templates/courses/course_detail.html index 47e62dd..f0e18eb 100644 --- a/karmaworld/templates/courses/course_detail.html +++ b/karmaworld/templates/courses/course_detail.html @@ -6,7 +6,6 @@ -