diff --git a/frappe/templates/discussions/button.html b/frappe/templates/discussions/button.html index b93ff86a47..597fb1476d 100644 --- a/frappe/templates/discussions/button.html +++ b/frappe/templates/discussions/button.html @@ -1,7 +1,7 @@ {% if frappe.session.user != "Guest" and (condition is not defined or (condition is defined and condition )) %} - {{ cta_title }} - + {{ _(cta_title) }} + {% endif %} diff --git a/frappe/templates/discussions/comment_box.html b/frappe/templates/discussions/comment_box.html index f172e24a9c..cbdc3ad3e5 100644 --- a/frappe/templates/discussions/comment_box.html +++ b/frappe/templates/discussions/comment_box.html @@ -4,7 +4,7 @@
+ data-fieldname="feedback_comments" placeholder="{{ _('Type title') }}" spellcheck="false">
@@ -13,7 +13,7 @@
@@ -21,12 +21,12 @@ diff --git a/frappe/templates/discussions/discussions.js b/frappe/templates/discussions/discussions.js index 36587a0d61..becc50410d 100644 --- a/frappe/templates/discussions/discussions.js +++ b/frappe/templates/discussions/discussions.js @@ -62,14 +62,14 @@ frappe.ready(() => { }); -var show_new_topic_modal = (e) => { +const show_new_topic_modal = (e) => { e.preventDefault(); $("#discussion-modal").modal("show"); - var topic = $(e.currentTarget).attr("data-topic"); + let topic = $(e.currentTarget).attr("data-topic"); $("#submit-discussion").attr("data-topic", topic ? topic : ""); }; -var setup_socket_io = () => { +const setup_socket_io = () => { const assets = [ "/assets/frappe/js/lib/socket.io.min.js", "/assets/frappe/js/frappe/socketio_client.js" @@ -86,7 +86,7 @@ var setup_socket_io = () => { }); }; -var publish_message = (data) => { +const publish_message = (data) => { if ($(`.discussion-on-page[data-topic=${data.topic_info.name}]`).length) { post_message_cleanup(); @@ -112,7 +112,7 @@ var publish_message = (data) => { update_reply_count(data.topic_info.name); }; -var post_message_cleanup = () => { +const post_message_cleanup = () => { $(".topic-title").val(""); $(".comment-field").val(""); $(".discussion-on-page .comment-field").css("height", "48px"); @@ -121,13 +121,13 @@ var post_message_cleanup = () => { $(".cancel-comment").addClass("hide"); }; -var update_reply_count = (topic) => { - var reply_count = $(`[data-target='#t${topic}']`).find(".reply-count").text(); +const update_reply_count = (topic) => { + let reply_count = $(`[data-target='#t${topic}']`).find(".reply-count").text(); reply_count = parseInt(reply_count) + 1; $(`[data-target='#t${topic}']`).find(".reply-count").text(reply_count); }; -var expand_first_discussion = () => { +const expand_first_discussion = () => { if ($(document).width() > 550) { $($(".discussions-parent .collapse")[0]).addClass("show"); $($(".discussions-sidebar [data-toggle='collapse']")[0]).attr("aria-expanded", true); @@ -136,22 +136,22 @@ var expand_first_discussion = () => { } }; -var search_topic = (e) => { - var input = $(e.currentTarget).val(); +const search_topic = (e) => { + let input = $(e.currentTarget).val(); - var topics = $(".discussions-parent .discussion-topic-title"); + let topics = $(".discussions-parent .discussion-topic-title"); if (input.length < 3 || input.trim() == "") { topics.closest(".sidebar-parent").removeClass("hide"); return; } topics.each((i, elem) => { - var topic_id = $(elem).parent().attr("data-target"); + let topic_id = $(elem).parent().attr("data-target"); /* Check match in replies */ - var match_in_reply = false; - var replies = $(`${topic_id}`); - for (var reply of replies.find(".reply-text")) { + let match_in_reply = false; + const replies = $(`${topic_id}`); + for (const reply of replies.find(".reply-text")) { if (has_common_substring($(reply).text(), input)) { match_in_reply = true; break; @@ -167,13 +167,13 @@ var search_topic = (e) => { }); }; -var has_common_substring = (str1, str2) => { - var str1_arr = str1.toLowerCase().split(" "); - var str2_arr = str2.toLowerCase().split(" "); +const has_common_substring = (str1, str2) => { + const str1_arr = str1.toLowerCase().split(" "); + const str2_arr = str2.toLowerCase().split(" "); - var substring_found = false; - for (var first_word of str1_arr) { - for (var second_word of str2_arr) { + let substring_found = false; + for (const first_word of str1_arr) { + for (const second_word of str2_arr) { if (first_word.indexOf(second_word) > -1) { substring_found = true; break; @@ -183,18 +183,18 @@ var has_common_substring = (str1, str2) => { return substring_found; }; -var submit_discussion = (e) => { +const submit_discussion = (e) => { e.preventDefault(); e.stopImmediatePropagation(); - var title = $(".topic-title:visible").length ? $(".topic-title:visible").val().trim() : ""; - var reply = $(".comment-field:visible").val().trim(); + const title = $(".topic-title:visible").length ? $(".topic-title:visible").val().trim() : ""; + const reply = $(".comment-field:visible").val().trim(); if (reply) { - var doctype = $(e.currentTarget).attr("data-doctype"); + let doctype = $(e.currentTarget).attr("data-doctype"); doctype = doctype ? decodeURIComponent(doctype) : doctype; - var docname = $(e.currentTarget).attr("data-docname"); + let docname = $(e.currentTarget).attr("data-docname"); docname = docname ? decodeURIComponent(docname) : docname; frappe.call({ @@ -210,14 +210,14 @@ var submit_discussion = (e) => { } }; -var login_from_discussion = (e) => { +const login_from_discussion = (e) => { e.preventDefault(); - var redirect = $(e.currentTarget).attr("data-redirect") || window.location.href; + const redirect = $(e.currentTarget).attr("data-redirect") || window.location.href; window.location.href = `/login?redirect-to=${redirect}`; }; -var add_color_to_avatars = () => { - var avatars = $(".avatar-frame"); +const add_color_to_avatars = () => { + const avatars = $(".avatar-frame"); avatars.each((i, avatar) => { if (!$(avatar).attr("style")) { $(avatar).css(get_color_from_palette($(avatar))); @@ -225,31 +225,29 @@ var add_color_to_avatars = () => { }); }; -var get_color_from_palette = (element) => { - var palette = frappe.get_palette(element.attr("title")); +const get_color_from_palette = (element) => { + const palette = frappe.get_palette(element.attr("title")); return {"background-color": `var(${palette[0]})`, "color": `var(${palette[1]})` }; }; -var style_avatar_frame = (template) => { - var $template = $(template); +const style_avatar_frame = (template) => { + const $template = $(template); $template.find(".avatar-frame").css(get_color_from_palette($template.find(".avatar-frame"))); return $template.prop("outerHTML"); }; -var clear_comment_box = () => { - if ($(".discussion-modal").hasClass("show")) { - $("#discussion-modal").modal("hide"); - } else { - $(".discussion-on-page .comment-field").val(""); - } +const clear_comment_box = () => { + $(".discussion-on-page .comment-field").val(""); + $(".cancel-comment").removeClass("show").addClass("hide"); + $(".discussion-on-page .comment-field").css("height", "48px"); }; -var hide_sidebar = () => { +const hide_sidebar = () => { $(".discussions-sidebar").addClass("hide"); $("#discussion-group").removeClass("hide"); }; -var back_to_sidebar = () => { +const back_to_sidebar = () => { $(".discussions-sidebar").removeClass("hide"); $("#discussion-group").addClass("hide"); $(".discussion-on-page").collapse("hide"); diff --git a/frappe/templates/discussions/discussions_section.html b/frappe/templates/discussions/discussions_section.html index 8c654c2f06..65e1730bc7 100644 --- a/frappe/templates/discussions/discussions_section.html +++ b/frappe/templates/discussions/discussions_section.html @@ -35,7 +35,7 @@
There are no {{ title | lower }} for this {{ doctype | lower }}, why don't you start one!
{% if frappe.session.user == "Guest" %} -
Log In
+
{{ _("Log In") }}
{% elif condition is defined and not condition %} {{ button_name }} diff --git a/frappe/templates/discussions/reply_section.html b/frappe/templates/discussions/reply_section.html index 23e070b5c1..e2f86da5f9 100644 --- a/frappe/templates/discussions/reply_section.html +++ b/frappe/templates/discussions/reply_section.html @@ -7,7 +7,7 @@ data-parent="#discussion-group">
- Back + {{ _("Back") }}
{{ topic.title }}
@@ -21,9 +21,9 @@ {% if frappe.session.user == "Guest" or (condition is defined and not condition) %}
- Want to join the discussion? + {{ _("Want to join the discussion?") }} {% if frappe.session.user == "Guest" %} -
Log In
+
{{ _("Log In") }}
{% elif not condition %}
{{ button_name }}
diff --git a/frappe/templates/styles/discussion_style.css b/frappe/templates/styles/discussion_style.css index cbb2837a27..4bb12abbb5 100644 --- a/frappe/templates/styles/discussion_style.css +++ b/frappe/templates/styles/discussion_style.css @@ -69,8 +69,6 @@ background-color: #F4F5F6; padding: 0.75rem; border-radius: 4px; - max-height: 700px; - overflow-y: auto; } @media (max-width: 550px) { @@ -79,11 +77,6 @@ } } -#discussion-group { - max-height: 700px; - overflow-y: auto; -} - .sidebar-topic { padding: 0.75rem; margin: 0.75rem 0; diff --git a/frappe/website/doctype/discussion_reply/discussion_reply.json b/frappe/website/doctype/discussion_reply/discussion_reply.json index 3bc5e3e479..7dda2b659e 100644 --- a/frappe/website/doctype/discussion_reply/discussion_reply.json +++ b/frappe/website/doctype/discussion_reply/discussion_reply.json @@ -1,5 +1,6 @@ { "actions": [], + "autoname": "REPLY.####", "creation": "2021-08-11 10:59:38.597046", "doctype": "DocType", "editable_grid": 1, @@ -26,10 +27,11 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-08-27 15:06:51.362715", + "modified": "2021-09-28 12:09:10.875927", "modified_by": "Administrator", "module": "Website", "name": "Discussion Reply", + "naming_rule": "Expression (old style)", "owner": "Administrator", "permissions": [ { @@ -48,4 +50,4 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1 -} +} \ No newline at end of file diff --git a/frappe/website/doctype/discussion_topic/discussion_topic.json b/frappe/website/doctype/discussion_topic/discussion_topic.json index a9d4252833..fd52a5bd21 100644 --- a/frappe/website/doctype/discussion_topic/discussion_topic.json +++ b/frappe/website/doctype/discussion_topic/discussion_topic.json @@ -1,5 +1,6 @@ { "actions": [], + "autoname": "TOPIC.####", "creation": "2021-08-11 10:55:29.341674", "doctype": "DocType", "editable_grid": 1, @@ -18,22 +19,27 @@ { "fieldname": "reference_doctype", "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, "label": "Reference Doctype", "options": "DocType" }, { "fieldname": "reference_docname", "fieldtype": "Dynamic Link", + "in_list_view": 1, + "in_standard_filter": 1, "label": "Reference Docname", "options": "reference_doctype" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-08-11 12:29:43.564126", + "modified": "2021-09-28 12:11:50.016352", "modified_by": "Administrator", "module": "Website", "name": "Discussion Topic", + "naming_rule": "Expression (old style)", "owner": "Administrator", "permissions": [ { @@ -54,4 +60,4 @@ "sort_order": "DESC", "title_field": "title", "track_changes": 1 -} +} \ No newline at end of file