diff options
-rw-r--r-- | yaksh/forms.py | 51 | ||||
-rw-r--r-- | yaksh/static/yaksh/css/custom.css | 22 | ||||
-rw-r--r-- | yaksh/static/yaksh/js/add_quiz.js | 4 | ||||
-rw-r--r-- | yaksh/static/yaksh/js/lesson.js | 9 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_course.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_lesson.html | 206 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_module.html | 119 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_quiz.html | 149 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_added_modules.html | 10 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_detail.html | 25 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_progress.html | 70 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_students.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_teachers.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/courses.html | 3 | ||||
-rw-r--r-- | yaksh/templates/yaksh/design_course_session.html | 7 | ||||
-rw-r--r-- | yaksh/templates/yaksh/moderator_dashboard.html | 4 | ||||
-rw-r--r-- | yaksh/urls.py | 2 | ||||
-rw-r--r-- | yaksh/views.py | 61 |
18 files changed, 477 insertions, 271 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 951fcc1..5a3925e 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -228,6 +228,34 @@ class QuizForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(QuizForm, self).__init__(*args, **kwargs) + self.fields['start_date_time'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields['end_date_time'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields['duration'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields['description'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields['attempts_allowed'].widget.attrs.update( + {'class': 'custom-select'} + ) + self.fields['time_between_attempts'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields['instructions'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields['weightage'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields['pass_criteria'].widget.attrs.update( + {'class': form_input_class} + ) + self.fields["instructions"].initial = dedent("""\ <p> This examination system has been developed with the intention of @@ -415,9 +443,15 @@ class LessonForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(LessonForm, self).__init__(*args, **kwargs) des_msg = "Enter Lesson Description as Markdown text" - name_msg = "Enter Lesson Name" - self.fields['description'].widget.attrs['placeholder'] = des_msg - self.fields['name'].widget.attrs['placeholder'] = name_msg + self.fields['name'].widget.attrs.update( + {'class': form_input_class, 'placeholder': 'Lesson Name'} + ) + self.fields['description'].widget.attrs.update( + {'class': form_input_class, 'placeholder': des_msg} + ) + self.fields['video_file'].widget.attrs.update( + {'class': "custom-file-input"} + ) class Meta: model = Lesson @@ -438,16 +472,21 @@ class LessonForm(forms.ModelForm): class LessonFileForm(forms.Form): Lesson_files = forms.FileField(widget=forms.ClearableFileInput( - attrs={'multiple': True}), + attrs={'multiple': True, + 'class': "custom-file-input"}), required=False) class LearningModuleForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(LearningModuleForm, self).__init__(*args, **kwargs) - name_msg = "Enter Learning Module Name" - self.fields['name'].widget.attrs['placeholder'] = name_msg self.fields['name'].widget.attrs['size'] = 30 + self.fields['name'].widget.attrs.update( + {'class': form_input_class, 'placeholder': 'Module Name'} + ) + self.fields['description'].widget.attrs.update( + {'class': form_input_class, 'placeholder': 'Module Description'} + ) class Meta: model = LearningModule diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css index 594e1f3..2f62a26 100644 --- a/yaksh/static/yaksh/css/custom.css +++ b/yaksh/static/yaksh/css/custom.css @@ -1,25 +1,3 @@ -.yakshfooter { - background-color: #142624; - padding-top: 1%; - padding-left: 10%; - padding-right: 10%; - padding-bottom: 1%; - color: white; - bottom: 0; - width: 100%; - position: absolute; - text-align: center; -} - -.yakshfooter .nav-pills>li>a, .yakshfooter .nav-pills .nav-link,.yakshnav .nav-pills>li>a { - color: white; -} - -.yakshfooter .nav-pills>li>a:hover, .yakshnav .nav-pills>li>a:hover { - color: black; - background-color: white; -} - body, .dropdown-menu { font-size: 1.25rem; } diff --git a/yaksh/static/yaksh/js/add_quiz.js b/yaksh/static/yaksh/js/add_quiz.js index 57993ef..dab5a3d 100644 --- a/yaksh/static/yaksh/js/add_quiz.js +++ b/yaksh/static/yaksh/js/add_quiz.js @@ -1,8 +1,8 @@ function test() { - document.getElementById('id_duration').setAttribute('class','mini-text'); - document.getElementById('id_pass_criteria').setAttribute('class','mini-text'); + document.getElementById('id_duration').setAttribute('class','mini-text form-control'); + document.getElementById('id_pass_criteria').setAttribute('class','mini-text form-control'); if (document.getElementById("id_description").value != "") { document.getElementById("submit").innerHTML = "Save"; diff --git a/yaksh/static/yaksh/js/lesson.js b/yaksh/static/yaksh/js/lesson.js index 6f873b9..a86cf1b 100644 --- a/yaksh/static/yaksh/js/lesson.js +++ b/yaksh/static/yaksh/js/lesson.js @@ -75,4 +75,13 @@ $(document).ready(function(){ alert("Unable to copy. Press Ctrl+C or Cmd+C to copy") } }); + + $('#id_video_file').on('change',function(){ + //get the file name + var files = []; + for (var i = 0; i < $(this)[0].files.length; i++) { + files.push($(this)[0].files[i].name); + } + $(this).next('.custom-file-label').html(files.join(', ')); + }); }); diff --git a/yaksh/templates/yaksh/add_course.html b/yaksh/templates/yaksh/add_course.html index 6276425..11a6497 100644 --- a/yaksh/templates/yaksh/add_course.html +++ b/yaksh/templates/yaksh/add_course.html @@ -67,7 +67,7 @@ <center> <button class="btn btn-success btn-lg" type="submit" id="submit" name="course"> - Save + <i class="fa fa-save"></i> Save </button> <a class="btn btn-danger btn-lg" name="button" href="{% url 'yaksh:courses' %}"> Cancel diff --git a/yaksh/templates/yaksh/add_lesson.html b/yaksh/templates/yaksh/add_lesson.html index 87fb8d0..cbef893 100644 --- a/yaksh/templates/yaksh/add_lesson.html +++ b/yaksh/templates/yaksh/add_lesson.html @@ -1,85 +1,161 @@ {% extends "manage.html" %} {% load custom_filters %} +{% load static %} {% block title %}Create/Edit Lesson{% endblock %} {% block script %} -<script src="{{ URL_ROOT }}/static/yaksh/js/lesson.js"></script> -<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-ui-1.12.1.js"></script> +<script type="text/javascript" src="{% static 'yaksh/js/lesson.js' %}"> +</script> +<script type="text/javascript" src="{% static 'yaksh/js/jquery-ui.js' %}"> +</script> {% endblock %} {% block css %} -<link rel="stylesheet" href="{{URL_ROOT}}/static/yaksh/css/jquery-ui/jquery-ui-1.12.1.css"> -<link rel="stylesheet" href="{{URL_ROOT}}/static/yaksh/css/lesson.css"> +<link rel="stylesheet" href="{% static 'yaksh/css/lesson.css' %}" type="text/css" /> +<link rel="stylesheet" href="{% static 'yaksh/css/jquery-ui/jquery-ui.css' %}" type="text/css" /> {% endblock %} {% block content %} -<div class="yakshwell container"> +<div class="container"> {% if error %} <div class="alert alert-danger"> {{error}} </div> {% endif %} -<form name=frm id=frm action="" method="post" enctype="multipart/form-data"> - {% csrf_token %} - <center> - <table class="table table-bordered table-responsive-sm"> - {{ lesson_form.as_table }} - {{ lesson_file_form.as_table }} - </table> - </center> - <br><br> - {% if lesson_files %} - <center> - <div class="alert alert-success col-md-8 animated flash"> - <h4>Files added to this lesson</h4> - </div> - </center> - {% for f in lesson_files %} - <li class="list-group-item"> - <h4> - <input type="checkbox" name="delete_files" value="{{f.id}}"> - </input> - <a href="{{f.file.url}}">{{ f.file.name|file_title }}</a> - </h4> - </li> - {% endfor %} - {% else %} - - <center> - <div class="alert alert-warning col-md-8 animated flash"> - <h4 class="alert-warning">No Files added to this lesson</h4> - </div> - </center> - {% endif %} - <br><br> - <center> - <button class="btn btn-success" type="submit" id="submit" name="Save"> Save - </button> - {% if lesson_files %} - <button class="btn btn-danger" type="submit" id="submit" name="Delete"> Delete Files - </button> - {% endif %} - {% if course_id %} - <button class="btn btn-danger" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/");'>Cancel</button> - {% else %} - <button class="btn btn-danger" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/all_lessons/");'>Cancel</button> - {% endif %} - </form> - <button class="btn btn-outline-primary" type="button" name="button" id="preview">Preview Lesson Description - </button> - <button class="btn btn-outline-primary" type="button" name="button" id="embed"> - Embed Video link - </button> - </center> - <hr> - <div class="card" id="preview_text_div" style="display: none;"> - <div class="card-heading"> - <center> - <h3>Description Preview</h3> - </center> - </div> - <div class="card-body" id="description_body"> +<div class="container"> + <div class="row justify-content-center form-group"> + <div class="col-md-9 col-md-offset-4"> + {% if course_id %} + <a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}"> + <i class="fa fa-arrow-left"></i> + Back + </a> + {% else %} + <a class="btn btn-primary" href="{% url 'yaksh:show_all_lessons' %}"> + <i class="fa fa-arrow-left"></i> + Back + </a> + {% endif %} + <br> + {% if messages %} + <br> + {% for message in messages %} + <div class="alert alert-dismissible alert-{{ message.tags }}"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ message }}</strong> + </div> + {% endfor %} + {% endif %} + <br> + <form name=frm id=frm action="" method="post" enctype="multipart/form-data"> + <fieldset> + {% csrf_token %} + {% if lesson_form.errors %} + {% for field in lesson_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 %} + {{lesson_form.name}} + <br> + {{lesson_form.description}} + <br> + Active: {{lesson_form.active}} + <br><br> + Video File: + <span class="badge badge-info"> + {{lesson_form.video_file.help_text}} + </span> + <div class="input-group mb-3"> + <div class="custom-file"> + {{lesson_form.video_file}} + <label class="custom-file-label" for="id_video_file"> + Choose file + </label> + </div> + </div> + <br> + Lesson Files: + <div class="input-group mb-3"> + <div class="custom-file"> + {{lesson_file_form.Lesson_files}} + <label class="custom-file-label" for="id_video_file"> + Choose file + </label> + </div> + </div> + <br> + {% if lesson_files %} + <center> + <div class="alert alert-info"> + <h4>Files added to this lesson</h4> + </div> + </center> + {% for f in lesson_files %} + <li class="list-group-item"> + <h4> + <input type="checkbox" name="delete_files" value="{{f.id}}"> + </input> + <a href="{{f.file.url}}">{{ f.file.name|file_title }}</a> + </h4> + </li> + {% endfor %} + <br> + {% else %} + <center> + <div class="alert alert-warning"> + <h4 class="alert-warning">No Files added to this lesson</h4> + </div> + </center> + {% endif %} + <center> + <button class="btn btn-success btn-lg" type="submit" id="submit" name="Save"> + <i class="fa fa-save"></i> + Save + </button> + {% if lesson_files %} + <button class="btn btn-danger btn-lg" type="submit" id="submit" name="Delete"> <i class="fa fa-trash"></i> Delete Files + </button> + {% endif %} + <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="preview"> + <i class="fa fa-eye"></i> + Preview Description + </button> + <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="embed"> + <i class="fa fa-angle-left"></i> <i class="fa fa-angle-right"></i> + Embed Video link + </button> + </center> + </form> + <hr> + <div class="card" id="preview_text_div" style="display: none;"> + <div class="card-heading"> + <center> + <h3>Description Preview</h3> + </center> + </div> + <div class="card-body" id="description_body"> + </div> + </div> + </fieldset> + </form> </div> </div> </div> diff --git a/yaksh/templates/yaksh/add_module.html b/yaksh/templates/yaksh/add_module.html index 55dd8b8..d659ff2 100644 --- a/yaksh/templates/yaksh/add_module.html +++ b/yaksh/templates/yaksh/add_module.html @@ -2,8 +2,6 @@ {% load static %} {% block title %}Create/Edit Learning Module{% endblock %} -{% block pagetitle %}<h4>Design Learning Module</h4>{% endblock %} - {% block script %} <script type="text/javascript" src="{% static 'yaksh/js/jquery-3.3.1.min.js' %}"> </script> @@ -22,18 +20,6 @@ {% block content %} <div class="container"> -{% if course_id %} - <a href="{% url 'yaksh:get_course_modules' course_id %}" class="btn btn-primary"> - <i class="fa fa-arrow-left"></i> - Back to Courses - </a> -{% else %} - <a href="{% url 'yaksh:show_all_modules' %}" class="btn btn-primary"> - <i class="fa fa-arrow-left"></i> - Back to Learning Modules - </a> -{% endif %} -<br><br> {% if messages %} {% for message in messages %} <div class="alert alert-dismissible alert-{{ message.tags }}"> @@ -44,41 +30,86 @@ </div> {% endfor %} {% endif %} +{% if course_id %} + <a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}"> + <i class="fa fa-arrow-left"></i> + Back + </a> +{% else %} + <a class="btn btn-primary" href="{% url 'yaksh:show_all_lessons' %}"> + <i class="fa fa-arrow-left"></i> + Back + </a> +{% endif %} +</div> +<br> {% if status == "add" %} -<form name=frm id=frm action="" method="post"> - {% csrf_token %} - <br> - <center> - <table class="table table-bordered table-responsive-sm"> - {{ module_form.as_table }} - </table> - </center> - <br><br> - <center> - <button class="btn btn-success btn-lg" type="submit" id="submit" name="Save"> - Save - </button> - <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="preview"> - Preview Description - </button> - <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="embed"> - Embed Video link - </button> - </center> -</form> -<hr> -<div class="card" id="preview_text_div" style="display: none;"> - <div class="card-heading"> - <center> - <h3>Description Preview</h3> - </center> - </div> - <div class="card-body" id="description_body"> +<div class="container"> + <div class="row justify-content-center form-group"> + <div class="col-md-9 col-md-offset-4"> + <form name=frm id=frm action="" method="post"> + <fieldset> + {% csrf_token %} + {% if module_form.errors %} + {% for field in module_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 %} + {{module_form.name}} + <br> + {{module_form.description}} + <br> + Active: {{module_form.active}} + <br> + <center> + <button class="btn btn-success btn-lg" type="submit" id="submit" name="Save"> + <i class="fa fa-save"></i> + Save + </button> + <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="preview"> + <i class="fa fa-eye"></i> + Preview Description + </button> + <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="embed"> + <i class="fa fa-angle-left"></i> <i class="fa fa-angle-right"></i> + Embed Video link + </button> + </center> + </form> + <hr> + <div class="card" id="preview_text_div" style="display: none;"> + <div class="card-heading"> + <center> + <h3>Description Preview</h3> + </center> + </div> + <div class="card-body" id="description_body"> + </div> + </div> + </fieldset> + </form> + </div> </div> </div> {% endif %} <!-- Add learning Units --> {% if status == "design" %} +<div class="container"> <center><h3><u>Add/Edit Learning Units</h3></u></center> {% if course_id %} <form action="{% url 'yaksh:design_module' module_id course_id %}" method="POST" id="design_course_form"> @@ -177,7 +208,7 @@ <br> <center> <button id="Remove" name="Remove" class="btn btn-danger" type="submit"> <i class="fa fa-minus-square"></i> Remove from Module</button> - <button id="Change" name="Change" class="btn btn-info" type="submit"> Change Order</button> + <button id="Change" name="Change" class="btn btn-info" type="submit"><i class="fa fa-reorder"></i> Change Order</button> <button id="Change" name="Change_prerequisite" class="btn btn-primary" type="submit"> Change Prerequisite</button> </center> </div> diff --git a/yaksh/templates/yaksh/add_quiz.html b/yaksh/templates/yaksh/add_quiz.html index 48d64ce..cc5a961 100644 --- a/yaksh/templates/yaksh/add_quiz.html +++ b/yaksh/templates/yaksh/add_quiz.html @@ -1,73 +1,104 @@ {% extends "manage.html" %} +{% load static %} +{% block title %}Add/Edit Quiz{% endblock %} -{% block subtitle %}Add Quiz{% endblock %} +{% block subtitle %}Add/Edit Quiz{% endblock %} {% block css %} -<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/jquery.datetimepicker.css" type="text/css" /> + +<link rel="stylesheet" href="{% static 'yaksh/css/jquery.datetimepicker.css' %}" type="text/css" /> {% endblock %} {% block script %} -<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-3.3.1.min.js"></script> -<script src="{{ URL_ROOT }}/static/yaksh/js/add_quiz.js"></script> -<script src="{{ URL_ROOT }}/static/yaksh/js/jquery.datetimepicker.full.min.js"></script> + +<script src="{% static 'yaksh/js/jquery-3.3.1.min.js' %}"></script> +<script src="{% static 'yaksh/js/add_quiz.js' %}"></script> +<script src="{% static 'yaksh/js/jquery.datetimepicker.full.min.js' %}"></script> + {% endblock %} {% block onload %} onload="javascript:test();" {% endblock %} {% block content %} -<div class="yakshwell container"> -<form name=frm id=frm action="" method="post" > - {% csrf_token %} - <center> - <table class="span1 table table-responsive-sm"> - {{ form.as_table }} - </table> - <script type="text/javascript"> - $("#id_start_date_time").datetimepicker({format: 'Y-m-d H:i:s'}); - $("#id_end_date_time").datetimepicker({format: 'Y-m-d H:i:s'}); - </script> - <br/><br/> - </center> - - <center><button class="btn btn-success" type="submit" id="submit" name="questionpaper"> Save - </button> - - <button class="btn btn-danger" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/");'>Cancel</button> </center> - -</form> -<br> -{% if quiz and course_id %} - {% if quiz.questionpaper_set.get.id %} - <center> - <a href="{{URL_ROOT}}/exam/manage/designquestionpaper/{{ quiz.id }}/{{quiz.questionpaper_set.get.id}}/{{course_id}}" class="btn btn-primary">Edit Question Paper</a> - <a href="{{URL_ROOT}}/exam/manage/preview_questionpaper/{{quiz.questionpaper_set.get.id}}" class="btn btn-primary" target="_blank"> - Preview Question Paper +<div class="container"> + {% if messages %} + {% for message in messages %} + <div class="alert alert-dismissible alert-{{ message.tags }}"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ message }}</strong> + </div> + {% endfor %} + {% endif %} + {% if course_id %} + <a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}"> + <i class="fa fa-arrow-left"></i> + Back + </a> + {% else %} + <a class="btn btn-primary" href="{% url 'yaksh:show_all_lessons' %}"> + <i class="fa fa-arrow-left"></i> + Back </a> - <br> - <br> - <h4>You can check the quiz by attempting it in the following modes:</h4> - <button class="btn btn-outline-info" type="button" name="button" onClick='usermode("{{URL_ROOT}}/exam/manage/usermode/{{quiz.id}}/{{course_id}}/");'>User Mode</button> + {% endif %} + <br><br> + <form name=frm id=frm action="" method="post" > + {% csrf_token %} + <center> + <table class="table"> + {{ form.as_table }} + </table> + <script type="text/javascript"> + $("#id_start_date_time").datetimepicker({format: 'Y-m-d H:i:s'}); + $("#id_end_date_time").datetimepicker({format: 'Y-m-d H:i:s'}); + </script> + <br/> + <button class="btn btn-success btn-lg" id="submit" name="questionpaper"> + <i class="fa fa-save"> Save</i> + </button> + </center> + </form> + <br> + {% if quiz and course_id %} + {% if quiz.questionpaper_set.get.id %} + <center> + <a href="{% url 'yaksh:designquestionpaper' quiz.id quiz.questionpaper_set.get.id course_id %}" class="btn btn-primary"> + <i class="fa fa-edit"></i> Edit Question Paper + </a> + <a href="{% url 'yaksh:preview_questionpaper' quiz.questionpaper_set.get.id %}" class="btn btn-info" target="_blank"> + <i class="fa fa-eye"></i> Preview Question Paper + </a> + <br> + <br> + <h4>You can check the quiz by attempting it in the following modes:</h4> + <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'usermode' quiz.id course_id %}" target="blank"> + User Mode + </a> - <button class="btn btn-outline-info" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/godmode/{{quiz.id}}/{{course_id}}/");'> - God Mode</button> - <a data-toggle="collapse" data-target="#help"> - <span class=" text-info"><i class="fa fa-info-circle"></i> Help</span></a> - <div id="help" class="collapse"> - <br/> - <ul> - <li><b>User Mode:</b> Attempt quiz the way normal users will attempt i.e. - - <ul> - <li><i>Quiz will have the same duration as that of the original quiz.</li> - <li>Quiz won't start if the course is inactive or the quiz time has expired.</li> - <li>You will be notified about quiz prerequisites.(You can still attempt the quiz though)</i></li> - </ul> - </p> - <li> <b>God Mode:</b> Attempt quiz without any time or eligibilty constraints.</p> - </div> - {% endif %} -{% endif %} -<style type="text/css"> - #rendered_text{ - width: 550px; - } -</style> + <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'godmode' quiz.id course_id %}" target="blank"> + God Mode + </a> + <a data-toggle="collapse" data-target="#help"> + <span class=" text-info"><i class="fa fa-info-circle"></i> Help</span></a> + <div id="help" class="collapse"> + <br> + <div class="card border-primary"> + <div class="card-body"> + <b>User Mode:</b> Attempt quiz the way normal users will attempt i.e. - + <ul class="list-group list-group-flush"> + <li class="list-group-item">Quiz will have the same duration as that of the original quiz.</li> + <li class="list-group-item">Quiz won't start if the course is inactive or the quiz time has expired.</li> + <li class="list-group-item">You will be notified about quiz prerequisites.(You can still attempt the quiz though)</li> + </ul> + <b>God Mode:</b> Attempt quiz without any time or eligibilty constraints. + </div> + </div> + </div> + {% endif %} + {% endif %} + <style type="text/css"> + #rendered_text{ + width: 550px; + } + </style> </div> {% endblock %} diff --git a/yaksh/templates/yaksh/course_added_modules.html b/yaksh/templates/yaksh/course_added_modules.html index 99f5dda..c70eb7a 100644 --- a/yaksh/templates/yaksh/course_added_modules.html +++ b/yaksh/templates/yaksh/course_added_modules.html @@ -10,11 +10,11 @@ {% for module in modules %} <tr> <td> - <a href="{{URL_ROOT}}/exam/manage/courses/add_module/{{module.id}}/{{course.id}}"> + <a href="{% url 'yaksh:edit_module' module.id course.id %}"> {{module.name}}</a> </td> <td> - <a href="{{URL_ROOT}}/exam/manage/courses/designmodule/{{module.id}}/{{course.id}}/"> + <a href="{% url 'yaksh:design_module' module.id course.id %}"> Add Quizzes/Lessons for {{module.name}} </a> </td> @@ -24,14 +24,14 @@ <li> {% if unit.type == "quiz" %} {% if unit.quiz.is_exercise %} - <a href="{{URL_ROOT}}/exam/manage/add_exercise/{{unit.quiz.id}}/{{course.id}}"> + <a href="{% url 'yaksh:edit_exercise' unit.quiz.id course.id %}"> {{unit.quiz.description}}</a> {% else %} - <a href="{{URL_ROOT}}/exam/manage/addquiz/{{unit.quiz.id}}/{{course.id}}"> + <a href="{% url 'yaksh:edit_quiz' unit.quiz.id course.id %}"> {{unit.quiz.description}}</a> {% endif %} {% else %} - <a href="{{URL_ROOT}}/exam/manage/courses/edit_lesson/{{unit.lesson.id}}/{{course.id}}"> + <a href="{% url 'yaksh:edit_lesson' unit.lesson.id course.id %}"> {{unit.lesson.name}}</a> {% endif %} </li> diff --git a/yaksh/templates/yaksh/course_detail.html b/yaksh/templates/yaksh/course_detail.html index 2caf109..2617c61 100644 --- a/yaksh/templates/yaksh/course_detail.html +++ b/yaksh/templates/yaksh/course_detail.html @@ -62,12 +62,29 @@ {% include "yaksh/course_teachers.html" %} {% else %} <div class="jumbotron"> - <h1 class="display-3">Hello, world!</h1> - <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p> + <h1 class="display-4">Manage Course</h1> <hr class="my-4"> - <p>It uses utility classes for typography and spacing to space content out within the larger container.</p> + <p> + <ul> + <li> + Students enrollments + </li> + <li> + Add and View Modules, Lessons and Quizzes + </li> + <li> + Send mail to the students + </li> + <li> + View Students course progress + </li> + <li> + Add and View Teachers/TAs + </li> + </ul> + </p> <p class="lead"> - <a class="btn btn-primary btn-lg" href="#" role="button"> + <a class="btn btn-primary btn-lg" href="https://yaksh.readthedocs.io/en/latest/moderator_docs/creating_course.html" role="button" target="blank"> <i class="fa fa-info-circle"></i> Learn more </a> diff --git a/yaksh/templates/yaksh/course_progress.html b/yaksh/templates/yaksh/course_progress.html index d7bb1c5..800a975 100644 --- a/yaksh/templates/yaksh/course_progress.html +++ b/yaksh/templates/yaksh/course_progress.html @@ -5,54 +5,58 @@ <div class="text-center"> <h3>Course Progress</h3> <div class="col"> - Number Of Students: {{ student_details | length }} + Number Of Students: {{ students_no }} </div> </div> + {% include "yaksh/paginator.html" %} <table class="tablesorter table table-bordered table-responsive-sm" id="course_table" data-sortlist="[0,0]"> <thead> <tr> - <th>Roll No.</th> - <th>Name</th> - <th>Current Unit</th> - <th>Completion Percentage</th> - <th>Grade</th> + <th>Sr. No</th> + <th>Roll No.</th> + <th>Name</th> + <th>Current Unit</th> + <th>Completion Percentage</th> + <th>Grade</th> </tr> </thead> <tbody> {% for student, grade, percent, unit in student_details %} <tr> - <td> - {{ student.profile.roll_number}} - </td> - <td width="50%"> - <a class="user_data" data-item-id="{{course.id}}+{{student.id}}" data-toggle="tooltip" title="Click to view Overall Course progress" data-placement="top"> - {{ student.get_full_name|title}} - <i class="fa fa-caret-down"></i> - </a> - <div id="show_status_{{course.id}}_{{student.id}}" style="display: None;"> - </div> - </td> - <td> - {% if unit %} - {% if unit.type == 'quiz' %} - {{unit.quiz.description}} + <td>{{forloop.counter}}</td> + <td> + {{ student.profile.roll_number}} + </td> + <td width="50%"> + <a class="user_data" data-item-id="{{course.id}}+{{student.id}}" data-toggle="tooltip" title="Click to view Overall Course progress" data-placement="top"> + {{ student.get_full_name|title}} + <i class="fa fa-caret-down"></i> + </a> + <div id="show_status_{{course.id}}_{{student.id}}" style="display: None;"> + </div> + </td> + <td> + {% if unit %} + {% if unit.type == 'quiz' %} + {{unit.quiz.description}} + {% else %} + {{unit.lesson.name}} + {% endif %} {% else %} - {{unit.lesson.name}} - {% endif %} - {% else %} - NA - {% endif%} - </td> - <td> - {{ percent }} % - </td> - <td> - {{ grade }} - </td> + NA + {% endif%} + </td> + <td> + {{ percent }} % + </td> + <td> + {{ grade }} + </td> </tr> {% endfor %} </tbody> </table> + {% include "yaksh/paginator.html" %} {% else %} <center> <span class="badge badge-warning"> diff --git a/yaksh/templates/yaksh/course_students.html b/yaksh/templates/yaksh/course_students.html index 9d14d98..ae35251 100644 --- a/yaksh/templates/yaksh/course_students.html +++ b/yaksh/templates/yaksh/course_students.html @@ -19,7 +19,7 @@ <div class="input-group-append"> <button class="btn btn-outline-primary" type=submit> <i class="fa fa-upload"></i> - Upload Users + Upload </button> </div> </div> diff --git a/yaksh/templates/yaksh/course_teachers.html b/yaksh/templates/yaksh/course_teachers.html index 1f241d0..1b1af87 100644 --- a/yaksh/templates/yaksh/course_teachers.html +++ b/yaksh/templates/yaksh/course_teachers.html @@ -19,7 +19,7 @@ <table> </div> <br> - <button class="btn btn-danger btn-lg" type="submit" data-toggle="tooltip" title="Remove Selected Teachers from this course"> + <button class="btn btn-danger" type="submit" data-toggle="tooltip" title="Remove Selected Teachers from this course"> <i class="fa fa-minus-square"></i> Remove Teachers </button> diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html index d811cf7..c8897aa 100644 --- a/yaksh/templates/yaksh/courses.html +++ b/yaksh/templates/yaksh/courses.html @@ -56,9 +56,6 @@ <center> <h2> No Courses Found </h2> <br> - <a href="{% url 'yaksh:add_course' %}" class="btn btn-success btn-lg"> - <span class=" fa fa-plus-circle"></span> Add Course - </a> </center> {% else %} <div class="container"> diff --git a/yaksh/templates/yaksh/design_course_session.html b/yaksh/templates/yaksh/design_course_session.html index 52895ed..a15f4b1 100644 --- a/yaksh/templates/yaksh/design_course_session.html +++ b/yaksh/templates/yaksh/design_course_session.html @@ -51,7 +51,8 @@ </div> <br> <center> - <button id="Add" name="Add" class="btn btn-success" type="submit">Add to course</button> + <button id="Add" name="Add" class="btn btn-success" type="submit"> + <i class="fa fa-plus-square"></i> Add to course</button> </center> <br><br> </div> @@ -126,8 +127,8 @@ </div> <br> <center> - <button id="Remove" name="Remove" class="btn btn-danger" type="submit">Remove from course</button> - <button id="Change" name="Change" class="btn btn-info" type="submit"> Change Order</button> + <button id="Remove" name="Remove" class="btn btn-danger" type="submit"><i class="fa fa-minus-square"></i> Remove from course</button> + <button id="Change" name="Change" class="btn btn-info" type="submit"><i class="fa fa-reorder"></i> Change Order</button> <button id="Change" name="change_prerequisite_completion" class="btn btn-primary" type="submit"> Change Prerequisite Completion</button> <button id="Change_prereq_passing" name="change_prerequisite_passing" class="btn btn-primary" type="submit"> Change Prerequisite Passing</button> diff --git a/yaksh/templates/yaksh/moderator_dashboard.html b/yaksh/templates/yaksh/moderator_dashboard.html index 24be7b5..e9a6985 100644 --- a/yaksh/templates/yaksh/moderator_dashboard.html +++ b/yaksh/templates/yaksh/moderator_dashboard.html @@ -62,13 +62,13 @@ {% endif %} </div> <div class="col-md-3"> - <a href="{% url 'yaksh:course_detail' course.id %}" class="btn btn-primary btn-lg"> + <a href="{% url 'yaksh:course_detail' course.id %}" class="btn btn-primary"> <i class="fa fa-tasks"></i> Manage Course </a> </div> <div class="col-md"> - <a class="card-link btn btn-info btn-lg" data-toggle="collapse" href="#collapse{{course.id}}"> + <a class="card-link btn btn-info" data-toggle="collapse" href="#collapse{{course.id}}"> Details <i class="fa fa-toggle-down" id="toggle_course_{{course.id}}"></i> </a> diff --git a/yaksh/urls.py b/yaksh/urls.py index 543dc1d..3ba2f9e 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -162,7 +162,7 @@ urlpatterns = [ url(r'^manage/regrade/paper/(?P<course_id>\d+)/(?P<answerpaper_id>\d+)/$', views.regrade, name='regrade'), url(r'^manage/(?P<mode>godmode|usermode)/(?P<quiz_id>\d+)/' - '(?P<course_id>\d+)/$', views.test_quiz), + '(?P<course_id>\d+)/$', views.test_quiz, name="test_quiz"), url(r'^manage/create_demo_course/$', views.create_demo_course, name="create_demo_course"), url(r'^manage/courses/download_course_csv/(?P<course_id>\d+)/$', diff --git a/yaksh/views.py b/yaksh/views.py index e73b55a..9c2a0df 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -328,15 +328,11 @@ def add_quiz(request, quiz_id=None, course_id=None): if quiz is None: form.instance.creator = user form.save() - if not course_id: - return my_redirect("/exam/manage/courses/all_quizzes/") - else: - return my_redirect("/exam/manage/courses/") - + messages.success(request, "Quiz saved successfully") else: form = QuizForm(instance=quiz) - context["course_id"] = course_id - context["quiz"] = quiz + context["course_id"] = course_id + context["quiz"] = quiz context["form"] = form return my_render_to_response(request, 'yaksh/add_quiz.html', context) @@ -970,6 +966,9 @@ def add_course(request, course_id=None): if course_id is None: new_course.creator = user new_course.save() + messages.success( + request, "Saved {0} successfully".format(new_course.name) + ) return my_redirect('/exam/manage/courses') else: return my_render_to_response( @@ -2427,9 +2426,9 @@ def edit_lesson(request, lesson_id=None, course_id=None): course = get_object_or_404(Course, id=course_id) if not course.is_creator(user) and not course.is_teacher(user): raise Http404('This Lesson does not belong to you') - redirect_url = "/exam/manage/courses/" + redirect_url = reverse("yaksh:get_course_modules", args=[course_id]) else: - redirect_url = "/exam/manage/courses/all_lessons/" + redirect_url = reverse("yaksh:show_all_lessons") context = {} if request.method == "POST": if "Save" in request.POST: @@ -2454,7 +2453,9 @@ def edit_lesson(request, lesson_id=None, course_id=None): LessonFile.objects.get_or_create( lesson=lesson, file=les_file ) - return my_redirect(redirect_url) + messages.success( + request, "Saved {0} successfully".format(lesson.name) + ) else: context['lesson_form'] = lesson_form context['error'] = lesson_form["video_file"].errors @@ -2466,7 +2467,13 @@ def edit_lesson(request, lesson_id=None, course_id=None): files = LessonFile.objects.filter(id__in=remove_files_id) for file in files: file.remove() - return my_redirect(redirect_url) + messages.success( + request, "Deleted files successfully" + ) + else: + messages.warning( + request, "Please select atleast one file to delete" + ) lesson_files = LessonFile.objects.filter(lesson=lesson) lesson_files_form = LessonFileForm() @@ -2589,7 +2596,7 @@ def design_module(request, module_id, course_id=None): learning_module.learning_unit.remove(*remove_values) LearningUnit.objects.filter(id__in=remove_values).delete() messages.success( - request, "Lessons/quizzes delected successfully" + request, "Lessons/quizzes deleted successfully" ) else: messages.warning( @@ -2654,7 +2661,10 @@ def add_module(request, module_id=None, course_id=None): module = module_form.save() module.html_data = get_html_text(module.description) module.save() - return my_redirect(redirect_url) + messages.success( + request, + "Saved {0} successfully".format(module.name) + ) else: context['module_form'] = module_form @@ -2695,8 +2705,8 @@ def show_all_modules(request): raise Http404('You are not allowed to view this page!') learning_modules = LearningModule.objects.filter( creator=user, is_trial=False) - context = {"learning_modules": learning_modules, "type": "learning_module"} - return my_render_to_response(request, 'yaksh/courses.html', context) + context = {"modules": learning_modules} + return my_render_to_response(request, 'yaksh/course_added_modules.html', context) @login_required @@ -2914,13 +2924,26 @@ def course_status(request, course_id): course = get_object_or_404(Course, pk=course_id) if not course.is_creator(user) and not course.is_teacher(user): raise Http404('This course does not belong to you') - students = course.get_only_students() + students = course.students.order_by("-id") + students_no = students.count() + paginator = Paginator(students, 100) + page = request.GET.get('page') + try: + students = paginator.page(page) + except PageNotAnInteger: + # If page is not an integer, deliver first page. + students = paginator.page(1) + except EmptyPage: + # If page is out of range (e.g. 9999), deliver last page of results. + students = paginator.page(paginator.num_pages) + stud_details = [(student, course.get_grade(student), course.get_completion_percent(student), - course.get_current_unit(student)) for student in students] + course.get_current_unit(student)) + for student in students.object_list] context = { - 'course': course, 'student_details': stud_details, - 'course_status': True, 'is_progress': True + 'course': course, 'objects': students, 'is_progress': True, + 'student_details': stud_details, 'students_no': students_no } return my_render_to_response(request, 'yaksh/course_detail.html', context) |