From 2a9f81cb32acfd7a2efc18f58c4529b39ce4061b Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Sat, 11 Apr 2020 17:45:31 +0530 Subject: Discussion forum for a course --- yaksh/templates/yaksh/course_forum.html | 68 ++++++++++++++++++++++++++++++ yaksh/templates/yaksh/course_modules.html | 1 + yaksh/templates/yaksh/thread_comments.html | 46 ++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 yaksh/templates/yaksh/course_forum.html create mode 100644 yaksh/templates/yaksh/thread_comments.html (limited to 'yaksh/templates') 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 %} +
+
+

{{course.name}}

+
Discussion Forum
+
+
+ +
+ + +
+
+
+

Threads:

+ {% if threads %} + {% for thread in threads %} +
+
+ {{thread.title}} +

{{thread.get_comments_count}}{% if thread.get_comments_count > 1 %} replies{% else %} reply{% endif %}

+
+ +
+
+ {% endfor %} + {% else %} + No discussion threads are there yet. Create one to start discussing. + {% endif %} +
+
+{% 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 @@
{{ course.name }} + Discussion Forum
{% 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 %} +
+ Back to Threads +
+
+ {{thread.title}} +
+ {{thread.creator.username}} {{thread.created_at}} +
+
+

{{thread.description}}

+
+
+
+
+ {% if comments %} +
Comments:
+ {% for comment in comments %} +
+

{{comment.body}}

+ by: {{comment.user.username}} . {{comment.created_at}} +
+
+ {% endfor %} + {% else %} + No comments on this thread. + {% endif %} +
+
+
+
+
+ {% csrf_token %} + +
+ +
+
+
+{% endblock content %} \ No newline at end of file -- cgit From 0e6c7d589114450d5cd1bc581ee1692c235f1a73 Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Mon, 13 Apr 2020 16:45:42 +0530 Subject: Add feature for uploading images --- yaksh/templates/yaksh/course_forum.html | 14 ++++++++------ yaksh/templates/yaksh/thread_comments.html | 11 ++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'yaksh/templates') diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html index b0c7024..4741ae0 100644 --- a/yaksh/templates/yaksh/course_forum.html +++ b/yaksh/templates/yaksh/course_forum.html @@ -23,13 +23,10 @@

-
+
{% csrf_token %} - + {{form}}
-- cgit From 2f9331717075b34534f2745706f57a98f7dce20d Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Mon, 13 Apr 2020 17:27:49 +0530 Subject: Add feature to hide thread or comments --- yaksh/templates/yaksh/course_forum.html | 4 +++- yaksh/templates/yaksh/thread_comments.html | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'yaksh/templates') diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html index 4741ae0..41dbd7b 100644 --- a/yaksh/templates/yaksh/course_forum.html +++ b/yaksh/templates/yaksh/course_forum.html @@ -57,7 +57,9 @@ {% with thread.get_last_comment as last_comment %} {% if thread.creator.profile.is_moderator %} INSTRUCTOR CREATED {% endif %} Last Post by: {{last_comment.creator}} . {{last_comment.modified_at|naturaltime}} {% endwith %} - Delete + {% if user.profile.is_moderator %} + Delete + {% endif %}

diff --git a/yaksh/templates/yaksh/thread_comments.html b/yaksh/templates/yaksh/thread_comments.html index ab0ade9..f614b7a 100644 --- a/yaksh/templates/yaksh/thread_comments.html +++ b/yaksh/templates/yaksh/thread_comments.html @@ -11,7 +11,12 @@
{{thread.title}}
- {{thread.creator.username}} {{thread.created_at}} + + {{thread.creator.username}} + {{thread.created_at}} + {% if user.profile.is_moderator %}Delete{% endif %} + +

{{thread.description}}

@@ -29,7 +34,10 @@ {% endif %}

{{comment.description}}

- by: {{comment.user.username}} . {{comment.created_at}} + + by: {{comment.creator.username}} . {{comment.created_at}} + {% if user.profile.is_moderator %}Delete{% endif %} +

{% endfor %} -- cgit From 508e0e78bb0bd3e8ebbad81e948f13de5c01b20f Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Tue, 14 Apr 2020 20:13:52 +0530 Subject: Change model name Thread to Post to avoid conflicts - Thread class from threading conflicts with the forum Thread model. - Tests for models and views. - PEP8 fix. --- yaksh/templates/yaksh/course_forum.html | 32 +++++++-------- yaksh/templates/yaksh/post_comments.html | 62 ++++++++++++++++++++++++++++++ yaksh/templates/yaksh/thread_comments.html | 59 ---------------------------- 3 files changed, 79 insertions(+), 74 deletions(-) create mode 100644 yaksh/templates/yaksh/post_comments.html delete mode 100644 yaksh/templates/yaksh/thread_comments.html (limited to 'yaksh/templates') diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html index 41dbd7b..407296f 100644 --- a/yaksh/templates/yaksh/course_forum.html +++ b/yaksh/templates/yaksh/course_forum.html @@ -10,16 +10,16 @@
Discussion Forum
- +
-