diff options
author | adityacp | 2020-03-02 11:07:17 +0530 |
---|---|---|
committer | adityacp | 2020-03-02 11:07:17 +0530 |
commit | 718f475f279a0600b7157a8c82d3198ee87b7a32 (patch) | |
tree | 6f84786ef9121a2f519fc5c635f3a4ba2ed223b9 /yaksh | |
parent | 78cc032340a8f0c8e0d456770783f2c894935c04 (diff) | |
parent | 2bf66a0cdf07764d91e0274a1effb050075a1206 (diff) | |
download | online_test-718f475f279a0600b7157a8c82d3198ee87b7a32.tar.gz online_test-718f475f279a0600b7157a8c82d3198ee87b7a32.tar.bz2 online_test-718f475f279a0600b7157a8c82d3198ee87b7a32.zip |
Merge branch 'master' of https://github.com/FOSSEE/online_test into bump_django
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/registration/password_change_form.html | 82 | ||||
-rw-r--r-- | yaksh/templates/registration/password_reset_confirm.html | 44 | ||||
-rw-r--r-- | yaksh/templates/yaksh/activation_status.html | 141 | ||||
-rw-r--r-- | yaksh/templates/yaksh/paginator.html | 2 | ||||
-rw-r--r-- | yaksh/views.py | 8 |
5 files changed, 196 insertions, 81 deletions
diff --git a/yaksh/templates/registration/password_change_form.html b/yaksh/templates/registration/password_change_form.html index f286741..37f6e93 100644 --- a/yaksh/templates/registration/password_change_form.html +++ b/yaksh/templates/registration/password_change_form.html @@ -2,23 +2,89 @@ {% load static %} <!DOCTYPE html> -{% block pagetitle %} -<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top"> - <a class="navbar-brand" href="{% url 'yaksh:index' %}"> +{% block nav %} +<div class="container-fluid"> + <nav class="navbar navbar-expand-sm navbar-dark bg-primary fixed-top"> + <a class="navbar-brand" href="{% url 'yaksh:index' %}"> <img src="{% static 'yaksh/images/yaksh_banner.png' %}" alt="YAKSH"> - </a> -</nav> + </a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarColor01"> + <ul class="navbar-nav ml-auto"> + <li class="nav-item dropdown my-lg-0" style="font-size: 1.2rem"> + <a class="dropdown-toggle nav-link" id="user_dropdown" data-toggle="dropdown" href="#">{{user.get_full_name|title}} + </a> + <div class="dropdown-menu dropdown-menu-right"> + <a class="dropdown-item" href="{% url 'yaksh:edit_profile' %}"> + <i class="fa fa-user"></i> My Profile + </a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="{% url 'password_change' %}"> + <i class="fa fa-key"></i> Change Password + </a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" id="user_logout" href="{% url 'yaksh:logout' %}"> + <i class="fa fa-sign-out"></i> Logout + </a> + </div> + </li> + </ul> + </div> + </nav> +</div> +{% endblock %} +{% block pagetitle %} Change Password {% endblock %} {% block title %} Change Password {% endblock %} +{% block script %} +<script type="text/javascript"> + $(document).ready(function() + { + $("#id_old_password").addClass("form-control"); + $("#id_new_password1").addClass("form-control"); + $("#id_new_password2").addClass("form-control"); + }); +</script> +{% endblock %} {% block content %} <form action="" method="post" > {% csrf_token %} <center> - <table class="span1"> - {{ form }} - </table> + <div class="container col-md-6"> + <table class="table table-responsive-sm"> + {% if form.errors %} + {% for field in form %} + {% for error in field.errors %} + <div class="alert alert-dismissible alert-danger"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ error|escape }}</strong> + </div> + {% endfor %} + {% endfor %} + {% for error in form.non_field_errors %} + <div class="alert alert-dismissible alert-danger"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ error|escape }}</strong> + </div> + {% endfor %} + {% endif %} + {% for field in form %} + <tr> + <td>{{ field.label }}</td> + <td>{{ field }} <small>{{ field.help_text }}</small></td> + </tr> + {% endfor %} + </table> + </div> </center> <br> <center> diff --git a/yaksh/templates/registration/password_reset_confirm.html b/yaksh/templates/registration/password_reset_confirm.html index ef2d1f2..02f1228 100644 --- a/yaksh/templates/registration/password_reset_confirm.html +++ b/yaksh/templates/registration/password_reset_confirm.html @@ -11,18 +11,58 @@ </nav> {% endblock %} +{% block script %} +<script type="text/javascript"> + $(document).ready(function() + { + $("#id_new_password1").addClass("form-control"); + $("#id_new_password2").addClass("form-control"); + }); +</script> +{% endblock %} + {% block content %} <br><br> <center><h4>Reset Password</h4> + <div class="container col-md-6"> {% if validlink %} - <p>Please enter your new password twice so we can verify you typed it in correctly</p>. + <p>Please enter your new password twice so we can verify you typed it in correctly + </p>. <form method="post"> {% csrf_token %} - {{ form.as_p }} + <table class="table table-responsive-sm"> + {% if form.errors %} + {% for field in form %} + {% for error in field.errors %} + <div class="alert alert-dismissible alert-danger"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ error|escape }}</strong> + </div> + {% endfor %} + {% endfor %} + {% for error in form.non_field_errors %} + <div class="alert alert-dismissible alert-danger"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ error|escape }}</strong> + </div> + {% endfor %} + {% endif %} + {% for field in form %} + <tr> + <td>{{ field.label }}</td> + <td>{{ field }} <small>{{ field.help_text }}</small></td> + </tr> + {% endfor %} + </table> <button class= "btn btn-success btn-lg" type="submit">Submit</button> </form> {% else %} <p>This reset link is no longer valid!</p> {% endif %} + </div> </center> {% endblock %} diff --git a/yaksh/templates/yaksh/activation_status.html b/yaksh/templates/yaksh/activation_status.html index c196300..059aa21 100644 --- a/yaksh/templates/yaksh/activation_status.html +++ b/yaksh/templates/yaksh/activation_status.html @@ -1,79 +1,88 @@ {% extends "base.html" %} - -{% block pagetitle %} Yaksh Account Activation {% endblock %} -{% block title %} Yaksh Account Activation {% endblock %} -{% block css%} - <link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/dashboard.css" type="text/css" /> -{% endblock %} +{% load static %} +{% block pagetitle %} Account Activation {% endblock %} +{% block title %} Account Activation {% endblock %} {% block nav %} -<nav class="navbar navbar-fixed-top navbar-inverse"> - <div class="container"> - <div class= "collapse navbar-collapse" id="navbar"> - <ul class="nav navbar-nav navbar-right"> - <li><a href="{{ URL_ROOT }}/exam/viewprofile"> {{ user.get_full_name.title }} </a></li> - <li><a style='cursor:pointer' id='logout' onClick='location.replace("{{URL_ROOT}}/exam/logout/");'> - <span class="glyphicon glyphicon-log-out">Logout </span></a></li> - </ul> - </div> - </div> -</nav> +<div class="container-fluid"> + <nav class="navbar navbar-expand-sm navbar-dark bg-primary fixed-top"> + <a class="navbar-brand" href="{% url 'yaksh:index' %}"> + <img src="{% static 'yaksh/images/yaksh_banner.png' %}" alt="YAKSH"> + </a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarColor01"> + <ul class="navbar-nav ml-auto"> + <li class="nav-item dropdown my-lg-0" style="font-size: 1.2rem"> + <a class="dropdown-toggle nav-link" id="user_dropdown" data-toggle="dropdown" href="#">{{user.get_full_name|title}} + </a> + <div class="dropdown-menu dropdown-menu-right"> + <a class="dropdown-item" id="user_logout" href="{% url 'yaksh:logout' %}"> + <i class="fa fa-sign-out"></i> Logout + </a> + </div> + </li> + </ul> + </div> + </nav> +</div> {% endblock %} {% block content %} -{% if success %} - <center> - <div class="alert alert-success" role="alert"> - <strong> {{ msg }} </strong> - </div> - <a href="{{URL_ROOT}}/exam/"> Home </a> - </center> -{% else %} - {% if msg %} +<div class="container"> + {% if success %} <center> - <div class="alert alert-warning" role="alert"> + <div class="alert alert-success" role="alert"> <strong> {{ msg }} </strong> </div> + <a href="{% url 'yaksh:index' %}"> Home </a> </center> - <form action="{{ URL_ROOT }}/exam/new_activation/" method="post"> - {% csrf_token %} + {% else %} + {% if msg %} + <center> + <div class="alert alert-warning" role="alert"> + <strong> {{ msg }} </strong> + </div> + </center> + <center> + <div class="col-md-6"> + <form action="{% url 'yaksh:new_activation' %}" method="post"> + {% csrf_token %} + <input type="email" name="email" class="form-control" placeholder="Email address" required><br><br> + <button class="btn btn-success btn-lg" type="submit">Send Email</button> + </form> + </div> + </center> + {% endif %} + {% endif %} + <br/> + {% if activation_msg %} <center> - Enter Email Address for verification: <input type="email" name="email" required><br><br> - <button class="btn" type="submit">Send Email</button> + <div class="alert alert-info" role="alert"> + <strong> {{ activation_msg }} </strong> + </div> + <a href="{% url 'yaksh:index' %}"> Home </a> </center> - </form> {% endif %} -{% endif %} -<br/> -{% if activation_msg %} - <center> - <div class="alert alert-info" role="alert"> - <strong> {{ activation_msg }} </strong> - </div> - <a href="{{URL_ROOT}}/exam/"> Home </a> - </center> -{% endif %} -{% if email_err_msg %} - <center> - <div class="alert alert-warning" role="alert"> - <strong> {{ email_err_msg }} </strong> - </div> - </center> - <form action="{{ URL_ROOT }}/exam/update_email/" method="post"> - {% csrf_token %} - <center> - <table> - <tr> - <td>Enter Username:</td> - <td><input type="text" name="username" required></td> - </tr> - <tr> - <td>Enter New Email Address:</td> - <td><input type="email" name="email" required></td> - </tr> - </table> - <br> - <button class="btn" type="submit">Submit</button> - </center> - </form> -{% endif %} + {% if email_err_msg %} + <center> + <div class="alert alert-warning" role="alert"> + <strong> {{ email_err_msg }} </strong> + </div> + </center> + <center> + <div class="col-md-6"> + <form action="{% url 'yaksh:update_email' %}" method="post"> + {% csrf_token %} + <input type="text" name="username" required placeholder="Username" class="form-control" /> + <br> + <input type="email" name="email" required placeholder="New email address" class="form-control" /> + <br> + <button class="btn btn-success btn-lg" type="submit">Submit</button> + </form> + </div> + </center> + {% endif %} +</div> {% endblock content %} diff --git a/yaksh/templates/yaksh/paginator.html b/yaksh/templates/yaksh/paginator.html index 5438b77..5f0df7a 100644 --- a/yaksh/templates/yaksh/paginator.html +++ b/yaksh/templates/yaksh/paginator.html @@ -15,7 +15,7 @@ <li class="page-item active"> <span class="page-link">{{ n }}<span class="sr-only">(current)</span></span> </li> - {% elif n > objects.number|add:'-3' and n < objects.number|add:'3' %} + {% elif n > objects.number|add:'-5' and n < objects.number|add:'5' %} <li class="page-item"><a class="page-link" href="?page={{ n }}">{{ n }}</a></li> {% endif %} {% endfor %} diff --git a/yaksh/views.py b/yaksh/views.py index 6d5ae08..3aeaada 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -409,7 +409,7 @@ def prof_manage(request, msg=None): courses = Course.objects.get_queryset().filter( Q(creator=user) | Q(teachers=user), is_trial=False).distinct().order_by("-active") - paginator = Paginator(courses, 30) + paginator = Paginator(courses, 20) page = request.GET.get('page') courses = paginator.get_page(page) messages.info(request, msg) @@ -1223,7 +1223,7 @@ def monitor(request, quiz_id=None, course_id=None): courses = Course.objects.filter( Q(creator=user) | Q(teachers=user), is_trial=False - ).order_by("-id").distinct() + ).order_by("-active").distinct() paginator = Paginator(courses, 30) page = request.GET.get('page') courses = paginator.get_page(page) @@ -1678,7 +1678,7 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None, if not course_id: courses = Course.objects.filter( Q(creator=current_user) | Q(teachers=current_user), is_trial=False - ).order_by("-id").distinct() + ).order_by("-active").distinct() paginator = Paginator(courses, 30) page = request.GET.get('page') courses = paginator.get_page(page) @@ -2138,7 +2138,7 @@ def new_activation(request, email=None): try: user = User.objects.get(email=email) except MultipleObjectsReturned: - context['email_err_msg'] = "Multiple entries found for this email"\ + context['email_err_msg'] = "Multiple entries found for this email "\ "Please change your email" return my_render_to_response( request, 'yaksh/activation_status.html', context |