summaryrefslogtreecommitdiff
path: root/tbc/templates
diff options
context:
space:
mode:
authorhardythe12015-01-30 16:11:22 +0530
committerhardythe12015-01-30 16:11:22 +0530
commit1407dcdee0659e1aa5fa229627b6603c93abed35 (patch)
tree617a2a97da53fb79e2f67fed6ef9829af4d79266 /tbc/templates
parentacbb52e125ada046176b3e4bd679ddac6fee9fe7 (diff)
downloadPython-TBC-Interface-1407dcdee0659e1aa5fa229627b6603c93abed35.tar.gz
Python-TBC-Interface-1407dcdee0659e1aa5fa229627b6603c93abed35.tar.bz2
Python-TBC-Interface-1407dcdee0659e1aa5fa229627b6603c93abed35.zip
formatted mail message for proposal rejection & edited javascript for update code
Diffstat (limited to 'tbc/templates')
-rw-r--r--tbc/templates/tbc/update-code.html45
1 files changed, 43 insertions, 2 deletions
diff --git a/tbc/templates/tbc/update-code.html b/tbc/templates/tbc/update-code.html
index ee1d5b5..536617b 100644
--- a/tbc/templates/tbc/update-code.html
+++ b/tbc/templates/tbc/update-code.html
@@ -9,6 +9,47 @@ $(document).ready(function() {
});
});
</script>
+<script>
+function validate_content()
+{
+ no_notebooks = {{ no_notebooks }};
+ for(i=1;i<=no_notebooks;i++)
+ {
+ name = document.getElementById("chapter"+i).value;
+ extension = document.getElementById("notebook"+i).value;
+ extension = extension.split(".");
+ if (extension == "" || name == "")
+ {
+ alert("Chapter names & file fields cannot be empty !!");
+ return false;
+ }
+ if(extension.slice(Math.max(extension.length - 1, 1)) == "ipynb")
+ continue;
+ else
+ alert("Oops !! You can upload only Ipython Notebooks (.ipynb extension)");
+ return false;
+ }
+ for(i=1;i<=3;i++)
+ {
+ caption = document.getElementById("caption"+i).value;
+ extension = document.getElementById("image"+i).value;
+ extension = extension.split(".");
+ if (extension == "" || caption == "")
+ {
+ alert("Captions and file fields cannot be empty");
+ return false;
+ }
+
+ if(extension.slice(Math.max(extension.length - 1, 1)) == "png")
+ continue;
+ else
+ alert("Only .png files are allowed for screenshots");
+ return false;
+ }
+ return true;
+}
+</script>
+
{% endblock %}
{% block content %}
<div id="content-wrap" style="max-width:600px;">
@@ -18,7 +59,7 @@ $(document).ready(function() {
{% csrf_token %}
{% for chapter in chapters %}
<input class="chapters" type=text id=chapter{{forloop.counter}} name=chapter{{forloop.counter}} value="{{ chapter.name }}">
- <input type=file name=notebook{{forloop.counter}}>
+ <input type=file name=notebook{{forloop.counter}} id=notebook{{forloop.counter}}>
{% endfor %}
<br>
<hr>
@@ -33,7 +74,7 @@ $(document).ready(function() {
<input type=file id=image{{forloop.counter}} name=image{{forloop.counter}}>
{% endfor %}
<br><br>
- <center><input class="btn btn-primary" type=submit value=submit></center>
+ <center><input class="btn btn-primary" type=submit value=submit onClick="return validate_content();"></center>
</form>
</div>
{% endblock %}