summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCruiseDevice2020-04-15 22:15:53 +0530
committerCruiseDevice2020-04-15 22:15:53 +0530
commiteb9f6cb240268735e08ebc2a6d26d88c7e5097f7 (patch)
treead5eddc0fbdbd73c6b520edf1da3baabd960f30c
parent169228186d8c9ad880ee33c5190e49203d2c5243 (diff)
downloadonline_test-eb9f6cb240268735e08ebc2a6d26d88c7e5097f7.tar.gz
online_test-eb9f6cb240268735e08ebc2a6d26d88c7e5097f7.tar.bz2
online_test-eb9f6cb240268735e08ebc2a6d26d88c7e5097f7.zip
Improve UI slightly
-rw-r--r--yaksh/static/yaksh/css/custom.css12
-rw-r--r--yaksh/templates/yaksh/course_forum.html4
-rw-r--r--yaksh/templates/yaksh/post_comments.html6
-rw-r--r--yaksh/views.py4
4 files changed, 20 insertions, 6 deletions
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index 63ee455..299f5d3 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -97,3 +97,15 @@ body, .dropdown-menu {
min-height: 100vh;
transition: all 0.3s;
}
+
+/* ---------------------------------------------------
+ FORUM STYLE
+----------------------------------------------------- */
+
+.brown-light {
+ background: #f4a460;
+ padding-left: 0.3em;
+ padding-right: 0.3em;
+ padding-top: 0.2em;
+ padding-bottom: 0.2em;
+} \ No newline at end of file
diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html
index 3e4d07b..ef6dbf8 100644
--- a/yaksh/templates/yaksh/course_forum.html
+++ b/yaksh/templates/yaksh/course_forum.html
@@ -52,9 +52,7 @@
</div>
<div class="card-footer">
{% with post.get_last_comment as last_comment %}
- {% if last_comment %}
- <small> {% if post.creator.profile.is_moderator %} INSTRUCTOR CREATED {% endif %} Last Post by: <strong>{{last_comment.creator}}</strong> . {{last_comment.modified_at|naturaltime}}</small>
- {% endif %}
+ <small> {% if post.creator.profile.is_moderator %} <span class="brown-light">INSTRUCTOR</span> {% endif %} {% if last_comment %} Last Post by: <strong>{{last_comment.creator}}</strong> . {{last_comment.modified_at|naturaltime}} {% else %} Created By <strong>{{post.creator.username}}</strong> {% endif %}</small>
{% endwith %}
{% if user.profile.is_moderator %}
<small><a href="{% url "yaksh:hide_post" course.id post.uid %}" class="pull-right">Delete</i></a></small>
diff --git a/yaksh/templates/yaksh/post_comments.html b/yaksh/templates/yaksh/post_comments.html
index f5cc771..110e11c 100644
--- a/yaksh/templates/yaksh/post_comments.html
+++ b/yaksh/templates/yaksh/post_comments.html
@@ -1,5 +1,5 @@
{% extends "user.html" %}
-
+{% load humanize %}
{% block title %}
{{post.title}}
{% endblock title %}
@@ -13,7 +13,7 @@
<br>
<small>
<strong>{{post.creator.username}}</strong>
- {{post.created_at}}
+ {{post.created_at|naturaltime}}
{% if user.profile.is_moderator %}<a href="{% url "yaksh:hide_post" post.course.id post.uid %}" class="pull-right">Delete</a>{% endif %}
</small>
@@ -40,7 +40,7 @@
{% endif %}
<p>{{comment.description}}</p>
<small class="pull-right">
- by: <strong>{{comment.creator.username}} </strong>. {{comment.created_at}}
+ by: <strong>{{comment.creator.username}} </strong>. {{comment.created_at|naturaltime}}
{% if user.profile.is_moderator %}<a href="{% url "yaksh:hide_comment" post.course.id comment.uid %}">Delete</a>{% endif %}
</small>
</div>
diff --git a/yaksh/views.py b/yaksh/views.py
index c154d4e..01d5f48 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -3252,6 +3252,7 @@ def post_comments(request, course_id, uuid):
@login_required
@email_verified
def hide_post(request, course_id, uuid):
+ user = request.user
course = get_object_or_404(Course, id=course_id)
if (not course.is_creator(user) and not course.is_teacher(user)
and not course.is_student(user)):
@@ -3263,7 +3264,10 @@ def hide_post(request, course_id, uuid):
return redirect('yaksh:course_forum', course_id)
+@login_required
+@email_verified
def hide_comment(request, course_id, uuid):
+ user = request.user
course = get_object_or_404(Course, id=course_id)
if (not course.is_creator(user) and not course.is_teacher(user)
and not course.is_student(user)):