+++ /dev/null
-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!');
- }
-}
// 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
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
<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 }}";
<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>