diff options
Diffstat (limited to 'tbc/templates')
-rwxr-xr-x | tbc/templates/base.html | 1 | ||||
-rw-r--r-- | tbc/templates/tbc/upload-content-old.html | 72 |
2 files changed, 73 insertions, 0 deletions
diff --git a/tbc/templates/base.html b/tbc/templates/base.html index fbcfb05..a9b005e 100755 --- a/tbc/templates/base.html +++ b/tbc/templates/base.html @@ -105,6 +105,7 @@ <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.first_name }}<b class="caret"></b></a> <ul class="dropdown-menu"> + <li><a href="{% url 'tbc:SubmitBook' %}">Submit Book (OLD)</a></li> <li><a href="{% url 'tbc:ListAICTE' %}">Submit Proposal</a></li> <li><a href="{% url 'tbc:SubmitSample' %}">Submit Sample Notebook</a></li> <li><a href="{% url 'tbc:ConfirmBookDetails' %}">Submit Codes</a></li> diff --git a/tbc/templates/tbc/upload-content-old.html b/tbc/templates/tbc/upload-content-old.html new file mode 100644 index 0000000..8b3c692 --- /dev/null +++ b/tbc/templates/tbc/upload-content-old.html @@ -0,0 +1,72 @@ +{% extends 'base.html' %} + +{% block script %} +<script> +function validate_content() +{ + no_notebooks = {{ no_notebooks }}.length; + 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 %} +<center> + <h4>Submitting code for the book </h4> + <h4> {{ curr_book.title }} by {{ curr_book.author }}</h4> +</center> +<hr> +<div id="content-wrap" style="max-width:600px;"> + <p>Upload chapters as individual IPython notebooks. Please do not use spaces to name your Ipython Notebook files. For ex. + use "chapter1.ipynb instead of chapter 1.ipynb"</p> + <form action="/submit-code-old/{{ curr_book.id }}" method=POST enctype="multipart/form-data"> + {% csrf_token %} + {% for i in no_notebooks %} + <input type=text id=chapter{{i}} name=chapter{{i}} placeholder="Chapter {{ forloop.counter }} name"> + <input type=file id=notebook{{i}} name=notebook{{i}}> + {% endfor %} + <br> + <hr> + <p>Upload screenshots of Plots/Graphs/Charts(if any) "that you have plotted" and not from the textbook itself from any cahpter. If there are no plots/graphs/charts, then upload a screenshot of any chapter. Give proper caption for the screen shots. Only .png files are acceptable.</p> + {% for i in no_images %} + <input type=text id=caption{{i}} name=caption{{i}} placeholder="Caption {{ forloop.counter }}"> + <input type=file id=image{{i}} name=image{{i}}> + {% endfor %} + <br><br> + <center><input class="btn btn-primary" type=submit value=submit onClick="return validate_content();"></center> + </form> +</div> +{% endblock %} |