From c17befa219b03adc4cd4c0902d9248994db90c38 Mon Sep 17 00:00:00 2001 From: adityacp Date: Tue, 21 Jan 2020 11:19:12 +0530 Subject: Fix design question paper UI --- yaksh/static/yaksh/css/question_paper_creation.css | 15 +- yaksh/templates/yaksh/add_quiz.html | 41 ++- yaksh/templates/yaksh/design_questionpaper.html | 396 +++++++++++---------- yaksh/templates/yaksh/moderator_dashboard.html | 12 +- yaksh/views.py | 44 ++- 5 files changed, 275 insertions(+), 233 deletions(-) diff --git a/yaksh/static/yaksh/css/question_paper_creation.css b/yaksh/static/yaksh/css/question_paper_creation.css index ff4bf32..bc8feeb 100644 --- a/yaksh/static/yaksh/css/question_paper_creation.css +++ b/yaksh/static/yaksh/css/question_paper_creation.css @@ -1,10 +1,3 @@ -body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 13px; - font-weight: normal; - line-height: 18px; - color: #404040; -} .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus { background-color: #FFFFFF; border-color: #DDDDDD #DDDDDD rgba(0, 0, 0, 0); @@ -63,20 +56,20 @@ body { #fixed-questions .col-md-6 > div, #random-questions .col-md-6 > div{ background: #f5f5f5; - height: 200px; + height: 300px; border: 1px solid #333333; padding: 5px; } #fixed-available, #random-available { - height: 125px; - min-height: 125px; + height: 220px; + min-height: 200px; overflow-y: scroll; margin-bottom: 15px; } #fixed-added, #random-added { - height: 160px; + height: 220px; overflow-y: scroll; } #fixed-added hr, diff --git a/yaksh/templates/yaksh/add_quiz.html b/yaksh/templates/yaksh/add_quiz.html index cc5a961..1e3c425 100644 --- a/yaksh/templates/yaksh/add_quiz.html +++ b/yaksh/templates/yaksh/add_quiz.html @@ -77,22 +77,8 @@ God Mode - - Help -
-
-
-
- User Mode: Attempt quiz the way normal users will attempt i.e. - -
    -
  • Quiz will have the same duration as that of the original quiz.
  • -
  • Quiz won't start if the course is inactive or the quiz time has expired.
  • -
  • You will be notified about quiz prerequisites.(You can still attempt the quiz though)
  • -
- God Mode: Attempt quiz without any time or eligibilty constraints. -
-
-
+ + Help {% endif %} {% endif %} + {% endblock %} diff --git a/yaksh/templates/yaksh/design_questionpaper.html b/yaksh/templates/yaksh/design_questionpaper.html index 0ab7cc0..c5aa25e 100644 --- a/yaksh/templates/yaksh/design_questionpaper.html +++ b/yaksh/templates/yaksh/design_questionpaper.html @@ -1,39 +1,36 @@ {% extends "manage.html" %} +{% load static %} {% block title %} Design Question Paper {% endblock title %} {% block subtitle %} Design Question Paper {% endblock %} {% block css %} - - + {% endblock %} {% block script %} - - - - + + {% endblock %} {% block content %} -
+
{% if course_id %} -
- Cancel + + +  Back + {% else %} - - Cancel + + +  Back + {% endif %} {% csrf_token %} -
Manual mode to design the {{lang}} Question Paper

+
Manual mode to design the {{lang}} Question Paper

+
-

Total Marks: {{ qpaper.total_marks }}

+

Total Marks: + {{ qpaper.total_marks }} +

-
- -
-
-
Please select Question type and Marks
+
+ {% if messages %} + {% for message in messages %} +
+ + {{ message }}
-
- {{ filter_form.question_type }} -
-
- {{ filter_form.marks }} -
-
-

- {% csrf_token %} -
-

Or

- -

Search using Tags:

- Search Questions: -
-
- - - - + {% endfor %} + {% endif %} +
+ +
+
+
Please select Question type and Marks
+
- + {{ filter_form.question_type }}
-
-
-

-
-
-

Select questions to add:

-
- {% if state == "fixed" or state == "None" %} -
    - {% for question in questions %} -
  • - -
  • - {% endfor %} -
- {% endif %} -
-

- + {{ filter_form.marks }} +
+
+
+ {% csrf_token %} +
+

Or

+ +

Search using Tags:

+ Search Questions: +
+
+ + + + +
+
-
-
-

Fixed questions currently in paper:

-
+
+

+
+
+
+
+

Select questions to add:

+
+ {% if state == "fixed" or state == "None" %} +
    + {% for question in questions %} +
  • + +
  • + {% endfor %} +
+ {% endif %} +
+
+
+ +
+
+
+

Fixed questions currently in paper:

+
    {% for question in fixed_questions %}
  • @@ -153,119 +169,125 @@ select
  • {% endfor %}
+
-
- +
+
+
+
+
+ Next >
-
-
-
- Next > -
-
+
-
-
-
-
-

Select questions to add to the pool:

-
- {% if state == "random" %} - + + {% for q in questions %} + {% if forloop.counter0 != 0 %} + + {% endif %} + {% if questions|length == 1%} + {% endif %} - {% if questions|length == 1%} - - {% endif %} + {% endfor %} + +
    + {% for question in questions %} +
  • + +
  • {% endfor %} - -
      - {% for question in questions %} -
    • - -
    • - {% endfor %} -
    - {% endif %} +
+ {% endif %} +
-

- +
+
-
-
-
-

Pool of questions currently in paper:

-
-
    - {% for random_set in random_sets %} -
  • - -
  • - {% for question in random_set.questions.all %} -
  • - -
  • +
    +
    +

    Pool of questions currently in paper:

    +
    +
      + {% for random_set in random_sets %} +
    • + +
    • + {% for question in random_set.questions.all %} +
    • + +
    • + {% endfor %} {% endfor %} - {% endfor %} -
    +
+

- +
-
-
-
- -
- Next > -
-
- -
-
-
Almost finished creating your question paper
-

-

- +

- -
-
+
+ Next > +
+
+ +
+
+
Almost finished creating your question paper
+

+

+ +
+ +
+
+

diff --git a/yaksh/templates/yaksh/moderator_dashboard.html b/yaksh/templates/yaksh/moderator_dashboard.html index e9a6985..af1f546 100644 --- a/yaksh/templates/yaksh/moderator_dashboard.html +++ b/yaksh/templates/yaksh/moderator_dashboard.html @@ -19,16 +19,16 @@ Create Demo Course -
- {% if msg %} -
-
+

+ {% if messages %} + {% for message in messages %} +
- {{ msg }} + {{ message }}
-
+ {% endfor %} {% endif %} {% with objects as courses %} diff --git a/yaksh/views.py b/yaksh/views.py index 9c2a0df..b9d94c5 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -407,7 +407,7 @@ def prof_manage(request, msg=None): except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results. courses = paginator.page(paginator.num_pages) - + messages.info(request, msg) context = {'user': user, 'objects': courses} return my_render_to_response( request, 'yaksh/moderator_dashboard.html', context @@ -1413,19 +1413,26 @@ def design_questionpaper(request, quiz_id, questionpaper_id=None, question_paper.fixed_question_order = questions_order question_paper.save() question_paper.fixed_questions.add(*questions) + messages.success(request, "Questions added successfully") + else: + messages.warning(request, "Please select atleast one question") if 'remove-fixed' in request.POST: question_ids = request.POST.getlist('added-questions', None) - if question_paper.fixed_question_order: - que_order = question_paper.fixed_question_order.split(",") - for qid in question_ids: - que_order.remove(qid) - if que_order: - question_paper.fixed_question_order = ",".join(que_order) - else: - question_paper.fixed_question_order = "" - question_paper.save() - question_paper.fixed_questions.remove(*question_ids) + if question_ids: + if question_paper.fixed_question_order: + que_order = question_paper.fixed_question_order.split(",") + for qid in question_ids: + que_order.remove(qid) + if que_order: + question_paper.fixed_question_order = ",".join(que_order) + else: + question_paper.fixed_question_order = "" + question_paper.save() + question_paper.fixed_questions.remove(*question_ids) + messages.success(request, "Questions removed successfully") + else: + messages.warning(request, "Please select atleast one question") if 'add-random' in request.POST: question_ids = request.POST.getlist('random_questions', None) @@ -1437,14 +1444,21 @@ def design_questionpaper(request, quiz_id, questionpaper_id=None, random_ques = Question.objects.filter(id__in=question_ids) random_set.questions.add(*random_ques) question_paper.random_questions.add(random_set) + messages.success(request, "Questions removed successfully") + else: + messages.warning(request, "Please select atleast one question") if 'remove-random' in request.POST: random_set_ids = request.POST.getlist('random_sets', None) - question_paper.random_questions.remove(*random_set_ids) + if random_set_ids: + question_paper.random_questions.remove(*random_set_ids) + messages.success(request, "Questions removed successfully") + else: + messages.warning(request,"Please select question set") if 'save' in request.POST or 'back' in request.POST: qpaper_form.save() - return my_redirect('/exam/manage/courses/all_quizzes/') + messages.success(request, "Question Paper saved successfully") if marks: questions = _get_questions(user, question_type, marks) @@ -1956,6 +1970,10 @@ def test_quiz(request, mode, quiz_id, course_id=None): current_user = request.user quiz = Quiz.objects.get(id=quiz_id) if (quiz.is_expired() or not quiz.active) and not godmode: + messages.warning( + request, + "{0} is either expired or inactive".format(quiz.description) + ) return my_redirect('/exam/manage') trial_questionpaper, trial_course, trial_module = test_mode( -- cgit