diff options
author | Prabhu Ramachandran | 2016-04-07 14:34:39 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2016-04-07 14:34:39 +0530 |
commit | 69d53a33c77270a9244344d9de676d39502a9f1b (patch) | |
tree | e5df540af6cc44022a097ded249e671b04f7b1ba /yaksh/templates | |
parent | d65ba142c47780fe3ff818f583f110453d31a92f (diff) | |
parent | c390fcc28c4499e0594b8ff49df283efc4043b26 (diff) | |
download | online_test-69d53a33c77270a9244344d9de676d39502a9f1b.tar.gz online_test-69d53a33c77270a9244344d9de676d39502a9f1b.tar.bz2 online_test-69d53a33c77270a9244344d9de676d39502a9f1b.zip |
Merge pull request #88 from prathamesh920/views_cleanup
Views cleanup
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/complete.html | 14 | ||||
-rw-r--r-- | yaksh/templates/yaksh/intro.html | 30 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 45 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quit.html | 44 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quizzes_user.html | 19 | ||||
-rw-r--r-- | yaksh/templates/yaksh/results_user.html | 9 |
6 files changed, 80 insertions, 81 deletions
diff --git a/yaksh/templates/yaksh/complete.html b/yaksh/templates/yaksh/complete.html index 08abe76..07cbf3a 100644 --- a/yaksh/templates/yaksh/complete.html +++ b/yaksh/templates/yaksh/complete.html @@ -5,27 +5,27 @@ {% block pagetitle %}Online Test{% endblock %} {% block content %} {% csrf_token %} - {% if submitted or unattempted %} + {% if paper.questions_answered.all or paper.questions_unanswered.all %} <br><center><table class="bordered-table zebra-striped span8" style="text-align:left;"> <tr><td><b>Submitted Questions</b></td> <td> - {% if submitted %} - {{ submitted|join:", " }} + {% if paper.questions_answered.all %} + {{ paper.questions_answered.all|join:", " }} {% else %} <p><b>No Questions have been Submitted</b></p> {% endif %} </td></tr> <tr><td><b>Unattempted Questions</b></td> <td> - {% if unattempted %} - {{ unattempted|join:", " }} + {% if paper.questions_unanswered.all %} + {{ paper.questions_unanswered.all|join:", " }} {% else %} <p><b>All Questions have been Submitted</b></p> {% endif %} </td></tr> - </table></center> - {% endif %} + </table></center> + {% endif %} <center><h2> Good bye! </h2></center> <center><h4> {{message}} </h4></center> <br><center><h4>You may now close the browser.</h4></center><br> diff --git a/yaksh/templates/yaksh/intro.html b/yaksh/templates/yaksh/intro.html index 2542795..1ed82e2 100644 --- a/yaksh/templates/yaksh/intro.html +++ b/yaksh/templates/yaksh/intro.html @@ -5,21 +5,19 @@ {% block formtitle %}Important instructions & rules {% endblock %} {% block content %} - {% if enable_quiz_time or disable_quiz_time %} - {% if quiz_expired %} - <div class="alert alert-error"> - This Quiz has expired. You can no longer attempt this Quiz. + {% if questionpaper.quiz.is_expired %} + <div class="alert alert-error"> + This Quiz has expired. You can no longer attempt this Quiz. + <br/> + </div> + {% else %} + <div class="alert"> + You can attempt this Quiz at any time between {{ questionpaper.quiz.start_date_time }} GMT and {{ questionpaper.quiz.end_date_time }} GMT <br/> - </div> - {% else %} - <div class="alert"> - You can attempt this Quiz at any time between {{ enable_quiz_time }} GMT and {{ disable_quiz_time }} GMT - <br/> - You are not allowed to attempt the Quiz before or after this duration - <br/> - </div> - {% endif %} - {% endif %} + You are not allowed to attempt the Quiz before or after this duration + <br/> + </div> + {% endif %} <p> Welcome <strong>{{user.first_name.title}} {{user.last_name.title}}</strong>, to the programming quiz! </p> <p> This examination system has been developed with the intention of making you @@ -44,8 +42,8 @@ {% csrf_token %} <center><button class="btn" name="home">Home</button></center> </form> - {% if not quiz_expired %} - <form action="{{URL_ROOT}}/exam/start/{{ attempt_num }}/{{ paper_id }}/" method="post" align="center"> + {% if not questionpaper.quiz.is_expired %} + <form action="{{URL_ROOT}}/exam/start/{{ attempt_num }}/{{ questionpaper.id }}/" method="post" align="center"> {% csrf_token %} <center><button class="btn" type="submit" name="start">Start Exam!</button></center> </form> diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 0d1daee..0c48167 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -15,7 +15,7 @@ <script src="{{ URL_ROOT }}/static/yaksh/js/bootstrap-modal.js"></script> <script> -var time_left = {{ time_left }} +var time_left = {{ paper.time_left }} function getTimeRemaining(endtime){ var t = Date.parse(endtime) - Date.parse(new Date()); @@ -90,11 +90,11 @@ function call_skip(url) form.action = url form.submit(); } - {% if question.type == 'code' and success == 'True'%} - {% if to_attempt|length != 0 %} + {% if question.type == 'code' and success == 'True'%} + {% if paper.questions_left %} window.setTimeout(function() { - {% for qid, num in questions.items %} + {% for qid in paper.questions.all %} location.href="{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" {% endfor %} }, 1000); @@ -117,10 +117,10 @@ function call_skip(url) <div class="container"> <h3 class="brand"><strong>Online Test</h3></strong> <ul> - <li><h5><a> Hi {{user.first_name.title}} {{user.last_name.title}} </a></h5></li> + <li><h5><a> Hi {{ paper.user.first_name.title}} {{ paper.user.last_name.title}} </a></h5></li> </ul><br> <div class=time-div id="time_left"></div> - <h5 class=td1-class>You have {{ paper.questions_left }} question(s) left in {{ quiz_name }}</h5> + <h5>You have {{ paper.questions_left }} question(s) left in {{ paper.question_paper.quiz.description }}</h5> </div> </div> </div> @@ -128,20 +128,21 @@ function call_skip(url) <div class="sidebar"> <p>Question Navigator </p> <div class="pagination"> - <ul> - {% for qid, num in questions.items %} - {% if qid.id|slugify in to_attempt %} - {% if qid.id|slugify == question.id|slugify %} - <li class="active"><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ num }}</a></li> - {% else %} - <li><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ num }}</a></li> - {% endif %} - {% endif %} - {% if qid.id|slugify in submitted %} - <li class="disabled"><a href="#">{{ num }}</a></li> - {% endif %} - {% endfor %} - </ul> + <ul> + {% for qid in paper.questions.all %} + {% if qid in paper.questions_unanswered.all %} + {% if qid.id == question.id %} + {{ q.id}} + <li class="active"><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ forloop.counter }}</a></li> + {% else %} + <li><a href="#" data-toggle="tooltip" title="{{ qid.description }}" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ forloop.counter }}</a></li> + {% endif %} + {% endif %} + {% if qid in paper.questions_answered.all %} + <li class="disabled"><a href="#">{{ forloop.counter }}</a></li> + {% endif %} + {% endfor %} + </ul> </div> </div> </div> @@ -191,7 +192,7 @@ function call_skip(url) <script type="text/javascript"> addLineNumbers('answer'); - </script> + </script> <script>addLineNumbers('snippet');</script> {% endif %} @@ -202,7 +203,7 @@ function call_skip(url) {% else %} <button class="btn" type="submit" name="check" id="check" onClick="submitCode();">Check Answer</button> {% endif %} - {% if to_attempt|length != 1 %} + {% if paper.unanswered.all|length != 1 %} <button class="btn" type="submit" name="skip" id="skip">Attempt Later</button> {% endif %} </form> diff --git a/yaksh/templates/yaksh/quit.html b/yaksh/templates/yaksh/quit.html index 91bce64..7be8ad5 100644 --- a/yaksh/templates/yaksh/quit.html +++ b/yaksh/templates/yaksh/quit.html @@ -3,33 +3,31 @@ {% block title %}Quit exam {% endblock %} {% block pagetitle %}Online Test {% endblock %} {% block content %} - {% if submitted or unattempted %} - <br><center><table class="bordered-table zebra-striped span8" - style="text-align:left;"> - <tr><td><b>Submitted Questions</b></td> - <td> - {% if submitted %} - {{ submitted|join:", " }} - {% else %} - <p><b>No Questions have been Submitted</b></p> - {% endif %} - </td></tr> - <tr><td><b>Unattempted Questions</b></td> - <td> - {% if unattempted %} - {{ unattempted|join:", " }} - {% else %} - <p><b>All Questions have been Submitted</b></p> - {% endif %} - </td></tr> - </table></center> - {% endif %} + <br><center><table class="bordered-table zebra-striped span8" + style="text-align:left;"> + <tr><td><b>Submitted Questions</b></td> + <td> + {% if paper.questions_answered.all %} + {{ paper.questions_answered.all|join:", " }} + {% else %} + <p><b>No Questions have been Submitted</b></p> + {% endif %} + </td></tr> + <tr><td><b>Unattempted Questions</b></td> + <td> + {% if paper.questions_unanswered.all %} + {{ paper.questions_unanswered.all|join:", " }} + {% else %} + <p><b>All Questions have been Submitted</b></p> + {% endif %} + </td></tr> + </table></center> <center><h4>Your current answers are saved.</h4></center> <center><h4> Are you sure you wish to quit the exam?</h4></center> <center><h4> Be sure, as you won't be able to restart this exam.</h4></center> - <form action="{{URL_ROOT}}/exam/complete/{{ attempt_num }}/{{ id }}/" method="post"> + <form action="{{URL_ROOT}}/exam/complete/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post"> {% csrf_token %} - <center><button class="btn" type="submit" name="yes">Yes!</button> <button class="btn" type="button" name="no" onClick="window.location='{{ URL_ROOT }}/exam/start/{{ attempt_num }}/{{ id }}/'">No!</button></center> + <center><button class="btn" type="submit" name="yes">Yes!</button> <button class="btn" type="button" name="no" onClick="window.location='{{ URL_ROOT }}/exam/start/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/'">No!</button></center> </form> {% endblock content %} diff --git a/yaksh/templates/yaksh/quizzes_user.html b/yaksh/templates/yaksh/quizzes_user.html index a800e68..69cf3ba 100644 --- a/yaksh/templates/yaksh/quizzes_user.html +++ b/yaksh/templates/yaksh/quizzes_user.html @@ -21,7 +21,7 @@ <div class="span14"> <div class="row"> <div class="span6"> - <h4><b><u> {{ course.name }} by {{ course.creator}}</u></b></h4> + <h4><b><u> {{ course.name }} by {{ course.creator }}</u></b></h4> </div> <div class="span6"> {% if user in course.requests.all %} <span class="label warning">Request Pending </span> @@ -49,23 +49,24 @@ <table> <th>Quiz</th> <th>Pre requisite quiz</th> - {% for paper in quizzes %} - {% if paper.quiz.course_id == course.id %} + {% for quiz in quizzes %} + {% if quiz.course_id == course.id %} <tr> - {% if paper in unexpired_quizzes %} + {% if not quiz.is_expired %} <td> - <a href="{{ URL_ROOT }}/exam/intro/{{paper.id}}">{{ paper.quiz.description }}</a><br> + <a href="{{ URL_ROOT }}/exam/intro/{{quiz.questionpaper_set.get.id}}">{{ quiz.description }}</a><br> </td> {% else %} <td> - {{ paper.quiz.description }} <span class="label important">Expired</span><br> + <a href="{{ URL_ROOT }}/exam/intro/{{quiz.questionpaper_set.get.id}}">{{ quiz.description }}</a><br> + {{ quiz.description }} <span class="label important">INACTIVE</span><br> </td> {% endif %} <td> - {% if paper.quiz.prerequisite %} - You have to pass {{ paper.quiz.prerequisite.description }} for taking {{ paper.quiz.description }} + {% if quiz.prerequisite %} + You have to pass {{ quiz.prerequisite.description }} for taking {{ paper.quiz.description }} {% else %} - No pre requisites for {{ paper.quiz.description }} + No pre requisites for {{ quiz.description }} {% endif %} </td> </tr> diff --git a/yaksh/templates/yaksh/results_user.html b/yaksh/templates/yaksh/results_user.html index 0f35c0d..3a6450d 100644 --- a/yaksh/templates/yaksh/results_user.html +++ b/yaksh/templates/yaksh/results_user.html @@ -17,10 +17,11 @@ <th>Percentage {% for paper in papers %} <tr> - {% for i in paper %} - <td>{{ i }} - {% endfor %} - <br> + <td>{{ paper.question_paper.quiz.description }}</td> + <td>{{ paper.marks_obtained }}</td> + <td>{{ paper.question_paper.total_marks }}</td> + <td>{{ paper.percent }}</td> + </tr> {% endfor %} </table></center> </form> |