summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/templates/yaksh/add_lesson.html6
-rw-r--r--yaksh/templates/yaksh/add_module.html43
-rw-r--r--yaksh/templates/yaksh/editprofile.html13
-rw-r--r--yaksh/templates/yaksh/show_video.html6
-rw-r--r--yaksh/templates/yaksh/statistics_question.html109
-rw-r--r--yaksh/views.py6
6 files changed, 157 insertions, 26 deletions
diff --git a/yaksh/templates/yaksh/add_lesson.html b/yaksh/templates/yaksh/add_lesson.html
index 024ce49..71477e7 100644
--- a/yaksh/templates/yaksh/add_lesson.html
+++ b/yaksh/templates/yaksh/add_lesson.html
@@ -9,6 +9,8 @@
</script>
<script type="text/javascript" src="{% static 'yaksh/js/jquery-ui.js' %}">
</script>
+<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML">
+</script>
{% endblock %}
{% block css %}
@@ -23,8 +25,8 @@
{{error}}
</div>
{% endif %}
- <div class="row form-group">
- <div class="col">
+ <div class="row justify-content-center form-group">
+ <div class="col-md-5 col-md-offset-4">
<a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}">
<i class="fa fa-arrow-left"></i>&nbsp;Back
</a>
diff --git a/yaksh/templates/yaksh/add_module.html b/yaksh/templates/yaksh/add_module.html
index bd97e36..14e7630 100644
--- a/yaksh/templates/yaksh/add_module.html
+++ b/yaksh/templates/yaksh/add_module.html
@@ -11,6 +11,8 @@
</script>
<script type="text/javascript" src="{% static 'yaksh/js/jquery-ui.js' %}">
</script>
+<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML">
+</script>
{% endblock %}
{% block css %}
@@ -19,17 +21,7 @@
{% endblock %}
{% block content %}
-<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 %}
+<div class="container-fluid">
{% if course_id %}
<a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}">
<i class="fa fa-arrow-left"></i>
@@ -43,10 +35,23 @@
{% endif %}
</div>
<br>
-{% if status == "add" %}
<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 %}
+</div>
+<br>
+{% if status == "add" %}
+<div class="container-fluid">
<div class="row justify-content-center form-group">
- <div class="col-md-9 col-md-offset-4">
+ <div class="col-md-5 col-md-offset-4">
<form name=frm id=frm action="" method="post">
<fieldset>
{% csrf_token %}
@@ -84,9 +89,21 @@
</button>
</center>
</form>
+ <hr>
</fieldset>
</form>
</div>
+ <div class="col-md-5">
+ <div class="card" id="preview_text_div">
+ <div class="card-header">
+ <center>
+ <h3>Description Preview</h3>
+ </center>
+ </div>
+ <div class="card-body" id="description_body">
+ </div>
+ </div>
+ </div>
</div>
</div>
{% endif %}
diff --git a/yaksh/templates/yaksh/editprofile.html b/yaksh/templates/yaksh/editprofile.html
index 47e74ea..c95da88 100644
--- a/yaksh/templates/yaksh/editprofile.html
+++ b/yaksh/templates/yaksh/editprofile.html
@@ -6,13 +6,11 @@
<br>
<form action="{% url 'yaksh:edit_profile'%}" method="post" >
{% csrf_token %}
- <center>
<div class="row justify-content-center form-group">
<div class="col-md-4 col-md-offset-4">
<form action="" method="post">
<fieldset>
{% csrf_token %}
- <center>
{% if form.errors %}
{% for field in form %}
{% for error in field.errors %}
@@ -34,14 +32,17 @@
{% endfor %}
{% endif %}
{% for field in form %}
- <td>{{ field }} <small>{{ field.help_text }}</small></td>
- <br>
+ <div class="form-group">
+ <label>
+ {{ field.label }}
+ </label>
+ {{ field }}
+ </div>
{% endfor %}
<br>
<br>
- </center>
<button class="btn btn-success btn-lg" type="submit">Update</button>&nbsp;&nbsp;
- <a href="{% url 'yaksh:index' %}" class="btn btn-primary btn-lg">Cancel</a></center>
+ <a href="{% url 'yaksh:index' %}" class="btn btn-primary btn-lg">Cancel</a>
</fieldset>
</form>
</div>
diff --git a/yaksh/templates/yaksh/show_video.html b/yaksh/templates/yaksh/show_video.html
index e11e4cd..236f8ef 100644
--- a/yaksh/templates/yaksh/show_video.html
+++ b/yaksh/templates/yaksh/show_video.html
@@ -1,8 +1,12 @@
{% extends "user.html" %}
+{% load static %}
{% load custom_filters %}
{% block title %} {{ learning_module.name }} {% endblock %}
-
+{% block script %}
+<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML">
+</script>
+{% endblock %}
{% block main %}
<div class="wrapper">
<!-- Sidebar -->
diff --git a/yaksh/templates/yaksh/statistics_question.html b/yaksh/templates/yaksh/statistics_question.html
index 58fd8db..9a54501 100644
--- a/yaksh/templates/yaksh/statistics_question.html
+++ b/yaksh/templates/yaksh/statistics_question.html
@@ -19,12 +19,117 @@
{% if question_stats %}
<p><b>Total number of participants: {{ total }}</b></p>
<table class="table table-bordered table-responsive-sm">
- <tr class="bg-light yakshred"><th>Question</th><th>Type</th><th>Total</th><th>Answered</th></tr>
+ <tr class="bg-light yakshred"><th>Question</th><th>Type</th><th>Total</th><th>Answered Correctly</th></tr>
{% for question, value in question_stats.items %}
- <tr><td>{{ question.summary }}</td><td>{{ question.type }}</td><td>{{value.1}}</td><td>{{ value.0 }} ({% widthratio value.0 value.1 100 %}%)</td></tr>
+ <tr>
+ <td>{{ question.summary }}
+ <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapse_question_{{question.id}}" aria-expanded="false" aria-controls="collapseExample">
+ More
+ </button>
+ <div class="collapse" id="collapse_question_{{question.id}}">
+ <div class="card card-body" style="width: 18rem;">
+ <strong>
+ Summary:
+ </strong>
+ <p>
+ {{ question.summary }}
+ </p>
+ <strong>
+ Description:
+ </strong>
+ <p>
+ {{ question.description }}
+ </p>
+ <strong>
+ Points:
+ </strong>
+ <p>
+ {{ question.points }}
+ </p>
+ <strong>
+ Type:
+ </strong>
+ <p>
+ {{ question.type }}
+ </p>
+ {% if question.type in 'mcq mcc' %}
+ <strong>
+ Test Cases:
+ </strong>
+ <p>
+ <ol>
+ {% for tc in question.testcase_set.all %}
+ <li>
+ {{ tc.mcqtestcase.options }}
+ {% if tc.mcqtestcase.correct %}
+ <span class="badge badge-primary">Correct</span>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ol>
+ </p>
+ {% endif %}
+ </div>
+ </div>
+ </td>
+ <td>{{ question.type }}</td>
+ <td>{{value.1}}</td><td>{{ value.0 }} ({% widthratio value.0 value.1 100 %}%)</td>
+
+
+ </tr>
{% endfor %}
</table>
{% endif %}
+
+ <!-- The Modal -->
+ <div class="modal" id="question_detail_modal">
+ <div class="modal-dialog">
+ <div class="modal-content">
+
+ <!-- Modal Header -->
+ <div class="modal-header">
+ <h4 class="modal-title">Question Details</h4>
+ <button type="button" class="close" data-dismiss="modal">&times;</button>
+ </div>
+
+ <!-- Modal body -->
+ <div class="modal-body">
+ <table>
+ <tr>
+ <td>Summary</td>
+ <td>{{ question.summary }}</td>
+ </tr>
+ <tr>
+ <td>Description</td>
+ <td>{{ question.description }}</td>
+ </tr> <tr>
+ <td>Type</td>
+ <td>{{ question.type }}</td>
+ </tr> <tr>
+ <td>Points</td>
+ <td>{{ question.points }}</td>
+ </tr>
+ <tr>
+ {% for tc in question.testcase_set.all %}
+ tc
+ {% endfor %}
+ <br><br>
+ </tr>
+ </table>
+ </div>
+
+ <!-- Modal footer -->
+ <div class="modal-footer">
+ <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
+ </div>
+
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ <!-- end Modal outer -->
</div>
</div>
</div>
diff --git a/yaksh/views.py b/yaksh/views.py
index 495dbe2..668a88c 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -23,7 +23,7 @@ from django.urls import reverse
import json
from textwrap import dedent
import zipfile
-from markdown import Markdown
+import markdown
try:
from StringIO import StringIO as string_io
except ImportError:
@@ -101,7 +101,9 @@ CSV_FIELDS = ['name', 'username', 'roll_number', 'institute', 'department',
def get_html_text(md_text):
"""Takes markdown text and converts it to html"""
- return Markdown().convert(md_text)
+ return markdown.markdown(
+ md_text, extensions=['tables', 'fenced_code']
+ )
def formfield_callback(field):