From a49563e23fbc0047e8d68254f81ae404f55f1bd7 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Mon, 30 Aug 2021 18:39:00 +0530 Subject: [PATCH] fix: discussions template --- .../discussion_topic/discussion_topic.py | 4 +++ .../web_template/discussions/discussions.html | 3 +- .../community/widgets/DiscussionMessage.html | 32 ++++++++++++++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/community/community/doctype/discussion_topic/discussion_topic.py b/community/community/doctype/discussion_topic/discussion_topic.py index a340f837..4ab8558f 100644 --- a/community/community/doctype/discussion_topic/discussion_topic.py +++ b/community/community/doctype/discussion_topic/discussion_topic.py @@ -29,3 +29,7 @@ def save_message(reply, topic): "reply": reply, "topic": topic }).save(ignore_permissions=True) + +@frappe.whitelist() +def get_docname(route): + return frappe.db.get_value("Web Page", {"route": route}, ["name"]) diff --git a/community/community/web_template/discussions/discussions.html b/community/community/web_template/discussions/discussions.html index c738992d..4e4fd0bc 100644 --- a/community/community/web_template/discussions/discussions.html +++ b/community/community/web_template/discussions/discussions.html @@ -1 +1,2 @@ -{{ widgets.DiscussionMessage }} +{% set docname = frappe.db.get_value("Web Page", {"route": ""}, ["name"])%} +{{ widgets.DiscussionMessage(doctype="Web Page", docname=docname) }} diff --git a/community/community/widgets/DiscussionMessage.html b/community/community/widgets/DiscussionMessage.html index d2cc0f85..f36936c0 100644 --- a/community/community/widgets/DiscussionMessage.html +++ b/community/community/widgets/DiscussionMessage.html @@ -23,12 +23,16 @@ {% endfor %} {% endfor %} + {% if not topics %} +

No discussions yet.

+ {% endif %} -