summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authoradityacp2020-04-27 15:04:31 +0530
committeradityacp2020-04-27 15:31:37 +0530
commitb8636965de8a86e68fd542754678e6826c7e5eac (patch)
tree638930dd42140d760e443c0d35874de6e27b3ef9 /yaksh/templates
parente3f73db877aaf2f6406bef39aee590530bcb503b (diff)
parent53a0c4ad3e733f3960000527f83565f2fd8fc412 (diff)
downloadonline_test-b8636965de8a86e68fd542754678e6826c7e5eac.tar.gz
online_test-b8636965de8a86e68fd542754678e6826c7e5eac.tar.bz2
online_test-b8636965de8a86e68fd542754678e6826c7e5eac.zip
Resolve conflicts in travis, requirements and views
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/yaksh/course_detail_options.html5
-rw-r--r--yaksh/templates/yaksh/course_forum.html115
-rw-r--r--yaksh/templates/yaksh/course_modules.html1
-rw-r--r--yaksh/templates/yaksh/post_comments.html71
4 files changed, 192 insertions, 0 deletions
diff --git a/yaksh/templates/yaksh/course_detail_options.html b/yaksh/templates/yaksh/course_detail_options.html
index 90662d6..4dd4dda 100644
--- a/yaksh/templates/yaksh/course_detail_options.html
+++ b/yaksh/templates/yaksh/course_detail_options.html
@@ -30,6 +30,11 @@
</a>
</li>
<li class="nav-item">
+ <a href="{% url 'yaksh:course_forum' course.id %}" class="nav-link list-group-item" title="Discussion forum of this course" data-placement="top" data-toggle="tooltip">
+ Discussion Forum
+ </a>
+ </li>
+ <li class="nav-item">
<a class="nav-link list-group-item {% if is_add_teacher %} active {% endif %}" href="{% url 'yaksh:search_teacher' course.id %}" data-toggle="tooltip" title="Add Teachers/TAs to this course" data-placement="top">
Add Teachers/TAs
</a>
diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html
new file mode 100644
index 0000000..e6b6a90
--- /dev/null
+++ b/yaksh/templates/yaksh/course_forum.html
@@ -0,0 +1,115 @@
+{% extends base_template %}
+{% load static %}
+{% block title %}
+ {{course.name}}: Discussion Forum
+{% endblock title %}
+{% block content %}
+ <div class="container">
+ <div>
+ <h2><center>{{course.name}}</center></h2>
+ <center>Discussion Forum</center>
+ </div>
+ <div class="d-flex p-2 bd-highlight">
+ <div class="col-md-4">
+ {% if moderator %}
+ <a href="{% url 'yaksh:course_detail' course.id %}" class="btn btn-primary">Back to Course</a>
+ {% else %}
+ <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary">Back to Course</a>
+ {% endif %}
+ </div>
+ <div class="col-md-4">
+ <form class="my-2 my-lg-0" action="" method="GET">
+ <div class="input-group">
+ <input type="search" placeholder="Search" name="search" class="form-control">
+ <span class="input-group-append">
+ <button class="btn btn-outline-info" type="submit"><i class="fa fa-search"></i>&nbsp;Search</button>
+ </span>
+ </div>
+ </form>
+ </div>
+ <div class="col-md-4">
+ <button type="button" class="btn btn-primary pull-right" data-toggle="modal" data-target="#newPostModal">New Post</button>
+ </div>
+ </div>
+ <!-- Modal -->
+ <div id="newPostModal" class="modal fade" role="dialog">
+ <div class="modal-dialog">
+
+ <!-- Modal content-->
+ <div class="modal-content">
+ <div class="modal-header">
+ <h4 class="modal-title">Create a new Post</h4>
+ <button type="button" class="close" data-dismiss="modal">&times;</button>
+ </div>
+ <div class="modal-body">
+ <form action="." method="POST" enctype='multipart/form-data'>
+ <div class="form-group">
+ {% csrf_token %}
+ {{form}}
+ </div>
+ <input type="submit" class="btn btn-primary" value="Create Post">
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ <br>
+ <br>
+ {% if posts %}
+ <table id="posts_table" class="tablesorter table">
+ <thead class="thread-inverse">
+ <tr>
+ <th width="700">Questions</th>
+ <th>Created by</th>
+ <th>Replies</th>
+ <th>Last reply</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for post in posts %}
+ <tr>
+ <td>
+ <a href="{% url 'yaksh:post_comments' course.id post.uid %}">{{post.title}}</a>
+ <small class="text-muted d-block">{{ post.description|truncatewords:30 }}</small>
+ <small class="text-muted"><strong>Last updated: {{post.modified_at}}</strong></small>
+ </td>
+ <td>{{post.creator.username}}</td>
+ <td>{{post.get_comments_count}}</td>
+ <td>
+ {% with post.get_last_comment as last_comment %}
+ {% if last_comment %}
+ {{last_comment.creator}}
+ {% else %}
+ None
+ {% endif %}
+ {% endwith %}
+ </td>
+ <td>
+ {% if user.profile.is_moderator %}
+ <small><a href="{% url 'yaksh:hide_post' course.id post.uid %}" class="pull-right btn btn-danger">Delete</i></a></small>
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% else %}
+ No discussion posts are there yet. Create one to start discussing.
+ {% endif %}
+ {% include "yaksh/paginator.html" %}
+ </div>
+{% endblock content %}
+{% block script %}
+ <script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"></script>
+ <script type="text/javascript" src="{% static 'yaksh/js/jquery.tablesorter.min.js' %}"></script>
+ <script type="text/javascript">
+ $(document).ready(() => {
+ $("#posts_table").tablesorter();
+ });
+ </script>
+{% endblock script %} \ No newline at end of file
diff --git a/yaksh/templates/yaksh/course_modules.html b/yaksh/templates/yaksh/course_modules.html
index dd7b68d..b808562 100644
--- a/yaksh/templates/yaksh/course_modules.html
+++ b/yaksh/templates/yaksh/course_modules.html
@@ -7,6 +7,7 @@
<div class="card">
<div class="card-header">
{{ course.name }}
+ <a href="{% url "yaksh:course_forum" course.id %}" class="btn btn-info pull-right">Discussion Forum</a>
</div>
<div class="card-body">
{% if course.view_grade %}
diff --git a/yaksh/templates/yaksh/post_comments.html b/yaksh/templates/yaksh/post_comments.html
new file mode 100644
index 0000000..463103e
--- /dev/null
+++ b/yaksh/templates/yaksh/post_comments.html
@@ -0,0 +1,71 @@
+{% extends base_template %}
+{% load static %}
+{% block title %}
+ {{post.title}}
+{% endblock title %}
+
+{% block content %}
+ <div class="container">
+ <a class="btn btn-primary" href="{% url 'yaksh:course_forum' post.course.id %}">Back to Posts</a>
+ <br>
+ <br>
+ <div class="card mb-2 border-dark">
+ <div class="card-header text-white bg-dark py-2 px-3">
+ {{post.title}}
+ <br>
+ <small>
+ <strong>{{post.creator.username}}</strong>
+ {{post.created_at}}
+ {% if user.profile.is_moderator %}<a href="{% url 'yaksh:hide_post' post.course.id post.uid %}" class="pull-right btn btn-danger">Delete</a>{% endif %}
+ </small>
+
+ </div>
+ <div class="card-body">
+ <p class="card-text description">{{post.description}}</p>
+ {% if post.image %}
+ <a href="{{post.image.url}}" target="_blank">
+ <center><img src="{{post.image.url}}" class="post_image thumbnail" alt=""></center>
+ </a>
+ {% endif %}
+ </div>
+ </div>
+ <br>
+ {% if comments %}
+ {% for comment in comments %}
+ <div class="card mb-2">
+ <div class="card-body p-3">
+ <div class="row mb-3">
+ <div class="col-6">
+ <strong class="text-muted">{{comment.creator.username}}</strong>
+ </div>
+ <div class="col-6 text-right">
+ <small class="text-muted">{{comment.created_at}} {% if user.profile.is_moderator %} <a href="{% url 'yaksh:hide_comment' post.course.id comment.uid %}" class="btn btn-danger">Delete</a>{% endif %}</small>
+ </div>
+ </div>
+ <p class="card-text description">{{comment.description}}</p>
+ <div>
+ {% if comment.image %}
+ <a href="{{comment.image.url}}" target="_blank">
+ <center><img src="{{comment.image.url}}" class="comment_image thumbnail" alt=""></center>
+ </a>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ {% endfor %}
+ {% endif %}
+ <br>
+ <div>
+ <form action="{% url 'yaksh:post_comments' post.course.id post.uid %}" method="POST" enctype='multipart/form-data'>
+ <div class="form-group">
+ {% csrf_token %}
+ {{form}}
+ </div>
+ <input type="submit" value="Submit" class="btn btn-primary">
+ </form>
+ </div>
+ </div>
+{% endblock content %}
+{% block script %}
+ <script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"></script>
+{% endblock script %} \ No newline at end of file