From eaf4873ff71eb3655a82f24d05e00881040a4326 Mon Sep 17 00:00:00 2001 From: adityacp Date: Tue, 28 Jan 2020 18:18:07 +0530 Subject: Change in views, forms, templates, static - Revamp UI in student dashboard - Fix course form to get bootstrap form class - Add custom css for sidebar in course module page for student - Use django url pattern --- yaksh/forms.py | 27 +- yaksh/static/yaksh/css/custom.css | 72 +++- yaksh/templates/exam.html | 169 ++++---- yaksh/templates/user.html | 95 ++--- yaksh/templates/yaksh/complete.html | 24 +- yaksh/templates/yaksh/course_modules.html | 321 ++++++++-------- yaksh/templates/yaksh/error_template.html | 14 +- yaksh/templates/yaksh/intro.html | 91 ++--- yaksh/templates/yaksh/question.html | 496 ++++++++++++------------ yaksh/templates/yaksh/quit.html | 20 +- yaksh/templates/yaksh/quizzes_user.html | 292 +++++++------- yaksh/templates/yaksh/show_video.html | 282 +++++++------- yaksh/templates/yaksh/view_answerpaper.html | 574 ++++++++++++++++------------ yaksh/urls.py | 17 +- yaksh/views.py | 13 +- 15 files changed, 1323 insertions(+), 1184 deletions(-) diff --git a/yaksh/forms.py b/yaksh/forms.py index d82cd55..79342da 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -354,7 +354,18 @@ class CourseForm(forms.ModelForm): 'view_grade' ] - def __init__(self, *args, **kwargs): + def save(self, commit=True, *args, **kwargs): + instance = super(CourseForm, self).save(commit=False) + if instance.code: + instance.hidden = True + else: + instance.hidden = False + + if commit: + instance.save() + return instance + + def __init__(self, user, *args, **kwargs): super(CourseForm, self).__init__(*args, **kwargs) self.fields['name'].widget.attrs.update( {'class': form_input_class, 'placeholder': 'Course Name'} @@ -377,20 +388,6 @@ class CourseForm(forms.ModelForm): self.fields['grading_system'].widget.attrs.update( {'class': 'custom-select'} ) - - def save(self, commit=True, *args, **kwargs): - instance = super(CourseForm, self).save(commit=False) - if instance.code: - instance.hidden = True - else: - instance.hidden = False - - if commit: - instance.save() - return instance - - def __init__(self, user, *args, **kwargs): - super(CourseForm, self).__init__(*args, **kwargs) if self.instance.id and self.instance.teachers.filter(id=user.id).exists(): self.fields['grading_system'].widget.attrs['disabled'] = True else: diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css index 8623bfb..63ee455 100644 --- a/yaksh/static/yaksh/css/custom.css +++ b/yaksh/static/yaksh/css/custom.css @@ -26,4 +26,74 @@ body, .dropdown-menu { #rendered_text{ width: 550px; -} \ No newline at end of file +} + +.navbar { + padding: 15px 10px; + background: #fff; + border: none; + border-radius: 0; + margin-bottom: 40px; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); +} + +.navbar-btn { + box-shadow: none; + outline: none !important; + border: none; +} + +.line { + width: 100%; + height: 1px; + border-bottom: 1px dashed #ddd; + margin: 40px 0; +} + +/* --------------------------------------------------- + SIDEBAR STYLE +----------------------------------------------------- */ + +.wrapper { + display: flex; + width: 100%; + align-items: stretch; +} + +#sidebar { + min-width: 350px; + max-width: 350px; + background: #fff; + transition: all 0.3s; +} + +#sidebar.active { + margin-left: -350px; +} + +#sidebar .sidebar-header { + padding: 20px; + background: #158CBA; +} + +#sidebar ul.components { + padding: 20px 0; + border-bottom: 1px solid #fff; +} + +#sidebar ul li a { + padding: 10px; + font-size: 1.1em; + display: block; +} + +/* --------------------------------------------------- + CONTENT STYLE +----------------------------------------------------- */ + +#content { + width: 100%; + padding: 20px; + min-height: 100vh; + transition: all 0.3s; +} diff --git a/yaksh/templates/exam.html b/yaksh/templates/exam.html index d439c64..6480cce 100644 --- a/yaksh/templates/exam.html +++ b/yaksh/templates/exam.html @@ -1,83 +1,89 @@ {% extends "base.html" %} {% load custom_filters %} +{% load static %} + +{% block title %}{{ paper.question_paper.quiz.description }}{% endblock %} + {% block nav %} -
Question Navigator
-Question(s) left: {{ paper.questions_left }}
-Category | @@ -97,16 +103,15 @@ {% endfor %}
---|