diff options
author | CruiseDevice | 2020-04-11 17:45:31 +0530 |
---|---|---|
committer | CruiseDevice | 2020-04-11 17:45:31 +0530 |
commit | 2a9f81cb32acfd7a2efc18f58c4529b39ce4061b (patch) | |
tree | 4bf11c11a597101a99f09784517ca54923a63407 /yaksh/templates | |
parent | 4802a89acef7567c6a8861daab60924fe862367f (diff) | |
download | online_test-2a9f81cb32acfd7a2efc18f58c4529b39ce4061b.tar.gz online_test-2a9f81cb32acfd7a2efc18f58c4529b39ce4061b.tar.bz2 online_test-2a9f81cb32acfd7a2efc18f58c4529b39ce4061b.zip |
Discussion forum for a course
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/course_forum.html | 68 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_modules.html | 1 | ||||
-rw-r--r-- | yaksh/templates/yaksh/thread_comments.html | 46 |
3 files changed, 115 insertions, 0 deletions
diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html new file mode 100644 index 0000000..b0c7024 --- /dev/null +++ b/yaksh/templates/yaksh/course_forum.html @@ -0,0 +1,68 @@ +{% extends "user.html" %} +{% load humanize %} +{% 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="pull-right"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newThreadModal">New Thread</button> + </div> + <!-- Modal --> + <div id="newThreadModal" 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 thread</h4> + <button type="button" class="close" data-dismiss="modal">×</button> + </div> + <div class="modal-body"> + <form action="." method="POST"> + <div class="form-group"> + {% csrf_token %} + <label>Title: </label> + <input name='title' type="text" class="form-control" required> + <label>Description: </label> + <textarea class="form-control" name="description" id="" cols="45" rows="3" required></textarea> + </div> + <input type="submit" class="btn btn-primary" value="Create Thread"> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + </div> + </div> + + </div> + </div> + <br> + <br> + <div> + <h3>Threads:</h3> + {% if threads %} + {% for thread in threads %} + <div class="card"> + <div class="card-body"> + <a href="{% url "yaksh:thread_comments" course.id thread.uid %}">{{thread.title}}</a> + <p class="pull-right"><small>{{thread.get_comments_count}}{% if thread.get_comments_count > 1 %} replies{% else %} reply{% endif %}</small></p> + </div> + <div class="card-footer"> + {% with thread.get_last_comment as last_comment %} + <small> {% if thread.creator.profile.is_moderator %} INSTRUCTOR CREATED {% endif %} Last Post by: <strong>{{last_comment.user}}</strong> . {{last_comment.modified_at|naturaltime}}</small> + {% endwith %} + </div> + </div> + <br> + {% endfor %} + {% else %} + No discussion threads are there yet. Create one to start discussing. + {% endif %} + </div> + </div> +{% endblock content %}
\ 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/thread_comments.html b/yaksh/templates/yaksh/thread_comments.html new file mode 100644 index 0000000..245c363 --- /dev/null +++ b/yaksh/templates/yaksh/thread_comments.html @@ -0,0 +1,46 @@ +{% extends "user.html" %} + +{% block title %} + {{thread.title}} +{% endblock title %} + +{% block content %} + <div class="container"> + <a class="btn btn-primary" href="{% url "yaksh:course_forum" thread.course.id %}">Back to Threads</a> + <div class="card"> + <div class="card-header"> + {{thread.title}} + <br> + <small><strong>{{thread.creator.username}}</strong> {{thread.created_at}}</small> + </div> + <div class="card-body"> + <p>{{thread.description}}</p> + </div> + </div> + <br> + <div class="card"> + {% if comments %} + <div class="card-header">Comments:</div> + {% for comment in comments %} + <div class="card-body"> + <p>{{comment.body}}</p> + <small class="pull-right">by: <strong>{{comment.user.username}} </strong>. {{comment.created_at}}</small> + </div> + <hr> + {% endfor %} + {% else %} + No comments on this thread. + {% endif %} + </div> + <br> + <div> + <form action="{% url "yaksh:thread_comments" thread.course.id thread.uid %}" method="POST"> + <div class="form-group"> + {% csrf_token %} + <textarea class="form-control" name="comment" id="" cols="55" rows="5" required></textarea> + </div> + <input type="submit" value="Submit" class="btn btn-primary"> + </form> + </div> + </div> +{% endblock content %}
\ No newline at end of file |