summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2018-01-14 16:20:58 +0530
committeradityacp2018-01-14 16:20:58 +0530
commitef22478a11d518982f38a6a0d4d84f6f8ba5e492 (patch)
tree99b437d71f841cb1ac9f26266d7e7de04031f340 /yaksh
parent5d206993d21c169cbc115733188f898d6c762e83 (diff)
downloadonline_test-ef22478a11d518982f38a6a0d4d84f6f8ba5e492.tar.gz
online_test-ef22478a11d518982f38a6a0d4d84f6f8ba5e492.tar.bz2
online_test-ef22478a11d518982f38a6a0d4d84f6f8ba5e492.zip
Change in models.py, course.js and course_detail.html
- Merge future imports in models into one - Add table sorter in course.js and course_detail.html
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py7
-rw-r--r--yaksh/static/yaksh/js/course.js3
-rw-r--r--yaksh/templates/yaksh/course_detail.html37
3 files changed, 37 insertions, 10 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 3b1e3ba..f0d1b2e 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1,5 +1,4 @@
-from __future__ import unicode_literals
-from __future__ import division
+from __future__ import unicode_literals, division
from datetime import datetime, timedelta
import json
import random
@@ -489,7 +488,7 @@ class LearningModule(models.Model):
def get_module_complete_percent(self, course, user):
units = self.get_learning_units()
if not units:
- percent = 0
+ percent = 0.0
else:
status_list = [unit.get_completion_status(user, course)
for unit in units]
@@ -700,7 +699,7 @@ class Course(models.Model):
def percent_completed(self, user):
modules = self.get_learning_modules()
if not modules:
- percent = 0
+ percent = 0.0
else:
status_list = [module.get_module_complete_percent(self, user)
for module in modules]
diff --git a/yaksh/static/yaksh/js/course.js b/yaksh/static/yaksh/js/course.js
index 1ca908b..1c64a3e 100644
--- a/yaksh/static/yaksh/js/course.js
+++ b/yaksh/static/yaksh/js/course.js
@@ -133,6 +133,9 @@ $("#export").click(function (event) {
exportTableToCSV.apply(this, [$('#course_table'), outputFile]);
});
+// Table sorter for course details
+$("table").tablesorter({});
+
});
function view_status(unit){
diff --git a/yaksh/templates/yaksh/course_detail.html b/yaksh/templates/yaksh/course_detail.html
index cd9d149..a5d10a7 100644
--- a/yaksh/templates/yaksh/course_detail.html
+++ b/yaksh/templates/yaksh/course_detail.html
@@ -10,6 +10,7 @@
<script language="JavaScript" type="text/javascript" src="{{ URL_ROOT }}/static/yaksh/js/course.js"></script>
<script type="text/javascript" src="{{ URL_ROOT }}/static/yaksh/js/tinymce/js/tinymce/tinymce.min.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-ui.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/jquery.tablesorter.min.js"></script>
{% endblock %}
{% block css %}
<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/jquery-ui/jquery-ui.css">
@@ -20,7 +21,7 @@
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
- {% if state == 'mail'%}
+ {% if state == 'mail' or state == 'course_status' %}
<li><a href="{{URL_ROOT}}/exam/manage/course_detail/{{course.id}}/">
Go to Course Details</a></li>
{% else %}
@@ -88,7 +89,8 @@
<div id="reject">
<form action="{{URL_ROOT}}/exam/manage/send_mail/{{ course.id }}/" method="post" id="send_mail_form">
{% csrf_token %}
- <table class="table table-striped">
+ <table id="mail_table" class="tablesorter table table-striped" data-sortlist="[1,0]">
+ <thead>
<th></th>
<th></th>
<th>Full Name</th>
@@ -96,6 +98,8 @@
<th>Roll Number</th>
<th>Institute</th>
<th>Department</th>
+ </thead>
+ <tbody>
{% for enrolled in course.get_enrolled %}
<tr>
<td><input type="checkbox" name="check" value="{{ enrolled.id }}"></td>
@@ -107,6 +111,7 @@
<td> {{enrolled.profile.department}}</td>
</tr>
{% endfor %}
+ </tbody>
</table>
<br>
<textarea name="subject" id="subject" placeholder="Email Subject" cols="50"></textarea>
@@ -125,7 +130,8 @@
<input type="hidden" id="course_name" value="{{course.name}}">
<a href="#" class="btn btn-info" id="export">Export to CSV</a>
<center><h2>Course Status</h2></center>
- <table class="table table-bordered" id="course_table">
+ <table class="tablesorter table table-bordered" id="course_table" data-sortlist="[0,0]">
+ <thead>
<tr>
<th>Sr No.</th>
<th>Students</th>
@@ -141,6 +147,8 @@
<th>
{{module.name}}
<br>
+ ({{module.get_learning_units|length}} Units)
+ <br>
<a data-target="tooltip" title="{% for unit in module.get_learning_units %}{% if unit.type == 'quiz' %}{{unit.quiz.description}}{% else %}{{unit.lesson.name}}{% endif %} / {% endfor %}" id="unit_status{{module.id}}" onmouseover="view_status('#unit_status{{module.id}}')">
View Units</a>
</th>
@@ -149,6 +157,8 @@
<th></th>
{% endif %}
</tr>
+ </thead>
+ <tbody>
{% for student in students %}
<tr>
<td width="5%">
@@ -176,9 +186,11 @@
{% endif %}
</tr>
{% endfor %}
+ </tbody>
</table>
</div>
{% else %}
+ <div id="students_enrollment">
<div id="student-requests">
<center><b><u>Requests</u></b></center><br>
{% if course.get_requests %}
@@ -186,7 +198,8 @@
<div id="enroll-all">
<form action="{{URL_ROOT}}/exam/manage/enroll/{{ course.id }}/" method="post">
{% csrf_token %}
- <table class="table table-striped">
+ <table id="requested_table" class="tablesorter table table-striped" data-sortlist="[1,0]">
+ <thead>
<th></th>
<th></th>
<th>Full Name</th>
@@ -195,6 +208,8 @@
<th>Institute</th>
<th>Department</th>
<th>Enroll/Reject</th>
+ </thead>
+ <tbody>
{% for request in course.get_requests %}
<tr>
<td><input type="checkbox" name="check" value="{{ request.id }}"></td>
@@ -214,6 +229,7 @@
</td>
</tr>
{% endfor %}
+ </tbody>
</table>
<button class="btn btn-success" type="submit" name='enroll' value='enroll'>Enroll Selected</button>
</div>
@@ -228,7 +244,8 @@
<div id="reject">
<form action="{{URL_ROOT}}/exam/manage/enrolled/reject/{{ course.id }}/" method="post" id="reject-form">
{% csrf_token %}
- <table class="table table-striped">
+ <table id="enrolled_table" class="tablesorter table table-striped" data-sortlist="[1,0]">
+ <thead>
<th></th>
<th></th>
<th>Full Name</th>
@@ -237,6 +254,8 @@
<th>Institute</th>
<th>Department</th>
<th>Reject</th>
+ </thead>
+ <tbody>
{% for enrolled in course.get_enrolled %}
<tr>
<td><input type="checkbox" name="check" value="{{ enrolled.id }}"></td>
@@ -252,6 +271,7 @@
</td>
</tr>
{% endfor %}
+ </tbody>
</table>
<button class="btn btn-danger" type="submit" name='reject' value='reject'>
Reject Selected</button>
@@ -267,7 +287,8 @@
<div id="enroll">
<form action="{{URL_ROOT}}/exam/manage/enroll/rejected/{{ course.id }}/" method="post">
{% csrf_token %}
- <table class="table table-striped">
+ <table id="rejected_table" class="tablesorter table table-striped" data-sortlist="[1,0]">
+ <thead>
<th></th>
<th></th>
<th>Full Name</th>
@@ -276,6 +297,8 @@
<th>Institute</th>
<th>Department</th>
<th>Enroll</th>
+ </thead>
+ <tbody>
{% for rejected in course.get_rejected %}
<tr>
<td><input type="checkbox" name="check" value="{{ rejected.id }}"></td>
@@ -292,6 +315,7 @@
</td>
</tr>
{% endfor %}
+ </tbody>
</table>
<br>
<button class="btn btn-success" type="submit" name='enroll' value='enroll'>
@@ -300,6 +324,7 @@
{% endif %}
</form>
</div>
+ </div>
{% endif %}
</div>
</div>