diff options
author | CruiseDevice | 2020-09-16 07:23:36 +0530 |
---|---|---|
committer | ankitjavalkar | 2020-10-08 10:42:50 +0530 |
commit | 5e49406420207123afec88a1ca7138e7a58c2acc (patch) | |
tree | 9680cf23a1aa28f8947ca66f270c4bd48e288bbe /yaksh/templates | |
parent | 05ecae144ba161ee88ae98ff4313c9e5480bb604 (diff) | |
download | online_test-5e49406420207123afec88a1ca7138e7a58c2acc.tar.gz online_test-5e49406420207123afec88a1ca7138e7a58c2acc.tar.bz2 online_test-5e49406420207123afec88a1ca7138e7a58c2acc.zip |
Show Lesson post and comments in discussion forum
- Use trash icon instead of DELETE button
- Sidebar to navigate between course forum and lesson forum
- Course forum displays all the questions (posts) linked with the
course model, and Lesson forum displays all the questions (posts)
linked with the Lesson model.
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/course_forum.html | 224 | ||||
-rw-r--r-- | yaksh/templates/yaksh/lessons_forum.html | 70 | ||||
-rw-r--r-- | yaksh/templates/yaksh/post_comments.html | 6 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_video.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/sidebar.html | 8 |
5 files changed, 195 insertions, 115 deletions
diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html index 4724981..a9bda6f 100644 --- a/yaksh/templates/yaksh/course_forum.html +++ b/yaksh/templates/yaksh/course_forum.html @@ -4,124 +4,126 @@ {{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"> - <i class="fa fa-arrow-left"></i> Back - </a> - {% else %} - <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary"> - <i class="fa fa-arrow-left"></i> Back - </a> - {% endif %} + <div id="wrapper" class="d-flex"> + {% include "yaksh/sidebar.html" %} + <div class="container" id="page-content-wrapper"> + <div> + <h2><center>{{course.name}}</center></h2> + <center>Discussion Forum</center> </div> - <div class="col-md"> - <button type="button" class="btn btn-success pull-right" data-toggle="modal" data-target="#newPostModal"> - <i class="fa fa-plus-circle"></i> New Post - </button> + <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"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% else %} + <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% endif %} + </div> + <div class="col-md"> + <button type="button" class="btn btn-success pull-right" data-toggle="modal" data-target="#newPostModal"> + <i class="fa fa-plus-circle"></i> New Post + </button> + </div> </div> - </div> - <!-- Modal --> - <div id="newPostModal" class="modal fade" role="dialog"> - <div class="modal-dialog"> + <!-- 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">×</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> + <!-- 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">×</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> - - </div> - </div> - <br> - <div class="row justify-content-center"> - <div class="col-md-6"> - <form class="my-2 my-lg-0" action="" method="GET"> - <div class="input-group"> - <input type="search" placeholder="Search Post" name="search_post" class="form-control"> - <span class="input-group-append"> - <button class="btn btn-outline-info"> - <i class="fa fa-search"></i> Search - </button> - </span> - </div> - </form> - </div> - <div class="col-md-4"> - <a class="btn btn-outline-danger" href="{% url 'yaksh:course_forum' course.id %}"> - <i class="fa fa-times"></i> Clear Search - </a> - </div> - </div> - <br> - {% with objects as posts %} - {% if posts %} - {% include "yaksh/paginator.html" %} <br> - <table id="posts_table" class="tablesorter table"> - <thead class="thread-inverse"> - <tr> - <th width="700">Posts</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> + <div class="row justify-content-center"> + <div class="col-md-6"> + <form class="my-2 my-lg-0" action="" method="GET"> + <div class="input-group"> + <input type="search" placeholder="Search Post" name="search_post" class="form-control"> + <span class="input-group-append"> + <button class="btn btn-outline-info"> + <i class="fa fa-search"></i> Search + </button> + </span> + </div> + </form> + </div> + <div class="col-md-4"> + <a class="btn btn-outline-danger" href="{% url 'yaksh:course_forum' course.id %}"> + <i class="fa fa-times"></i> Clear Search + </a> + </div> + </div> <br> - {% include "yaksh/paginator.html" %} - {% else %} - No discussion posts are there yet. Create one to start discussing. - {% endif %} - {% endwith %} + {% with objects as posts %} + {% if posts %} + {% include "yaksh/paginator.html" %} + <br> + <table id="posts_table" class="tablesorter table"> + <thead class="thread-inverse"> + <tr> + <th width="700">Posts</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 fa fa-trash"></i></a></small> + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + <br> + {% include "yaksh/paginator.html" %} + {% else %} + No discussion posts are there yet. Create one to start discussing. + {% endif %} + {% endwith %} + </div> </div> {% endblock content %} {% block script %} diff --git a/yaksh/templates/yaksh/lessons_forum.html b/yaksh/templates/yaksh/lessons_forum.html new file mode 100644 index 0000000..a4fd23b --- /dev/null +++ b/yaksh/templates/yaksh/lessons_forum.html @@ -0,0 +1,70 @@ +{% extends base_template %} +{% load static %} +{% block title %} + {{course.name}}: Lessons Forum +{% endblock title %} +{% block content %} + <div id="wrapper" class="d-flex"> + {% include "yaksh/sidebar.html" %} + <div class="container" id="page-content-wrapper"> + <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"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% else %} + <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% endif %} + </div> + </div> + {% if posts %} + <table class="table"> + <thead class="thread-inverse"> + <tr> + <th width="700">Posts</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 fa fa-trash"></i></a></small> + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + {% endif %} + </div> + </div> +{% endblock content %} + diff --git a/yaksh/templates/yaksh/post_comments.html b/yaksh/templates/yaksh/post_comments.html index f0f1593..6051b6e 100644 --- a/yaksh/templates/yaksh/post_comments.html +++ b/yaksh/templates/yaksh/post_comments.html @@ -6,7 +6,7 @@ {% block content %} <div class="container"> - <a class="btn btn-primary" href="{% url 'yaksh:course_forum' post.target.id %}"> + <a class="btn btn-primary" href="{% url 'yaksh:course_forum' course.id %}"> <i class="fa fa-arrow-left"></i> Back to Posts </a> <br> @@ -18,7 +18,7 @@ <small> <strong>{{post.creator.username}}</strong> {{post.created_at}} - {% if user.profile.is_moderator %}<a href="{% url 'yaksh:hide_post' post.target.id post.uid %}" class="pull-right btn btn-danger">Delete</a>{% endif %} + {% if user.profile.is_moderator %}<a href="{% url 'yaksh:hide_post' post.target.id post.uid %}" class="pull-right fa fa-trash"></a>{% endif %} </small> </div> @@ -41,7 +41,7 @@ <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.target.id comment.uid %}" class="btn btn-danger">Delete</a>{% endif %}</small> + <small class="text-muted">{{comment.created_at}} {% if user.profile.is_moderator %} <a href="{% url 'yaksh:hide_comment' post.target.id comment.uid %}" class="fa fa-trash"></a>{% endif %}</small> </div> </div> <p class="card-text description">{{comment.description}}</p> diff --git a/yaksh/templates/yaksh/show_video.html b/yaksh/templates/yaksh/show_video.html index 76a48d4..ef6f459 100644 --- a/yaksh/templates/yaksh/show_video.html +++ b/yaksh/templates/yaksh/show_video.html @@ -236,7 +236,7 @@ <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' course.id comment.uid %}" class="btn btn-danger">Delete</a>{% endif %}</small> + <small class="text-muted">{{comment.created_at}} {% if user.profile.is_moderator %} <a href="{% url 'yaksh:hide_comment' course.id comment.uid %}" class="fa fa-trash"></a>{% endif %}</small> </div> </div> <p class="card-text description">{{comment.description}}</p> diff --git a/yaksh/templates/yaksh/sidebar.html b/yaksh/templates/yaksh/sidebar.html new file mode 100644 index 0000000..7d0ac74 --- /dev/null +++ b/yaksh/templates/yaksh/sidebar.html @@ -0,0 +1,8 @@ +<!-- Sidebar --> +<div class="bg-light border-right" id="sidebar-wrapper"> + <div class="list-group list-group-flush"> + <a href="{% url 'yaksh:course_forum' course.id %}" class="list-group-item list-group-item-action {% if '/course_forum/' in request.path %}active{% endif %}">Course Forum</a> + <a href="{% url 'yaksh:lessons_forum' course.id %}" class="list-group-item list-group-item-action {% if '/lessons_forum/' in request.path %}active{% endif %}">Lessons Forum</a> + </div> +</div> +<!-- /#sidebar-wrapper --> |