diff options
Diffstat (limited to 'tbc/templates/tbc/update-code.html')
-rw-r--r-- | tbc/templates/tbc/update-code.html | 27 |
1 files changed, 22 insertions, 5 deletions
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 %} |