summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2018-01-02 15:51:36 +0530
committeradityacp2018-01-02 15:51:36 +0530
commitde0f0be2f5963da2f03616c192dfe339c021eff6 (patch)
treefafaac934e42e5f877257c6a9700074f7bff8822 /yaksh
parent8a062d48a0347ae43b1b9d5b1ca532387d8ad3d9 (diff)
downloadonline_test-de0f0be2f5963da2f03616c192dfe339c021eff6.tar.gz
online_test-de0f0be2f5963da2f03616c192dfe339c021eff6.tar.bz2
online_test-de0f0be2f5963da2f03616c192dfe339c021eff6.zip
Changes in views, models, templates and js
- Rename learning_type to type in Lesson model - Change error message in views and change redirection - Change templates to rename learning_type to type for unit - Add new dialog for embedding Video URL
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py13
-rw-r--r--yaksh/static/yaksh/js/design_course.js6
-rw-r--r--yaksh/static/yaksh/js/lesson.js4
-rw-r--r--yaksh/templates/manage.html2
-rw-r--r--yaksh/templates/user.html4
-rw-r--r--yaksh/templates/yaksh/add_lesson.html4
-rw-r--r--yaksh/templates/yaksh/add_module.html37
-rw-r--r--yaksh/templates/yaksh/courses.html56
-rw-r--r--yaksh/templates/yaksh/design_course_session.html33
-rw-r--r--yaksh/views.py8
10 files changed, 116 insertions, 51 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 7ed87fe..5eca3d1 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -609,11 +609,18 @@ class Course(models.Model):
demo_que_ppr = QuestionPaper()
demo_que_ppr.create_demo_quiz_ppr(demo_quiz, user)
success = True
- ordered_unit = LearningUnit.objects.create(
+ demo_lesson = Lesson.objects.create(
+ name="Demo lesson", description="demo lesson",
+ html_data="demo lesson", creator=user)
+ quiz_unit = LearningUnit.objects.create(
order=1, type="quiz", quiz=demo_quiz)
+ lesson_unit = LearningUnit.objects.create(
+ order=2, type="lesson", lesson=demo_lesson)
learning_module = LearningModule.objects.create(
- name="demo module", description="demo module", creator=user)
- learning_module.learning_unit.add(ordered_unit)
+ name="demo module", description="demo module", creator=user,
+ html_data="demo module")
+ learning_module.learning_unit.add(quiz_unit)
+ learning_module.learning_unit.add(lesson_unit)
course.learning_module.add(learning_module)
else:
success = False
diff --git a/yaksh/static/yaksh/js/design_course.js b/yaksh/static/yaksh/js/design_course.js
index 2e2f6c9..7b01491 100644
--- a/yaksh/static/yaksh/js/design_course.js
+++ b/yaksh/static/yaksh/js/design_course.js
@@ -20,9 +20,7 @@ $(document).ready(function(){
$(this).append('<input type="hidden" name="ordered_list" value='+order_list+'>');
return true;
});
- var msg = "If the value is True, Check if Prerequisite is completed. \n" +
- "If the value is False, Don't check for Prerequisite. \n" +
- "Prerequisite can either be a Quiz or Lesson. \n" +
- "Prerequisite is checked according to the order of Quiz or Lesson.";
+ var msg = "Check Prerequisite is set to Yes by default \n" +
+ "To change, select the Change checkbox and Click Change Prerequisite button \n";
$("#prereq_msg").attr("title", msg);
}); \ No newline at end of file
diff --git a/yaksh/static/yaksh/js/lesson.js b/yaksh/static/yaksh/js/lesson.js
index 82552b0..6f873b9 100644
--- a/yaksh/static/yaksh/js/lesson.js
+++ b/yaksh/static/yaksh/js/lesson.js
@@ -42,8 +42,8 @@ $(document).ready(function(){
}
$("#embed").click(function() {
- $("#dialog").toggle();
- $("#dialog").dialog({
+ $("#dialog_iframe").toggle();
+ $("#dialog_iframe").dialog({
resizable: false,
height: '300',
width: '450'
diff --git a/yaksh/templates/manage.html b/yaksh/templates/manage.html
index 9aa0a54..17ce23e 100644
--- a/yaksh/templates/manage.html
+++ b/yaksh/templates/manage.html
@@ -39,7 +39,7 @@
<!-- end iframe div -->
<!-- Dialog to video embed -->
- <div id="dialog" title="Embed Video URL" style="display: none;">
+ <div id="dialog_iframe" title="Embed Video URL" style="display: none;">
<label>Enter Url:</label>
<input id="url" name="url" type="text" required="true">
<input type="button" id="submit_info" name="submit_info" class="btn" value="Submit" />
diff --git a/yaksh/templates/user.html b/yaksh/templates/user.html
index 987593f..090e93d 100644
--- a/yaksh/templates/user.html
+++ b/yaksh/templates/user.html
@@ -11,9 +11,9 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
- <a class="navbar-brand navbar-left" href="{{ URL_ROOT }}/exam/manage/">
+ <a class="navbar-brand navbar-left" href="{{ URL_ROOT }}/exam/">
<img src="{{ URL_ROOT }}/static/yaksh/images/yaksh_banner.png" alt="YAKSH" style="margin-top: -3px; margin-left:-15px">
- </img>
+ </img>
</a>
</div>
<div class= "collapse navbar-collapse" id="navbar">
diff --git a/yaksh/templates/yaksh/add_lesson.html b/yaksh/templates/yaksh/add_lesson.html
index 01233fa..d9bc1e7 100644
--- a/yaksh/templates/yaksh/add_lesson.html
+++ b/yaksh/templates/yaksh/add_lesson.html
@@ -48,7 +48,11 @@
<button class="btn" type="submit" id="submit" name="Delete"> Delete Files
</button>
{% endif %}
+ {% if course_id %}
<button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/");'>Cancel</button>
+ {% else %}
+ <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/all_lessons/");'>Cancel</button>
+ {% endif %}
</form>
<button class="btn" type="button" name="button" id="preview">Preview Lesson Description
</button>
diff --git a/yaksh/templates/yaksh/add_module.html b/yaksh/templates/yaksh/add_module.html
index 9ce854e..4efccf7 100644
--- a/yaksh/templates/yaksh/add_module.html
+++ b/yaksh/templates/yaksh/add_module.html
@@ -7,12 +7,12 @@
<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-1.9.1.min.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/design_course.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/lesson.js"></script>
-<script src="https://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-ui.js"></script>
{% endblock %}
{% block css %}
<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/yaksh/css/design_course.css" />
-<link rel="stylesheet" href="https://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
+<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/jquery-ui/jquery-ui.css">
{% endblock %}
{% block content %}
@@ -86,7 +86,7 @@
</div>
<br>
<center>
- <button class="btn" type="submit" id="submit" name="Add">
+ <button class="btn btn-success" type="submit" id="submit" name="Add">
Add to Module
</button>
</center>
@@ -99,16 +99,25 @@
<div id="fixed-added">
<table id="course-details" class="table table-bordered">
<tr>
- <th>Select</th>
+ <th width="5%">Select</th>
<th>Quiz/Lesson</th>
- <th>Order</th>
- <th width="20%">Check Prerequisite
+ <th width="20%">Order</th>
+ <th width="25%" colspan="2">Check Prerequisite
+ <br>
<a href="#" data-toggle="tooltip" id="prereq_msg">
<span class="glyphicon glyphicon-question-sign">
</span> What's This
</a>
</th>
</tr>
+ <tr>
+ <th scope="row">&nbsp;</th>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ <th>Currently</th>
+ <th>Change</th>
+ </tr>
+ </tr>
{% for unit in learning_units %}
<tr>
<ul class="inputs-list">
@@ -125,8 +134,14 @@
<td><input type="number" name="order" data-item-id="{{unit.id}}" value="{{unit.order}}" step="1"></td>
{% endif %}
<td>
- <input type="checkbox" name="check_prereq" value="{{unit.id}}">
- &nbsp;{{unit.check_prerequisite}}
+ {% if unit.check_prerequisite %}
+ Yes
+ {% else %}
+ No
+ {% endif %}
+ </td>
+ <td>
+ <input type="checkbox" name="check_prereq" value="{{unit.id}}">
</td>
</ul>
</tr>
@@ -136,9 +151,9 @@
</div>
<br>
<center>
- <button id="Remove" name="Remove" class="btn small primary" type="submit">Remove from Module</button>
- <button id="Change" name="Change" class="btn small primary" type="submit"> Change Order</button>
- <button id="Change" name="Change_prerequisite" class="btn small primary" type="submit"> Change Prerequisite</button>
+ <button id="Remove" name="Remove" class="btn btn-danger" type="submit">Remove from Module</button>
+ <button id="Change" name="Change" class="btn btn-info" type="submit"> Change Order</button>
+ <button id="Change" name="Change_prerequisite" class="btn btn-primary" type="submit"> Change Prerequisite</button>
</center>
</div>
</div> <!-- /.row -->
diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html
index 3d26d14..0efa72a 100644
--- a/yaksh/templates/yaksh/courses.html
+++ b/yaksh/templates/yaksh/courses.html
@@ -29,7 +29,7 @@
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
{% if type == "courses" %}
- <li><a href="#" id="link_created_courses">Created Courses</a></li>
+ <li><a href="#" id="link_created_courses">My Courses</a></li>
<li><a href="#" id="link_allotted_courses">Allotted Courses</a></li>
{% else %}
<li><a href="{{URL_ROOT}}/exam/manage/courses">View all Courses</a></li>
@@ -45,12 +45,13 @@
</li>
<li>
<a href="{{URL_ROOT}}/exam/manage/courses/all_learning_module">
- Add/View Learning Modules</a>
+ Add/View Modules</a>
</li>
</ul>
</div>
</div>
-<!-- {% if type == "courses" %} -->
+
+{% if type == "courses" %}
<div id="created_courses" style="display: none;">
{% if not courses %}
<center><h4> No new Courses created </h4></center>
@@ -60,7 +61,7 @@
<table id="course-details" class="table table-bordered">
<tr>
<th>Courses</th>
- <th>Lessons/Quizzes</th>
+ <th>Modules</th>
</tr>
{% for course in courses %}
@@ -98,6 +99,11 @@
<br><br>
<ul>
<li>
+ <a href="{{URL_ROOT}}/exam/manage/courses/designcourse/{{course.id}}/">Design Course
+ </a>
+ </li>
+ <br>
+ <li>
<a href="{{URL_ROOT}}/exam/manage/edit_course/{{course.id}}">Edit Course</a>
</li>
<br>
@@ -111,11 +117,6 @@
</li>
<br>
<li>
- <a href="{{URL_ROOT}}/exam/manage/courses/designcourse/{{course.id}}/">Design Course Session
- </a>
- </li>
- <br>
- <li>
<a href="{{URL_ROOT}}/exam/manage/toggle_status/{{ course.id }}/">
{% if course.active %}Deactivate Course {% else %} Activate Course {% endif %}
</a>
@@ -131,8 +132,8 @@
<table id="course-details" class="table table-bordered">
{% if course.get_learning_modules %}
<tr>
- <th>Learning Modules</th>
- <th>Design Learning module</th>
+ <th>Module</th>
+ <th>Module Design</th>
<th>Lessons/Quizzes</th>
</tr>
{% for module in course.get_learning_modules %}
@@ -186,7 +187,7 @@
<table id="course-details" class="table table-bordered">
<tr>
<th>Courses</th>
- <th>Lessons/Quizzes</th>
+ <th>Modules</th>
</tr>
{% for course in allotted_courses %}
@@ -228,6 +229,11 @@
<br><br>
<ul>
<li>
+ <a href="{{URL_ROOT}}/exam/manage/courses/designcourse/{{course.id}}/">Design Course
+ </a>
+ </li>
+ <br>
+ <li>
<a href="{{URL_ROOT}}/exam/manage/edit_course/{{course.id}}">Edit Course</a>
</li>
<br>
@@ -257,8 +263,9 @@
<table id="course-details" class="table table-bordered">
{% if course.get_learning_modules %}
<tr>
- <th>Learning Modules</th>
- <th>Design Learning module</th>
+ <th>Module</th>
+ <th>Module Design</th>
+ <th>Lessons/Quizzes</th>
</tr>
{% for module in course.get_learning_modules %}
<tr>
@@ -271,6 +278,21 @@
Add Quizzes/Lessons for {{module.name}}
</a>
</td>
+ <td>
+ {% for unit in module.get_learning_units %}
+ <ul class="inputs-list">
+ <li>
+ {% if unit.type == "quiz" %}
+ <a href="{{URL_ROOT}}/exam/manage/addquiz/{{unit.quiz.id}}/{{course.id}}">
+ {{unit.quiz.description}}</a>
+ {% else %}
+ <a href="{{URL_ROOT}}/exam/manage/courses/edit_lesson/{{unit.lesson.id}}/{{course.id}}">
+ {{unit.lesson.name}}</a>
+ {% endif %}
+ </li>
+ </ul>
+ {% endfor %}
+ </td>
</tr>
{% endfor %} <!-- end for modules -->
{% else %}
@@ -284,7 +306,8 @@
</div>
{% endif %}
</div>
-<!-- {% endif %} -->
+{% endif %}
+<!-- End if all Courses -->
<!-- Show all Quizzes -->
<div id="all_quizzes" >
@@ -308,7 +331,8 @@
<td>{{forloop.counter}}</td>
<td width="30%">
<ul class="list-group">
- <a href="{{URL_ROOT}}/exam/manage/addquiz/{{quiz.id}}/">{{ quiz.description }}</a>
+ <a href="{{URL_ROOT}}/exam/manage/addquiz/{{quiz.id}}/">{{ quiz.description }}
+ </a>
{% if quiz.active %}
<span class="label label-success">Active</span>
{% else %}
diff --git a/yaksh/templates/yaksh/design_course_session.html b/yaksh/templates/yaksh/design_course_session.html
index 41c235c..1aabd6c 100644
--- a/yaksh/templates/yaksh/design_course_session.html
+++ b/yaksh/templates/yaksh/design_course_session.html
@@ -58,26 +58,34 @@
</div>
<br>
<center>
- <button id="Add" name="Add" class="btn small primary" type="submit">Add to course</button>
+ <button id="Add" name="Add" class="btn btn-success" type="submit">Add to course</button>
</center>
<br><br>
</div>
<div class="col-md-8 col-md-offset-2">
<div id="fixed-added-wrapper">
- <p><u><b>Choosen Lessons and quizzes: (Change Order)</b></u></p>
+ <p><u><b>Choosen Lessons and quizzes:</b></u></p>
<div id="fixed-added">
<table id="course-details" class="table table-bordered">
<tr>
- <th>Select</th>
+ <th width="5%">Select</th>
<th>Learning Module</th>
- <th>Order</th>
- <th width="20%">Check Prerequisite
+ <th width="20%">Order</th>
+ <th width="25%" colspan="2">Check Prerequisite
+ <br>
<a href="#" data-toggle="tooltip" id="prereq_msg">
<span class="glyphicon glyphicon-question-sign">
</span> What's This
</a>
</th>
</tr>
+ <tr>
+ <th scope="row">&nbsp;</th>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ <th>Currently</th>
+ <th>Change</th>
+ </tr>
{% for module in added_learning_modules %}
<tr>
<ul class="inputs-list">
@@ -89,7 +97,14 @@
<input type="number" name="order" data-item-id="{{module.id}}" value="{{module.order}}" step="1">
</td>
<td>
- <input type="checkbox" name="check_prereq" value="{{module.id}}">&nbsp;{{module.check_prerequisite}}
+ {% if module.check_prerequisite %}
+ Yes
+ {% else %}
+ No
+ {% endif %}
+ </td>
+ <td>
+ <input type="checkbox" name="check_prereq" value="{{module.id}}">
</td>
</ul>
</tr>
@@ -99,9 +114,9 @@
</div>
<br>
<center>
- <button id="Remove" name="Remove" class="btn small primary" type="submit">Remove from course</button>
- <button id="Change" name="Change" class="btn small primary" type="submit"> Change Order</button>&nbsp;&nbsp;
- <button id="Change" name="Change_prerequisite" class="btn small primary" type="submit"> Change Prerequisite</button>
+ <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="Change" name="Change_prerequisite" class="btn btn-primary" type="submit"> Change Prerequisite</button>
</center>
</div>
</div> <!-- /.row -->
diff --git a/yaksh/views.py b/yaksh/views.py
index f9a43ba..295b983 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -337,8 +337,10 @@ def prof_manage(request, msg=None):
rights/permissions and log in."""
user = request.user
ci = RequestContext(request)
- if not user.is_authenticated() and not is_moderator(user):
- return my_redirect('/exam/login/')
+ if not user.is_authenticated():
+ return my_redirect('/exam/login')
+ if not is_moderator(user):
+ return my_redirect('/exam/')
courses = Course.objects.filter(creator=user, is_trial=False)
trial_paper = AnswerPaper.objects.filter(
@@ -467,7 +469,7 @@ def start(request, questionpaper_id=None, attempt_num=None, course_id=None,
)
# allowed to start
if not quest_paper.can_attempt_now(user, course_id):
- msg = "You cannot attempt {0} quiz more than {1} times".format(
+ msg = "You cannot attempt {0} quiz more than {1} time(s)".format(
quest_paper.quiz.description, quest_paper.quiz.attempts_allowed)
if is_moderator(user):
return prof_manage(request, msg=msg)