\#add-note fragment functionality four course-detail.html
authorCharles Holbrow <charlesholbrow@gmail.com>
Thu, 21 Mar 2013 19:27:04 +0000 (15:27 -0400)
committerCharles Holbrow <charlesholbrow@gmail.com>
Thu, 21 Mar 2013 19:27:04 +0000 (15:27 -0400)
karmaworld/assets/js/course-addNote.js [deleted file]
karmaworld/assets/js/lightboxupload.js
karmaworld/templates/courses/course_detail.html
karmaworld/templates/partial/add_note.html

diff --git a/karmaworld/assets/js/course-addNote.js b/karmaworld/assets/js/course-addNote.js
deleted file mode 100644 (file)
index 0433394..0000000
+++ /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!');
-  }
-}
index 582d30c0d3f6d202622237f7c9641f0328ede29b..9d4e1833ebd4e0a1c1cfd3d9d50a7488fb41942e 100644 (file)
@@ -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
index 47e62dd034e4d958ee683cd99f9325c76b18f881..f0e18ebca034176be777fa6eb8661c4bf952128d 100644 (file)
@@ -6,7 +6,6 @@
   <script src="{{ STATIC_URL }}js/bootstrap-modal.js" ></script>
   <script src="{{ STATIC_URL }}ajaxuploader/js/fileuploader.js" ></script>
   <script src="{{ STATIC_URL }}js/lightboxupload.js" ></script>
-  <script src="{{ STATIC_URL }}js/course-addNote.js" ></script>
   <script>
     var courseId  = {{ course.id }};
     var csrf_token = "{{ csrf_token }}";
index 3e936320e2ba361dce69fd0a08dbf3919e47e51f..63a1f8d5ba7a6e143bb174dc13df8a0ebdee72d1 100644 (file)
@@ -9,7 +9,7 @@
   <form id=add-note method="POST">
     {% csrf_token %}
     <div class="row">
-      <div class="four columns offset-by-one">
+      <div class="four columns offset-by-one upload-status">
         <legend><span id=add-note-status>Uploading</span> <span id=filename>note</span>...</legend>
         <div class=progress> <div id="progress-fill"></div> </div>
       </div>