diff options
author | ankitjavalkar | 2016-04-26 19:37:42 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-05-05 19:19:00 +0530 |
commit | c557e19470a389aaac569516ed56e1c5b453fd88 (patch) | |
tree | 9e4ac79d2ece44f434aa0625d58e198e6875102c /yaksh/templates | |
parent | 5684b1b19fcb383f494f0bfc04ad1bb760abce74 (diff) | |
download | online_test-c557e19470a389aaac569516ed56e1c5b453fd88.tar.gz online_test-c557e19470a389aaac569516ed56e1c5b453fd88.tar.bz2 online_test-c557e19470a389aaac569516ed56e1c5b453fd88.zip |
Add views, forms and templates (with JS) for new test cases:
- Add a view and template to list out test cases for particular question
- Add a view and template to add/edit test cases
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/add_question.html | 15 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_testcase.html | 32 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_testcase.html | 31 |
3 files changed, 66 insertions, 12 deletions
diff --git a/yaksh/templates/yaksh/add_question.html b/yaksh/templates/yaksh/add_question.html index 0d74663..44aca9d 100644 --- a/yaksh/templates/yaksh/add_question.html +++ b/yaksh/templates/yaksh/add_question.html @@ -25,11 +25,11 @@ <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>Snippet: <td>{{ form.snippet }}{{ form.snippet.errors }}</td></tD></td></tr> + <!-- <tr><td>Snippet: <td>{{ form.snippet }}{{ form.snippet.errors }}</td></tD></td></tr> --> <tr><td>Tags: <td>{{ form.tags }} - <tr><td id='label_option'>Options: <td>{{ form.options }} {{form.options.errors}} + <!-- <tr><td id='label_option'>Options: <td>{{ form.options }} {{form.options.errors}} --> <!-- <tr><td id='label_solution'>Test: <td>{{ form.test }} {{form.test.errors}} --> - <tr><td id='label_ref_code_path'>Reference Code Path: <td>{{ form.ref_code_path }} {{form.ref_code_path.errors}} + <!-- <tr><td id='label_ref_code_path'>Reference Code Path: <td>{{ form.ref_code_path }} {{form.ref_code_path.errors}} --> <tr><td> test_case_type: <td> {{ form.test_case_type }}{{ form.test_case_type.errors }} <form method="post" action=""> @@ -41,7 +41,12 @@ {% endif %} </form> </table></center> - <center><button class="btn" type="submit" name="save_question">Save</button> - <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/questions/");'>Cancel</button> </center> + <center> + <button class="btn" type="submit" name="save_question">Save</button> + <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/questions/");'>Cancel</button> + {% if question_id %} + <button class="btn" type="button" name="testcase_button" onClick='location.replace("{{URL_ROOT}}/exam/manage/showtestcase/{{ question_id }}/");'>Go To TestCases</button> + {% endif %} + </center> </form> {% endblock %} diff --git a/yaksh/templates/yaksh/add_testcase.html b/yaksh/templates/yaksh/add_testcase.html index 298bd50..7e29765 100644 --- a/yaksh/templates/yaksh/add_testcase.html +++ b/yaksh/templates/yaksh/add_testcase.html @@ -1,21 +1,39 @@ {% extends "manage.html" %} - -{% block subtitle %}Add Question{% endblock %} +{% block subtitle %}Add Test Case{% endblock %} {% block css %} <link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/question_quiz.css" type="text/css" /> -<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/yaksh/css/autotaggit.css" /> {% endblock %} +{% block manage %} +<form name=frm id=frm action="" method="post" > + {% csrf_token %} + <center> + <table class=span1> + {{ form.as_table }} + </table> + </center> + + <center><button class="btn primary" type="submit" id="submit" name="testcase">Save</button> + <button class="btn primary" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/showtestcase/{{question_id}}");'>Cancel</button> </center> +</form> +{% endblock %} + +<!-- {% comment %}{% extends "manage.html" %} + +{% block subtitle %}Add Testcase{% endblock %} + {% block script %} <script type="text/javascript" src="{{ URL_ROOT }}/static/yaksh/js/jquery-1.4.2.min.js"></script> -<script src="{{ URL_ROOT }}/static/yaksh/js/add_question.js"></script> {% endblock %} {% block onload %} onload='javascript:textareaformat();' {% endblock %} {% block manage %} -<form action="" method="post" name=frm> -<tr><td>Test Case: <td>{{ form.test_case }}{{ form.test_case.errors }} -</form>
\ No newline at end of file +<form name=testcase_frm id=testcase_frm action="" method="post"> +{{ form.as_table }} +</form> +<button class="btn" type="submit" name="save_testcase">Save</button> +{% endblock %}{% endcomment %} + --> diff --git a/yaksh/templates/yaksh/show_testcase.html b/yaksh/templates/yaksh/show_testcase.html new file mode 100644 index 0000000..b9cb55f --- /dev/null +++ b/yaksh/templates/yaksh/show_testcase.html @@ -0,0 +1,31 @@ +{% extends "manage.html" %} + +{% block title %} Test Case List {% endblock title %} + +{% block script %} +<script src="{{ URL_ROOT }}/static/yaksh/js/show_testcase.js"></script> +{% endblock %} + +{% block subtitle %} Test Case List {% endblock %} +{% block manage %} +{% if not test_cases %} +<center><h5> No Test Cases Available for This Question. </h5></center> +<button class="btn" type="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/testcase/{{ question_id }}");'>Add New Test Case</button> +{% endif %} + + +{% if test_cases %} +<form method="post" action="" name='frm'> +{% csrf_token %} + +{% for test_case in test_cases %} +<input type=checkbox name='test_case' value={{test_case.id}} /> <a href="{{URL_ROOT}}/exam/manage/testcase/{{ question_id }}/{{ test_case.id }}">{{ test_case }}</a><br> +{% endfor %} + +<br><br> +<button class="btn" type="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/testcase/{{ question_id }}");'>Add New Test Case</button> +<button class="btn" type="submit" name="delete" value='delete' onClick="return confirm_delete(frm);">Delete Selected</button> +</form> +{% endif %} + +{% endblock %} |