summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-05-18 10:20:13 +0530
committerGitHub2020-05-18 10:20:13 +0530
commit2db15ac584ae991cd052fa0eed68194594f91775 (patch)
tree6bfc1181ccdb22d53ec957acc463aac05279fc22 /yaksh/templates
parenta72bd55bb9ba72b42ffd41b16c999321421e3224 (diff)
parentbfd33c397d30c60cde16d5073382bdae94d475cd (diff)
downloadonline_test-2db15ac584ae991cd052fa0eed68194594f91775.tar.gz
online_test-2db15ac584ae991cd052fa0eed68194594f91775.tar.bz2
online_test-2db15ac584ae991cd052fa0eed68194594f91775.zip
Merge pull request #695 from adityacp/fix_forum
Fix pagination for forum post search
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/yaksh/course_forum.html52
-rw-r--r--yaksh/templates/yaksh/paginator.html6
-rw-r--r--yaksh/templates/yaksh/post_comments.html7
3 files changed, 44 insertions, 21 deletions
diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html
index e6b6a90..4724981 100644
--- a/yaksh/templates/yaksh/course_forum.html
+++ b/yaksh/templates/yaksh/course_forum.html
@@ -12,23 +12,19 @@
<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>
+ <a href="{% url 'yaksh:course_detail' course.id %}" class="btn btn-primary">
+ <i class="fa fa-arrow-left"></i>&nbsp;Back
+ </a>
{% else %}
- <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary">Back to Course</a>
+ <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary">
+ <i class="fa fa-arrow-left"></i>&nbsp;Back
+ </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 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>&nbsp;New Post
+ </button>
</div>
</div>
<!-- Modal -->
@@ -58,12 +54,34 @@
</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>&nbsp;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>&nbsp;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">Questions</th>
+ <th width="700">Posts</th>
<th>Created by</th>
<th>Replies</th>
<th>Last reply</th>
@@ -98,10 +116,12 @@
{% endfor %}
</tbody>
</table>
+ <br>
+ {% include "yaksh/paginator.html" %}
{% else %}
No discussion posts are there yet. Create one to start discussing.
{% endif %}
- {% include "yaksh/paginator.html" %}
+ {% endwith %}
</div>
{% endblock content %}
{% block script %}
diff --git a/yaksh/templates/yaksh/paginator.html b/yaksh/templates/yaksh/paginator.html
index e958519..e18cbce 100644
--- a/yaksh/templates/yaksh/paginator.html
+++ b/yaksh/templates/yaksh/paginator.html
@@ -2,7 +2,7 @@
{% if objects.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1{% if request.GET.question_type %}&question_type={{ request.GET.question_type }}{% endif %}{% if request.GET.language %}&language={{ request.GET.language }}{% endif %}{% if request.GET.marks %}&marks={{ request.GET.marks }}{% endif %}{% if request.GET.question_tags %}&question_tags={{ request.GET.question_tags }}{% endif %}
- {% if request.GET.search_tags %}&search_tags={{ request.GET.search_tags }}{% endif %}{% if request.GET.search_status %}&search_status={{ request.GET.search_status }}{% endif %}" aria-label="Previous">
+ {% if request.GET.search_tags %}&search_tags={{ request.GET.search_tags }}{% endif %}{% if request.GET.search_status %}&search_status={{ request.GET.search_status }}{% endif %}{% if request.GET.search_post %}&search_post={{ request.GET.search_post }}{% endif %}" aria-label="Previous">
<span aria-hidden="true">
<i class="fa fa-angle-double-left"></i>
</span>
@@ -17,13 +17,13 @@
<span class="page-link">{{ n }}<span class="sr-only">(current)</span></span>
</li>
{% elif n > objects.number|add:'-5' and n < objects.number|add:'5' %}
- <li class="page-item"><a class="page-link" href="?page={{ n }}{% if request.GET.question_type %}&question_type={{ request.GET.question_type }}{% endif %}{% if request.GET.language %}&language={{ request.GET.language }}{% endif %}{% if request.GET.marks %}&marks={{ request.GET.marks }}{% endif %}{% if request.GET.question_tags %}&question_tags={{ request.GET.question_tags }}{% endif %}{% if request.GET.search_tags %}&search_tags={{ request.GET.search_tags }}{% endif %}{% if request.GET.search_status %}&search_status={{ request.GET.search_status }}{% endif %}">{{ n }}</a></li>
+ <li class="page-item"><a class="page-link" href="?page={{ n }}{% if request.GET.question_type %}&question_type={{ request.GET.question_type }}{% endif %}{% if request.GET.language %}&language={{ request.GET.language }}{% endif %}{% if request.GET.marks %}&marks={{ request.GET.marks }}{% endif %}{% if request.GET.question_tags %}&question_tags={{ request.GET.question_tags }}{% endif %}{% if request.GET.search_tags %}&search_tags={{ request.GET.search_tags }}{% endif %}{% if request.GET.search_status %}&search_status={{ request.GET.search_status }}{% endif %}{% if request.GET.search_post %}&search_post={{ request.GET.search_post }}{% endif %}">{{ n }}</a></li>
{% endif %}
{% endfor %}
{% if objects.has_next %}
<li class="page-item">
- <a class="page-link" href="?page={{ objects.paginator.num_pages }}{% if request.GET.question_type %}&question_type={{ request.GET.question_type }}{% endif %}{% if request.GET.language %}&language={{ request.GET.language }}{% endif %}{% if request.GET.marks %}&marks={{ request.GET.marks }}{% endif %}{% if request.GET.question_tags %}&question_tags={{ request.GET.question_tags }}{% endif %}{% if request.GET.search_tags %}&search_tags={{ request.GET.search_tags }}{% endif %}{% if request.GET.search_status %}&search_status={{ request.GET.search_status }}{% endif %}" aria-label="Next">
+ <a class="page-link" href="?page={{ objects.paginator.num_pages }}{% if request.GET.question_type %}&question_type={{ request.GET.question_type }}{% endif %}{% if request.GET.language %}&language={{ request.GET.language }}{% endif %}{% if request.GET.marks %}&marks={{ request.GET.marks }}{% endif %}{% if request.GET.question_tags %}&question_tags={{ request.GET.question_tags }}{% endif %}{% if request.GET.search_tags %}&search_tags={{ request.GET.search_tags }}{% endif %}{% if request.GET.search_status %}&search_status={{ request.GET.search_status }}{% endif %}{% if request.GET.search_post %}&search_post={{ request.GET.search_post }}{% endif %}" aria-label="Next">
<span aria-hidden="true">
<i class="fa fa-angle-double-right"></i>
</span>
diff --git a/yaksh/templates/yaksh/post_comments.html b/yaksh/templates/yaksh/post_comments.html
index 463103e..b16b80c 100644
--- a/yaksh/templates/yaksh/post_comments.html
+++ b/yaksh/templates/yaksh/post_comments.html
@@ -6,7 +6,9 @@
{% block content %}
<div class="container">
- <a class="btn btn-primary" href="{% url 'yaksh:course_forum' post.course.id %}">Back to Posts</a>
+ <a class="btn btn-primary" href="{% url 'yaksh:course_forum' post.course.id %}">
+ <i class="fa fa-arrow-left"></i>&nbsp;Back to Posts
+ </a>
<br>
<br>
<div class="card mb-2 border-dark">
@@ -56,12 +58,13 @@
{% endif %}
<br>
<div>
+ <b><u>Add comment:</u></b>
<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">
+ <input type="submit" value="Submit" class="btn btn-success">
</form>
</div>
</div>