diff options
Diffstat (limited to 'tbc/templates')
-rw-r--r-- | tbc/templates/tbc/book-details.html | 6 | ||||
-rw-r--r-- | tbc/templates/tbc/book-review-details.html | 6 | ||||
-rw-r--r-- | tbc/templates/tbc/update-code.html | 27 | ||||
-rw-r--r-- | tbc/templates/tbc/upload-content.html | 14 |
4 files changed, 45 insertions, 8 deletions
diff --git a/tbc/templates/tbc/book-details.html b/tbc/templates/tbc/book-details.html index 415666d..dc8c272 100644 --- a/tbc/templates/tbc/book-details.html +++ b/tbc/templates/tbc/book-details.html @@ -19,7 +19,11 @@ function redirectToIpynb(notebook) <div class="row-fluid"> {% for image in images %} <div class ="module-list"> - <img src="{% static 'uploads/' %}{{ image.image }}"> + {% if image.chapters_set.get.notebook %} + <a href="{% url 'tbc:ConvertNotebook' image.chapters_set.get.notebook %}"><img src="{% static 'uploads/' %}{{ image.image }}"></a> + {% else %} + <img src="{% static 'uploads/' %}{{ image.image }}"> + {% endif %} <center><p style="margin-top:30px;">{{ image.caption }}</p></center> </div> {% endfor %} diff --git a/tbc/templates/tbc/book-review-details.html b/tbc/templates/tbc/book-review-details.html index 1aa888c..e546220 100644 --- a/tbc/templates/tbc/book-review-details.html +++ b/tbc/templates/tbc/book-review-details.html @@ -5,7 +5,11 @@ <div class="row-fluid"> {% for image in images %} <div class ="module-list"> - <img src="{% static 'uploads/' %}{{ image.image }}"> + {% if image.chapters_set.get.notebook %} + <a href="{% url 'tbc:ConvertNotebook' image.chapters_set.get.notebook %}"><img src="{% static 'uploads/' %}{{ image.image }}"></a> + {% else %} + <img src="{% static 'uploads/' %}{{ image.image }}"> + {% endif %} <center><p style="margin-top:30px;">{{ image.caption }}</p></center> </div> {% endfor %} diff --git a/tbc/templates/tbc/update-code.html b/tbc/templates/tbc/update-code.html index cce2038..ee1d5b5 100644 --- a/tbc/templates/tbc/update-code.html +++ b/tbc/templates/tbc/update-code.html @@ -1,4 +1,15 @@ {% extends 'base.html' %} +{% block script %} +<script src="/static/js/jquery.js" type="text/javascript"></script> +<script> +$(document).ready(function() { + $(".chapters").on('change', function() { + var str = "option[id='image_"+$(this).attr('id')+"']"; + $(str).text($(this).val()); + }); +}); +</script> +{% endblock %} {% block content %} <div id="content-wrap" style="max-width:600px;"> <p>You are updating codes for the book {{ book.title }} by {{ book.author }}</p> @@ -6,17 +17,23 @@ <form action="/submit-code/" method=POST enctype="multipart/form-data"> {% csrf_token %} {% for chapter in chapters %} - <input type=text name=chapter{{forloop.counter}} value="{{ chapter.name }}"> - <input type=file name=notebook{{forloop.counter}}> + <input class="chapters" type=text id=chapter{{forloop.counter}} name=chapter{{forloop.counter}} value="{{ chapter.name }}"> + <input type=file name=notebook{{forloop.counter}}> {% endfor %} <br> <hr> <p>Upload 3 screenshots from any 3 random chapters and give proper captions</p> {% for screenshot in screenshots %} <input type=text name=caption{{forloop.counter}} value="{{ screenshot.caption }}"> - <input type=file name=image{{forloop.counter}}> - {% endfor %} - <center><input type=submit value=submit></center> + <label class="label label-info" for="chapter_image{{forloop.counter}}">Select Chapter: </label><select id=chapter_image{{forloop.counter}} name=chapter_image{{forloop.counter}}> + {% for chapter in chapters %} + <option name=image_chapter{{forloop.counter}} id=image_chapter{{forloop.counter}} value = chapter{{forloop.counter}} >{{ chapter.name}}</option> + {% endfor %} + </select> + <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> </form> </div> {% endblock %} diff --git a/tbc/templates/tbc/upload-content.html b/tbc/templates/tbc/upload-content.html index 2423bd4..0c187d9 100644 --- a/tbc/templates/tbc/upload-content.html +++ b/tbc/templates/tbc/upload-content.html @@ -1,7 +1,14 @@ {% extends 'base.html' %} {% block script %} +<script src="/static/js/jquery.js" type="text/javascript"></script> <script> +$(document).ready(function() { + $(".chapters").on('change', function() { + var str = "option[id='image_"+$(this).attr('id')+"']"; + $(str).text($(this).val()); + }); +}); function validate_content() { no_notebooks = {{ no_notebooks }}.length; @@ -55,7 +62,7 @@ function validate_content() <form action="/submit-code/" 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 class="chapters" type=text id=chapter{{i}} name=chapter{{i}} placeholder="Chapter {{ forloop.counter }} name"> <input type=file id=notebook{{i}} name=notebook{{i}}> {% endfor %} <br> @@ -63,6 +70,11 @@ function validate_content() <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 }}"> + <label class="label label-info" for="chapter_image{{i}}">Select Chapter: </label><select id=chapter_image{{i}} name=chapter_image{{i}}> + {% for i in no_notebooks %} + <option name=image_chapter{{i}} id=image_chapter{{i}} value = chapter{{i}}>chapter {{i}}</option> + {% endfor %} + </select> <input type=file id=image{{i}} name=image{{i}}> {% endfor %} <br><br> |