diff options
author | King | 2016-07-28 17:39:44 +0530 |
---|---|---|
committer | GitHub | 2016-07-28 17:39:44 +0530 |
commit | 2b03aeb36fa333ea1644a248c742cf0c1df12a5f (patch) | |
tree | 4c753ba9a1fbccf3e06d1ed1d998137c88a73b88 /yaksh/templates | |
parent | 344e1e804cee214c0d0f5c41ca16d871e786d4c3 (diff) | |
parent | 83bee9d89e163e98504c8aa210ce60200bd1cd1d (diff) | |
download | online_test-2b03aeb36fa333ea1644a248c742cf0c1df12a5f.tar.gz online_test-2b03aeb36fa333ea1644a248c742cf0c1df12a5f.tar.bz2 online_test-2b03aeb36fa333ea1644a248c742cf0c1df12a5f.zip |
Merge pull request #113 from adityacp/file_based_questions
File based questions
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/add_question.html | 15 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 9 |
2 files changed, 20 insertions, 4 deletions
diff --git a/yaksh/templates/yaksh/add_question.html b/yaksh/templates/yaksh/add_question.html index 255deaa..f003256 100644 --- a/yaksh/templates/yaksh/add_question.html +++ b/yaksh/templates/yaksh/add_question.html @@ -15,19 +15,27 @@ {% block onload %} onload='javascript:textareaformat();' {% endblock %} {% block manage %} -<form action="" method="post" name=frm onSubmit="return autosubmit();"> +<form action="" method="post" name=frm onSubmit="return autosubmit();" enctype="multipart/form-data"> {% csrf_token %} <center><table class=span1> <tr><td>Summary: <td>{{ form.summary }}{{ form.summary.errors }} <tr><td> Language: <td> {{form.language}}{{form.language.errors}} <tr><td> Active: <td> {{ form.active }}{{form.active.errors}} Type: {{ form.type }}{{form.type.errors}} - <tr><td>Points:<td><button class="btn-mini" type="button" onClick="increase(frm);">+</button>{{ form.points }}<button class="btn-mini" type="button" onClick="decrease(frm);">-</button>{{ form.points.errors }} + <tr><td>Points:<td><button class="btn-mini" type="button" onClick="increase(frm);">+</button>{{form.points }}<button class="btn-mini" type="button" onClick="decrease(frm);">-</button>{{ form.points.errors }} <tr><td><strong>Rendered: </strong><td><p id='my'></p> <tr><td>Description: <td>{{ form.description}} {{form.description.errors}} <tr><td>Tags: <td>{{ form.tags }} <tr><td>Snippet: <td>{{ form.snippet }} <tr><td> Test Case Type: <td> {{ form.test_case_type }}{{ form.test_case_type.errors }} - + <tr><td> File: <td> {{ upload_form.file_field }}{{ upload_form.file_field.errors }} + {% if uploaded_files %}<br><b>Uploaded files:</b><br>Check the box to delete or extract files<br> + {% for file in uploaded_files %} + <input type="checkbox" name="clear" value="{{file.id}}"> delete</input> + <input type="checkbox" name="extract" value="{{file.id}}" >{% if file.extract %} dont extract{% else %} + extract{% endif %}</input><br> + <a href="{{file.file.url}}">{{ file.file.name }}</a> + <br> + {% endfor %}{% endif %} <div class="form-group"> {{ test_case_formset.management_form }} @@ -43,6 +51,7 @@ <center> <button class="btn" type="submit" name="save_question">Save & Add Testcase</button> <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/questions/");'>Back to Questions</button> + <button class="btn" type="submit" name="delete_files">Delete Selected Files</button> </center> </form> {% endblock %} diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 40d4482..2d52009 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -142,7 +142,14 @@ function call_skip(url) <h4><u> {{ question.summary }} </u><font class=pull-right>(Marks : {{ question.points }}) </font></h4><br> <font size=3 face=arial> {{ question.description|safe }} </font> <br><font size=3 face=arial> Language: {{ question.language }} </font><br> - + {% if files %} + <h4>Files to download for this question</h4> + {% for file in files %} + {% if file.question_id == question.id %} + <h5><a href="{{file.file.url}}">{{file.file.name}}</a></h5> + {% endif %} + {% endfor %} + {% endif %} {% if question.type == "code" %} <br><h4>Output:</h4></br> {% if error_message %} |