From 4310d5905a9cc702198e42830c1b670957cd7360 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Wed, 3 Jan 2018 19:27:25 +0530 Subject: Made UI changes as per suggestion Added view answerpaper option to exercise form. --- yaksh/forms.py | 2 +- yaksh/templates/yaksh/course_modules.html | 16 ++++++++++++---- yaksh/templates/yaksh/courses.html | 11 ++++++++--- yaksh/templates/yaksh/question.html | 16 +++++++--------- yaksh/templates/yaksh/quit.html | 10 +++++++--- yaksh/templates/yaksh/view_answerpaper.html | 10 +++++++++- yaksh/views.py | 6 +++--- 7 files changed, 47 insertions(+), 24 deletions(-) (limited to 'yaksh') diff --git a/yaksh/forms.py b/yaksh/forms.py index 84db33e..8399bc9 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -176,7 +176,7 @@ class UserLoginForm(forms.Form): class ExerciseForm(forms.ModelForm): class Meta: model = Quiz - fields = ['description'] + fields = ['description', 'view_answerpaper'] class QuizForm(forms.ModelForm): diff --git a/yaksh/templates/yaksh/course_modules.html b/yaksh/templates/yaksh/course_modules.html index 8e6f5a6..fad1be0 100644 --- a/yaksh/templates/yaksh/course_modules.html +++ b/yaksh/templates/yaksh/course_modules.html @@ -31,7 +31,7 @@ - View Lessons/Quizzes + View Lessons/Quizzes/Exercises {% get_module_status user module course as module_status %} @@ -56,7 +56,7 @@
- + @@ -85,7 +85,15 @@ {% endif %}
Lesson/QuizLesson/Quiz/Exercise Status Type View AnswerPaper - {{unit.type|title}} + {% if unit.type == "quiz" %} + {% if unit.quiz.is_exercise %} + Exercise + {% else %} + Quiz + {% endif %} + {% else %} + Lesson + {% endif %} {% if unit.type == "quiz" %} @@ -109,4 +117,4 @@ {% else %}

No lectures found

{% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html index 2456433..b6b9f7e 100644 --- a/yaksh/templates/yaksh/courses.html +++ b/yaksh/templates/yaksh/courses.html @@ -151,7 +151,7 @@ {% for unit in module.get_learning_units %}
  • - {% if unit.learning_type == "quiz" %} + {% if unit.type == "quiz" %} {% if unit.quiz.is_exercise %} {{unit.quiz.description}} @@ -288,8 +288,13 @@
    • {% if unit.type == "quiz" %} - - {{unit.quiz.description}} + {% if unit.quiz.is_exercise %} + + {{unit.quiz.description}} + {% else %} + + {{unit.quiz.description}} + {% endif %} {% else %} {{unit.lesson.name}} diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index fe5917c..b7251ad 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -199,20 +199,18 @@ question_type = "{{ question.type }}" {% endif %} {% if quiz.is_exercise %} - {% if question.solution %} -

      Solution by teacher

      - {% else %} -

      No solution provided by teacher

      - {% endif%} {% if can_skip %}
      - {{ question.solution|safe }} -
      {% else %} {% endif %} + {% if question.solution %} +

      Solution by teacher

      + {% else %} +

      No solution provided by teacher

      + {% endif%} + {{ question.solution|safe }} + {% endif %}
      diff --git a/yaksh/templates/yaksh/quit.html b/yaksh/templates/yaksh/quit.html index 78a9b47..ee72026 100644 --- a/yaksh/templates/yaksh/quit.html +++ b/yaksh/templates/yaksh/quit.html @@ -28,9 +28,13 @@ width="80" alt="YAKSH"> {% endblock %} {% endfor %}
-

Your current answers are saved.

-

Are you sure you wish to quit the exam?

-

Be sure, as you won't be able to restart this exam.

+ {% if paper.question_paper.quiz.is_exercise %} +

Are you sure you wish to quit the Exercise?

+ {% else %} +

Your current answers are saved.

+

Are you sure you wish to quit the exam?

+

Be sure, as you won't be able to restart this exam.

+ {% endif %}
{% csrf_token %}
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 5f899e3..410b578 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -11,13 +11,21 @@ {% block main %} {% if not data.papers %} + {% if quiz.is_exercise %} +

You have not attempted the Exercise {{ quiz.description }}

+ {% else %}

You have not attempted the quiz {{ quiz.description }}

+ {% endif %} {% else %} {% for paper in data.papers %} {% if forloop.counter == 2 and data.questionpaperid %}

Previous attempts

{% endif %} -

Quiz: {{ paper.question_paper.quiz.description }}

+ {% if quiz.is_exercise %} +

Exercise: {{ paper.question_paper.quiz.description }}

+ {% else %} +

Quiz: {{ paper.question_paper.quiz.description }}

+ {% endif %}

Attempt Number: {{ paper.attempt_number }}
diff --git a/yaksh/views.py b/yaksh/views.py index ca22c9a..a4d9e78 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -586,7 +586,7 @@ def show_question(request, question, paper, error_message=None, notification=Non reason = 'The quiz has been deactivated!' return complete( request, reason, paper.attempt_number, paper.question_paper.id, - module_id=module_id + course_id=course_id, module_id=module_id ) if not quiz.is_exercise: if paper.time_left() <= 0: @@ -955,7 +955,7 @@ def enroll_request(request, course_id): user = request.user ci = RequestContext(request) course = get_object_or_404(Course, pk=course_id) - if not course.is_active_enrollment and course.hidden: + if not course.is_active_enrollment() and course.hidden: msg = ( 'Unable to add enrollments for this course, please contact your ' 'instructor/administrator.' @@ -1028,7 +1028,7 @@ def enroll(request, course_id, user_id=None, was_rejected=False): raise Http404('You are not allowed to view this page') course = get_object_or_404(Course, pk=course_id) - if not course.is_active_enrollment: + if not course.is_active_enrollment(): msg = ( 'Enrollment for this course has been closed,' ' please contact your ' -- cgit