From f512fe8446f4fb8f9755099406a014ed0f04b8fd Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Thu, 7 May 2020 18:21:05 +0530 Subject: [PATCH 01/34] feat: help article feedback --- .../js/frappe/form/sidebar/form_sidebar.js | 13 ++++ .../frappe/form/templates/form_sidebar.html | 6 +- frappe/public/js/frappe/utils/common.js | 6 ++ frappe/public/less/sidebar.less | 3 +- frappe/templates/includes/feedback.html | 29 +++++++++ frappe/website/doctype/feedback/__init__.py | 0 frappe/website/doctype/feedback/feedback.js | 8 +++ frappe/website/doctype/feedback/feedback.json | 59 +++++++++++++++++++ frappe/website/doctype/feedback/feedback.py | 27 +++++++++ .../website/doctype/feedback/test_feedback.py | 10 ++++ .../help_article/templates/help_article.html | 5 +- 11 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 frappe/templates/includes/feedback.html create mode 100644 frappe/website/doctype/feedback/__init__.py create mode 100644 frappe/website/doctype/feedback/feedback.js create mode 100644 frappe/website/doctype/feedback/feedback.json create mode 100644 frappe/website/doctype/feedback/feedback.py create mode 100644 frappe/website/doctype/feedback/test_feedback.py diff --git a/frappe/public/js/frappe/form/sidebar/form_sidebar.js b/frappe/public/js/frappe/form/sidebar/form_sidebar.js index a145e47149..9450fdc674 100644 --- a/frappe/public/js/frappe/form/sidebar/form_sidebar.js +++ b/frappe/public/js/frappe/form/sidebar/form_sidebar.js @@ -93,6 +93,19 @@ frappe.ui.form.Sidebar = Class.extend({ }); } + frappe.utils.get_feedback(this.frm.doc.name).then((res) => { + this.sidebar + .find(".helpful") + .html( + __("Helpful {0}", [String(res.message.helpful).bold()]) + ); + this.sidebar + .find(".not-helpful") + .html( + __("Not Helpful {0}", [String(res.message.not_helpful).bold()]) + ); + }); + this.sidebar .find(".modified-by") .html( diff --git a/frappe/public/js/frappe/form/templates/form_sidebar.html b/frappe/public/js/frappe/form/templates/form_sidebar.html index 30b2205bae..3e72684818 100644 --- a/frappe/public/js/frappe/form/templates/form_sidebar.html +++ b/frappe/public/js/frappe/form/templates/form_sidebar.html @@ -106,11 +106,15 @@ {% if(frappe.get_form_sidebar_extension) { %} - {{ frappe.get_form_sidebar_extension() }} + {{ frappe.get_form_sidebar_extension() }} {% } %} diff --git a/frappe/public/js/frappe/utils/common.js b/frappe/public/js/frappe/utils/common.js index 2fda8ed27a..1cdabf23e0 100644 --- a/frappe/public/js/frappe/utils/common.js +++ b/frappe/public/js/frappe/utils/common.js @@ -359,9 +359,3 @@ frappe.utils.get_page_view_count = function(route) { path: route }); }; - -frappe.utils.get_feedback = function(reference_name) { - return frappe.call("frappe.website.doctype.feedback.feedback.get_feedback_count", { - reference_name: reference_name - }); -}; \ No newline at end of file diff --git a/frappe/public/less/sidebar.less b/frappe/public/less/sidebar.less index b6ffb7e697..109b7a3209 100644 --- a/frappe/public/less/sidebar.less +++ b/frappe/public/less/sidebar.less @@ -274,8 +274,7 @@ body[data-route^="Module"] .main-menu { .layout-side-section .form-sidebar { .modified-by, - .pageview-count, - .feedback { + .pageview-count { margin-bottom: 15px; } } diff --git a/frappe/templates/includes/feedback.html b/frappe/templates/includes/feedback.html deleted file mode 100644 index 5d10c7b159..0000000000 --- a/frappe/templates/includes/feedback.html +++ /dev/null @@ -1,29 +0,0 @@ -
-
- {{ _("Helpful?") }} - - - - -
- - diff --git a/frappe/website/doctype/feedback/__init__.py b/frappe/website/doctype/feedback/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frappe/website/doctype/feedback/feedback.js b/frappe/website/doctype/feedback/feedback.js deleted file mode 100644 index f5fa89b30e..0000000000 --- a/frappe/website/doctype/feedback/feedback.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2020, Frappe Technologies and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Feedback', { - // refresh: function(frm) { - - // } -}); diff --git a/frappe/website/doctype/feedback/feedback.json b/frappe/website/doctype/feedback/feedback.json deleted file mode 100644 index b04aefa462..0000000000 --- a/frappe/website/doctype/feedback/feedback.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "actions": [], - "creation": "2020-05-07 16:42:27.234652", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "reference_doctype", - "reference_name", - "helpful" - ], - "fields": [ - { - "fieldname": "reference_doctype", - "fieldtype": "Link", - "label": "Reference DocType", - "options": "DocType" - }, - { - "fieldname": "helpful", - "fieldtype": "Select", - "label": "Helpful", - "options": "Yes\nNo" - }, - { - "fieldname": "reference_name", - "fieldtype": "Dynamic Link", - "label": "Reference Name", - "options": "reference_doctype", - "search_index": 1 - } - ], - "in_create": 1, - "links": [], - "modified": "2020-05-07 16:53:29.211653", - "modified_by": "Administrator", - "module": "Website", - "name": "Feedback", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "quick_entry": 1, - "read_only": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/frappe/website/doctype/feedback/feedback.py b/frappe/website/doctype/feedback/feedback.py deleted file mode 100644 index 3b92118ec3..0000000000 --- a/frappe/website/doctype/feedback/feedback.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Frappe Technologies and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class Feedback(Document): - pass - -@frappe.whitelist(allow_guest=True) -def add_feedback(reference_doctype, reference_name, helpful): - frappe.get_doc({ - "doctype": "Feedback", - "reference_doctype": reference_doctype, - "reference_name": reference_name, - "helpful": helpful - }).insert(ignore_permissions=True) - -@frappe.whitelist() -def get_feedback_count(reference_name): - - return { - "helpful": frappe.db.count("Feedback", {"reference_name": reference_name, "helpful": "Yes"}), - "not_helpful": frappe.db.count("Feedback", {"reference_name": reference_name, "helpful": "No"}), - } \ No newline at end of file diff --git a/frappe/website/doctype/feedback/test_feedback.py b/frappe/website/doctype/feedback/test_feedback.py deleted file mode 100644 index 9a31738d75..0000000000 --- a/frappe/website/doctype/feedback/test_feedback.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Frappe Technologies and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestFeedback(unittest.TestCase): - pass diff --git a/frappe/website/doctype/help_article/help_article.js b/frappe/website/doctype/help_article/help_article.js index c56bda8e0b..0ca92aefbd 100644 --- a/frappe/website/doctype/help_article/help_article.js +++ b/frappe/website/doctype/help_article/help_article.js @@ -3,6 +3,21 @@ frappe.ui.form.on('Help Article', { refresh: function(frm) { + frm.dashboard.clear_headline(); + frm.dashboard.set_headline_alert(` +
+
+ + Helpful ${frm.doc.helpful} + +
+
+ + Not Helpful ${frm.doc.helpful} + +
+
+ `); } }); diff --git a/frappe/website/doctype/help_article/help_article.json b/frappe/website/doctype/help_article/help_article.json index 5957333724..ca659692c6 100644 --- a/frappe/website/doctype/help_article/help_article.json +++ b/frappe/website/doctype/help_article/help_article.json @@ -1,445 +1,158 @@ { - "allow_copy": 0, - "allow_guest_to_view": 1, - "allow_import": 1, - "allow_rename": 0, - "beta": 0, - "creation": "2014-10-30 14:25:53.780105", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 0, + "actions": [], + "allow_guest_to_view": 1, + "allow_import": 1, + "creation": "2014-10-30 14:25:53.780105", + "doctype": "DocType", + "field_order": [ + "title", + "category", + "published", + "column_break_4", + "author", + "level", + "section_break_7", + "content", + "likes", + "route", + "owner", + "feedback", + "helpful", + "cb_00", + "not_helpful" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "title", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Title", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "title", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Title", + "reqd": 1, + "search_index": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "category", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Category", - "length": 0, - "no_copy": 0, - "options": "Help Category", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "category", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Category", + "options": "Help Category", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "published", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Published", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "published", + "fieldtype": "Check", + "label": "Published" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_4", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "user_fullname", - "fieldname": "author", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Author", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "user_fullname", + "fieldname": "author", + "fieldtype": "Data", + "label": "Author" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "level", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Level", - "length": 0, - "no_copy": 0, - "options": "Beginner\nIntermediate\nExpert", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "level", + "fieldtype": "Select", + "label": "Level", + "options": "Beginner\nIntermediate\nExpert" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_7", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_7", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "content", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Content", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "content", + "fieldtype": "Text Editor", + "in_global_search": 1, + "label": "Content", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "likes", - "fieldtype": "Int", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Likes", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "likes", + "fieldtype": "Int", + "label": "Likes", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "route", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Route", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "route", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Route" + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "user", - "fieldname": "owner", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Owner", - "length": 0, - "no_copy": 0, - "options": "User", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "default": "user", + "fieldname": "owner", + "fieldtype": "Link", + "label": "Owner", + "options": "User" + }, + { + "collapsible": 1, + "fieldname": "feedback", + "fieldtype": "Section Break", + "label": "Feedback" + }, + { + "default": "0", + "fieldname": "helpful", + "fieldtype": "Int", + "in_list_view": 1, + "label": "Helpful", + "read_only": 1 + }, + { + "fieldname": "cb_00", + "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "not_helpful", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Not Helpful", + "read_only": 1 } - ], - "has_web_view": 1, - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "icon-file-alt", - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_published_field": "published", - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2018-05-18 17:49:52.912440", - "modified_by": "Administrator", - "module": "Website", - "name": "Help Article", - "name_case": "", - "owner": "Administrator", + ], + "has_web_view": 1, + "icon": "icon-file-alt", + "is_published_field": "published", + "links": [], + "modified": "2020-05-08 10:48:19.997789", + "modified_by": "Administrator", + "module": "Website", + "name": "Help Article", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Knowledge Base Editor", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "import": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Knowledge Base Editor", "write": 1 - }, + }, { - "amend": 0, - "cancel": 0, - "create": 1, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Knowledge Base Contributor", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "create": 1, + "read": 1, + "role": "Knowledge Base Contributor", "write": 1 - }, + }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Guest", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 + "read": 1, + "role": "Guest" } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "title", - "track_changes": 1, - "track_seen": 0 + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "title", + "track_changes": 1 } \ No newline at end of file diff --git a/frappe/website/doctype/help_article/help_article.py b/frappe/website/doctype/help_article/help_article.py index 6220d0aff5..fa26cfef99 100644 --- a/frappe/website/doctype/help_article/help_article.py +++ b/frappe/website/doctype/help_article/help_article.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.website.website_generator import WebsiteGenerator -from frappe.utils import is_markdown, markdown +from frappe.utils import is_markdown, markdown, cint from frappe.website.utils import get_comment_list from frappe import _ @@ -100,3 +100,11 @@ def clear_website_cache(path=None): frappe.cache().delete_value("knowledge_base:category_sidebar") frappe.cache().delete_value("knowledge_base:faq") +@frappe.whitelist(allow_guest=True) +def add_feedback(article, helpful): + field = "helpful" + if helpful == "No": + field = "not_helpful" + + value = cint(frappe.db.get_value("Help Article", article, field)) + frappe.db.set_value("Help Article", article, field, value+1, update_modified=False) \ No newline at end of file diff --git a/frappe/website/doctype/help_article/templates/help_article.html b/frappe/website/doctype/help_article/templates/help_article.html index 6c59359785..4f71117dea 100644 --- a/frappe/website/doctype/help_article/templates/help_article.html +++ b/frappe/website/doctype/help_article/templates/help_article.html @@ -19,8 +19,13 @@


{{ _("More articles on {0}").format(category.name) }}

-
- {% include 'templates/includes/feedback.html' %} +
+
+

@@ -30,6 +35,23 @@ {% endblock %} From 8c65d3581ebb634d913cc81a02dbda60fd278c4d Mon Sep 17 00:00:00 2001 From: Himanshu Date: Wed, 27 May 2020 13:39:29 +0530 Subject: [PATCH 03/34] Update frappe/website/doctype/help_article/templates/help_article.html Co-authored-by: Prssanna Desai --- frappe/website/doctype/help_article/templates/help_article.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/website/doctype/help_article/templates/help_article.html b/frappe/website/doctype/help_article/templates/help_article.html index 4f71117dea..08c8fa342d 100644 --- a/frappe/website/doctype/help_article/templates/help_article.html +++ b/frappe/website/doctype/help_article/templates/help_article.html @@ -48,7 +48,7 @@ frappe.ready(function() { callback: function(r) { $(".feedback")[0].disabled = true; $(".feedback")[1].disabled = true; - frappe.msgprint(__("Feedback Submitted.")); + frappe.msgprint(__("Thank you for your feedback!")); } }) }); From 86508e7617e9b9d448599b6298dacf83f840d136 Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Mon, 15 Jun 2020 14:53:30 +0530 Subject: [PATCH 04/34] fix: change to primary for button --- .../help_article/templates/help_article.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/frappe/website/doctype/help_article/templates/help_article.html b/frappe/website/doctype/help_article/templates/help_article.html index 08c8fa342d..01271af8b9 100644 --- a/frappe/website/doctype/help_article/templates/help_article.html +++ b/frappe/website/doctype/help_article/templates/help_article.html @@ -23,8 +23,8 @@
@@ -41,13 +41,19 @@ frappe.ready(function() { helpful: this.getAttribute("data-value"), } + let disable_button = function(btn) { + btn.classList.remove("btn-outline-primary"); + btn.classList.add("btn-light"); + btn.disabled = true + } + frappe.call({ btn: this, method: "frappe.website.doctype.help_article.help_article.add_feedback", args: args, callback: function(r) { - $(".feedback")[0].disabled = true; - $(".feedback")[1].disabled = true; + disable_button($(".feedback")[0]); + disable_button($(".feedback")[1]); frappe.msgprint(__("Thank you for your feedback!")); } }) From 0aceebd5507d088410354e6bf55acdc54667b816 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Wed, 24 Jun 2020 10:52:03 +0530 Subject: [PATCH 05/34] Update frappe/website/doctype/help_article/help_article.js Co-authored-by: Prssanna Desai --- frappe/website/doctype/help_article/help_article.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/website/doctype/help_article/help_article.js b/frappe/website/doctype/help_article/help_article.js index 0ca92aefbd..0a87b22e2c 100644 --- a/frappe/website/doctype/help_article/help_article.js +++ b/frappe/website/doctype/help_article/help_article.js @@ -14,7 +14,7 @@ frappe.ui.form.on('Help Article', {
- Not Helpful ${frm.doc.helpful} + Not Helpful ${frm.doc.not_helpful}
From 249d04420b9e32e8543c02bf8879d321747df5ba Mon Sep 17 00:00:00 2001 From: Himanshu Date: Fri, 26 Jun 2020 13:28:15 +0530 Subject: [PATCH 06/34] Update frappe/website/doctype/help_article/templates/help_article.html Co-authored-by: Shivam Mishra --- frappe/website/doctype/help_article/templates/help_article.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/website/doctype/help_article/templates/help_article.html b/frappe/website/doctype/help_article/templates/help_article.html index 01271af8b9..cdd830295f 100644 --- a/frappe/website/doctype/help_article/templates/help_article.html +++ b/frappe/website/doctype/help_article/templates/help_article.html @@ -22,7 +22,7 @@

From 548a5fa41640e6bf7dff1e19c011146ddfa7e65e Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Fri, 26 Jun 2020 15:38:07 +0530 Subject: [PATCH 07/34] fix: add new disabled state --- .../help_article/templates/help_article.html | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/frappe/website/doctype/help_article/templates/help_article.html b/frappe/website/doctype/help_article/templates/help_article.html index cdd830295f..a97154847b 100644 --- a/frappe/website/doctype/help_article/templates/help_article.html +++ b/frappe/website/doctype/help_article/templates/help_article.html @@ -25,6 +25,7 @@ {{ _("Was this article helpful?") }} +
@@ -41,20 +42,14 @@ frappe.ready(function() { helpful: this.getAttribute("data-value"), } - let disable_button = function(btn) { - btn.classList.remove("btn-outline-primary"); - btn.classList.add("btn-light"); - btn.disabled = true - } - frappe.call({ btn: this, method: "frappe.website.doctype.help_article.help_article.add_feedback", args: args, callback: function(r) { - disable_button($(".feedback")[0]); - disable_button($(".feedback")[1]); - frappe.msgprint(__("Thank you for your feedback!")); + $(".feedback")[0].classList.add("hide"); + $(".feedback")[1].classList.add("hide"); + $(".feedback-msg")[0].classList.remove("hide"); } }) }); From 8ddfd2344d6c7d8be3855d317602de2b7d2f8888 Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Thu, 2 Jul 2020 12:53:16 +0530 Subject: [PATCH 08/34] chore: add search queries to whitelist these functions are called through search widget and need to be whitelisted to work Signed-off-by: Chinmay D. Pai --- frappe/contacts/address_and_contact.py | 1 + frappe/contacts/doctype/address/address.py | 3 ++- frappe/contacts/doctype/contact/contact.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frappe/contacts/address_and_contact.py b/frappe/contacts/address_and_contact.py index 5a004f153b..51f13fb1a1 100644 --- a/frappe/contacts/address_and_contact.py +++ b/frappe/contacts/address_and_contact.py @@ -146,6 +146,7 @@ def delete_contact_and_address(doctype, docname): if len(doc.links)==1: doc.delete() +@frappe.whitelist() def filter_dynamic_link_doctypes(doctype, txt, searchfield, start, page_len, filters): if not txt: txt = "" diff --git a/frappe/contacts/doctype/address/address.py b/frappe/contacts/doctype/address/address.py index b85d578353..79bdb42931 100644 --- a/frappe/contacts/doctype/address/address.py +++ b/frappe/contacts/doctype/address/address.py @@ -230,6 +230,7 @@ def get_company_address(company): return ret +@frappe.whitelist() def address_query(doctype, txt, searchfield, start, page_len, filters): from frappe.desk.reportview import get_match_cond @@ -289,4 +290,4 @@ def get_condensed_address(doc): return ", ".join([doc.get(d) for d in fields if doc.get(d)]) def update_preferred_address(address, field): - frappe.db.set_value('Address', address, field, 0) \ No newline at end of file + frappe.db.set_value('Address', address, field, 0) diff --git a/frappe/contacts/doctype/contact/contact.py b/frappe/contacts/doctype/contact/contact.py index 4cf209541c..598e186ee8 100644 --- a/frappe/contacts/doctype/contact/contact.py +++ b/frappe/contacts/doctype/contact/contact.py @@ -182,6 +182,7 @@ def update_contact(doc, method): contact.flags.ignore_mandatory = True contact.save(ignore_permissions=True) +@frappe.whitelist() def contact_query(doctype, txt, searchfield, start, page_len, filters): from frappe.desk.reportview import get_match_cond From 338151a7e5e067ec3e566025b1c99b04621432e3 Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Tue, 7 Jul 2020 11:22:37 +0530 Subject: [PATCH 09/34] fix: correctly format sql query Signed-off-by: Chinmay D. Pai --- frappe/contacts/doctype/contact/contact.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frappe/contacts/doctype/contact/contact.py b/frappe/contacts/doctype/contact/contact.py index 598e186ee8..e340c7e2d0 100644 --- a/frappe/contacts/doctype/contact/contact.py +++ b/frappe/contacts/doctype/contact/contact.py @@ -205,14 +205,14 @@ def contact_query(doctype, txt, searchfield, start, page_len, filters): `tabDynamic Link`.parenttype = 'Contact' and `tabDynamic Link`.link_doctype = %(link_doctype)s and `tabDynamic Link`.link_name = %(link_name)s and - `tabContact`.`{key}` like %(txt)s - {mcond} + `tabContact`.`%(key)s` like %(txt)s + %(mcond)s order by if(locate(%(_txt)s, `tabContact`.name), locate(%(_txt)s, `tabContact`.name), 99999), `tabContact`.idx desc, `tabContact`.name - limit %(start)s, %(page_len)s """.format( - mcond=get_match_cond(doctype), - key=searchfield), { + limit %(start)s, %(page_len)s """, { + 'mcond': get_match_cond(doctype), + 'key': searchfield, 'txt': '%' + txt + '%', '_txt': txt.replace("%", ""), 'start': start, From 36d1b5f0150799a08b5ca39c5efd35040e3a899d Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Thu, 9 Jul 2020 12:27:39 +0530 Subject: [PATCH 10/34] fix: check if field exists in meta before executing query Signed-off-by: Chinmay D. Pai --- frappe/contacts/doctype/contact/contact.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frappe/contacts/doctype/contact/contact.py b/frappe/contacts/doctype/contact/contact.py index e340c7e2d0..4af4362aff 100644 --- a/frappe/contacts/doctype/contact/contact.py +++ b/frappe/contacts/doctype/contact/contact.py @@ -186,6 +186,9 @@ def update_contact(doc, method): def contact_query(doctype, txt, searchfield, start, page_len, filters): from frappe.desk.reportview import get_match_cond + if not frappe.get_meta("Contact").get_field(searchfield): + return {} + link_doctype = filters.pop('link_doctype') link_name = filters.pop('link_name') @@ -205,14 +208,12 @@ def contact_query(doctype, txt, searchfield, start, page_len, filters): `tabDynamic Link`.parenttype = 'Contact' and `tabDynamic Link`.link_doctype = %(link_doctype)s and `tabDynamic Link`.link_name = %(link_name)s and - `tabContact`.`%(key)s` like %(txt)s - %(mcond)s + `tabContact`.`{key}` like %(txt)s + {mcond} order by if(locate(%(_txt)s, `tabContact`.name), locate(%(_txt)s, `tabContact`.name), 99999), `tabContact`.idx desc, `tabContact`.name - limit %(start)s, %(page_len)s """, { - 'mcond': get_match_cond(doctype), - 'key': searchfield, + limit %(start)s, %(page_len)s """.format(mcond=get_match_cond(doctype), key=searchfield), { 'txt': '%' + txt + '%', '_txt': txt.replace("%", ""), 'start': start, From 817b2488271ef109d4f53ecf4b1856ff3635892e Mon Sep 17 00:00:00 2001 From: Himanshu Date: Sat, 11 Jul 2020 17:34:28 +0530 Subject: [PATCH 11/34] Update frappe/website/doctype/help_article/templates/help_article.html Co-authored-by: Prssanna Desai --- frappe/website/doctype/help_article/templates/help_article.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/website/doctype/help_article/templates/help_article.html b/frappe/website/doctype/help_article/templates/help_article.html index a97154847b..bfe2bc4529 100644 --- a/frappe/website/doctype/help_article/templates/help_article.html +++ b/frappe/website/doctype/help_article/templates/help_article.html @@ -22,7 +22,7 @@

{%- endif -%} From 547bd77c207e2f1668de43889e540edb7d4a36c2 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Tue, 21 Jul 2020 18:46:51 +0530 Subject: [PATCH 23/34] fix: Do not check all attachments on adding new (#10926) --- .../public/js/frappe/views/communication.js | 129 ++++++++---------- 1 file changed, 59 insertions(+), 70 deletions(-) diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index 53d946f75d..29b21242af 100755 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -44,26 +44,6 @@ frappe.views.CommunicationComposer = Class.extend({ } }); - $(document).on("upload_complete", function(event, attachment) { - if(me.dialog.display) { - var wrapper = $(me.dialog.fields_dict.select_attachments.wrapper); - - // find already checked items - var checked_items = wrapper.find('[data-file-name]:checked').map(function() { - return $(this).attr("data-file-name"); - }); - - // reset attachment list - me.render_attach(); - - // check latest added - checked_items.push(attachment.name); - - $.each(checked_items, function(i, filename) { - wrapper.find('[data-file-name="'+ filename +'"]').prop("checked", true); - }); - } - }) this.prepare(); this.dialog.show(); @@ -387,77 +367,86 @@ frappe.views.CommunicationComposer = Class.extend({ folder: 'Home/Attachments', on_success: attachment => { this.attachments.push(attachment); - this.render_attach(); + this.render_attachment_rows(attachment); } }; - if(this.frm) { + if (this.frm) { args = { doctype: this.frm.doctype, docname: this.frm.docname, folder: 'Home/Attachments', on_success: attachment => { this.frm.attachments.attachment_uploaded(attachment); - this.render_attach(); + this.render_attachment_rows(attachment); } - } + }; } - $("
" - +__("Select Attachments")+"
\ -

\ - " - +__("Add Attachment")+"

").appendTo(attach.empty()) + $(` +
+ ${__("Select Attachments")} +
+
+

+ + + ${__("Add Attachment")} + +

+ `).appendTo(attach.empty()); + attach .find(".add-more-attachments a") - .on('click',() => new frappe.ui.FileUploader(args)); - this.render_attach(); + .on('click', () => new frappe.ui.FileUploader(args)); + this.render_attachment_rows(); }, - render_attach:function(){ - var fields = this.dialog.fields_dict; - var attach = $(fields.select_attachments.wrapper).find(".attach-list").empty(); - var files = []; - if (this.attachments && this.attachments.length) { - files = files.concat(this.attachments); - } - if (cur_frm) { - files = files.concat(cur_frm.get_files()); - } + render_attachment_rows: function(attachment) { + const select_attachments = this.dialog.fields_dict.select_attachments; + const attachment_rows = $(select_attachments.wrapper).find(".attach-list"); + if (attachment) { + attachment_rows.append(this.get_attachment_row(attachment, true)); + } else { + let files = []; + if (this.attachments && this.attachments.length) { + files = files.concat(this.attachments); + } + if (this.frm) { + files = files.concat(this.frm.get_files()); + } - if(files.length) { - $.each(files, function(i, f) { - if (!f.file_name) return; - f.file_url = frappe.urllib.get_full_url(f.file_url); - - $(repl('

' - + '

', f)) - .appendTo(attach) - }); - } - this.select_attachments(); - }, - select_attachments:function(){ - let me = this; - if(me.dialog.display) { - let wrapper = $(me.dialog.fields_dict.select_attachments.wrapper); - - let unchecked_items = wrapper.find('[data-file-name]:not(:checked)').map(function() { - return $(this).attr("data-file-name"); - }); - - $.each(unchecked_items, function(i, filename) { - wrapper.find('[data-file-name="'+ filename +'"]').prop("checked", true); - }); + if (files.length) { + $.each(files, (i, f) => { + if (!f.file_name) return; + if (!attachment_rows.find(`[data-file-name="${f.name}"]`).length) { + f.file_url = frappe.urllib.get_full_url(f.file_url); + attachment_rows.append(this.get_attachment_row(f)); + } + }); + } } }, + + get_attachment_row(attachment, checked) { + return $(`

+ + + +

`); + }, + setup_email: function() { // email - var me = this; var fields = this.dialog.fields_dict; if(this.attach_document_print) { From 061c8d90886d319dea9b8fa6c8c13741b08e3640 Mon Sep 17 00:00:00 2001 From: Diksha Jadhav Date: Tue, 21 Jul 2020 19:14:07 +0530 Subject: [PATCH 24/34] fix(grid): trigger onchange on field --- frappe/public/js/frappe/form/grid_row.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/form/grid_row.js b/frappe/public/js/frappe/form/grid_row.js index f5a06311e9..f4bcecc68e 100644 --- a/frappe/public/js/frappe/form/grid_row.js +++ b/frappe/public/js/frappe/form/grid_row.js @@ -392,8 +392,11 @@ export default class GridRow { // sync get_query field.get_query = this.grid.get_field(df.fieldname).get_query; - field.df.onchange = function() { - me.grid.grid_rows[this.doc.idx-1].refresh_field(this.df.fieldname); + + var field_on_change_function = field.df.onchange; + field.df.onchange = function(e) { + field_on_change_function && field_on_change_function(e); + me.grid.grid_rows[this.doc.idx - 1].refresh_field(this.df.fieldname); }; field.refresh(); if(field.$input) { From 06788762d60cad293c7ad34dc7525bed8aab6da4 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Wed, 22 Jul 2020 10:09:58 +0530 Subject: [PATCH 25/34] fix(website): Properly load colocated javascript and style --- frappe/templates/base.html | 12 ++++++++++-- frappe/website/router.py | 28 +++++++++++++--------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/frappe/templates/base.html b/frappe/templates/base.html index 0b82b3dac2..8c843a44a4 100644 --- a/frappe/templates/base.html +++ b/frappe/templates/base.html @@ -42,7 +42,11 @@ {{ head_include or "" }} {% endblock -%} - {%- block style %}{%- endblock -%} + {%- block style %} + {% if colocated_css -%} + + {%- endif %} + {%- endblock -%} {%- endfor -%} - {%- block script %}{%- endblock %} + {%- block script %} + {% if colocated_js -%} + + {%- endif %} + {%- endblock %} {%- block body_include %}{{ body_include or "" }}{% endblock -%} diff --git a/frappe/website/router.py b/frappe/website/router.py index db7e6f322c..fb9cae7d76 100644 --- a/frappe/website/router.py +++ b/frappe/website/router.py @@ -283,22 +283,20 @@ def setup_source(page_info): # set the source only if it contains raw content html = source - # load css/js files - js, css = '', '' + # load css/js files + js_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.js') + if os.path.exists(js_path): + if not '{% block script %}' in html: + with io.open(js_path, 'r', encoding = 'utf-8') as f: + js = f.read() + page_info.colocated_js = js - js_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.js') - if os.path.exists(js_path): - if not '{% block script %}' in html: - with io.open(js_path, 'r', encoding = 'utf-8') as f: - js = f.read() - html += '\n{% block script %}\n{% endblock %}' - - css_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.css') - if os.path.exists(css_path): - if not '{% block style %}' in html: - with io.open(css_path, 'r', encoding='utf-8') as f: - css = f.read() - html += '\n{% block style %}\n\n{% endblock %}' + css_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.css') + if os.path.exists(css_path): + if not '{% block style %}' in html: + with io.open(css_path, 'r', encoding='utf-8') as f: + css = f.read() + page_info.colocated_css = css if html: page_info.source = html From 2bf77cd82a3c14976cf4fe2fcd4073978338f4f0 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Wed, 22 Jul 2020 10:32:12 +0530 Subject: [PATCH 26/34] style: Fix sider --- frappe/website/router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/website/router.py b/frappe/website/router.py index fb9cae7d76..9a647e1030 100644 --- a/frappe/website/router.py +++ b/frappe/website/router.py @@ -286,14 +286,14 @@ def setup_source(page_info): # load css/js files js_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.js') if os.path.exists(js_path): - if not '{% block script %}' in html: + if '{% block script %}' not in html: with io.open(js_path, 'r', encoding = 'utf-8') as f: js = f.read() page_info.colocated_js = js css_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.css') if os.path.exists(css_path): - if not '{% block style %}' in html: + if '{% block style %}' not in html: with io.open(css_path, 'r', encoding='utf-8') as f: css = f.read() page_info.colocated_css = css From 2a068bad19a1fcae28921c9e4fd494b6209be527 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 22 Jul 2020 11:17:04 +0530 Subject: [PATCH 27/34] fix: set page actions after setting read only --- frappe/public/js/frappe/form/form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js index c0b76ee94d..43128065bc 100644 --- a/frappe/public/js/frappe/form/form.js +++ b/frappe/public/js/frappe/form/form.js @@ -1409,6 +1409,7 @@ frappe.ui.form.Form = class FrappeForm { }; } this.perm = perm; + this.toolbar.set_page_action(); } trigger(event, doctype, docname) { From 8f6329de4953f99637c98c68ad94645560b51a73 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Wed, 22 Jul 2020 11:23:35 +0530 Subject: [PATCH 28/34] refactor: Simplify code --- frappe/website/router.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/frappe/website/router.py b/frappe/website/router.py index 9a647e1030..263d5b0f07 100644 --- a/frappe/website/router.py +++ b/frappe/website/router.py @@ -285,18 +285,16 @@ def setup_source(page_info): # load css/js files js_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.js') - if os.path.exists(js_path): - if '{% block script %}' not in html: - with io.open(js_path, 'r', encoding = 'utf-8') as f: - js = f.read() - page_info.colocated_js = js + if os.path.exists(js_path) and '{% block script %}' not in html: + with io.open(js_path, 'r', encoding = 'utf-8') as f: + js = f.read() + page_info.colocated_js = js css_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.css') - if os.path.exists(css_path): - if '{% block style %}' not in html: - with io.open(css_path, 'r', encoding='utf-8') as f: - css = f.read() - page_info.colocated_css = css + if os.path.exists(css_path) and '{% block style %}' not in html: + with io.open(css_path, 'r', encoding='utf-8') as f: + css = f.read() + page_info.colocated_css = css if html: page_info.source = html From 1f2cf125035185bd3c610702afa7de0969d7bbb8 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Wed, 22 Jul 2020 14:14:05 +0530 Subject: [PATCH 29/34] Update frappe/website/doctype/help_article/templates/help_article.html Co-authored-by: Prssanna Desai --- frappe/website/doctype/help_article/templates/help_article.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/website/doctype/help_article/templates/help_article.html b/frappe/website/doctype/help_article/templates/help_article.html index f5583931e2..1b4bf123e6 100644 --- a/frappe/website/doctype/help_article/templates/help_article.html +++ b/frappe/website/doctype/help_article/templates/help_article.html @@ -24,7 +24,7 @@
{{ _("Was this article helpful?") }}
- +
From 19ff07b53b4927fca53faae2f9adb82ad3159305 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 22 Jul 2020 14:27:18 +0530 Subject: [PATCH 30/34] fix: Margin top for child table index checkboxes --- frappe/public/less/desk.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frappe/public/less/desk.less b/frappe/public/less/desk.less index 36ceed9bfa..d951178be0 100644 --- a/frappe/public/less/desk.less +++ b/frappe/public/less/desk.less @@ -789,6 +789,10 @@ li.user-progress { position: relative; } +.row-index input[type=checkbox] { + margin-top: 12px; +} + @checkbox-height: 14px; // custom font awesome checkbox From 64a03125460fec1ac6e6c7352a3f5e68c8f7ee08 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 22 Jul 2020 15:51:07 +0530 Subject: [PATCH 31/34] feat: always render footer links layout --- frappe/templates/includes/footer/footer_links.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/frappe/templates/includes/footer/footer_links.html b/frappe/templates/includes/footer/footer_links.html index fe9f69fed3..e8bfdadb7f 100644 --- a/frappe/templates/includes/footer/footer_links.html +++ b/frappe/templates/includes/footer/footer_links.html @@ -7,8 +7,6 @@ {%- endif -%} {% endmacro %} - -{% if footer_items -%} -{% endif %} From b541ffac68d0ff140c937d40a2a2648ff754b0c2 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 22 Jul 2020 19:30:11 +0530 Subject: [PATCH 32/34] Revert "fix: set page actions after setting read only" --- frappe/public/js/frappe/form/form.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js index 43128065bc..c0b76ee94d 100644 --- a/frappe/public/js/frappe/form/form.js +++ b/frappe/public/js/frappe/form/form.js @@ -1409,7 +1409,6 @@ frappe.ui.form.Form = class FrappeForm { }; } this.perm = perm; - this.toolbar.set_page_action(); } trigger(event, doctype, docname) { From 51a473336a56fa559ba2b3b7438495b3dcc6604c Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 22 Jul 2020 21:55:56 +0530 Subject: [PATCH 33/34] fix: Margin top for child table index checkboxes --- frappe/public/less/desk.less | 4 ---- frappe/public/less/form_grid.less | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/public/less/desk.less b/frappe/public/less/desk.less index d951178be0..36ceed9bfa 100644 --- a/frappe/public/less/desk.less +++ b/frappe/public/less/desk.less @@ -789,10 +789,6 @@ li.user-progress { position: relative; } -.row-index input[type=checkbox] { - margin-top: 12px; -} - @checkbox-height: 14px; // custom font awesome checkbox diff --git a/frappe/public/less/form_grid.less b/frappe/public/less/form_grid.less index 5cb04a252c..d9e7d8bceb 100644 --- a/frappe/public/less/form_grid.less +++ b/frappe/public/less/form_grid.less @@ -98,6 +98,10 @@ text-align: right; } +.grid-row .grid-row-check { + margin-top: 12px; +} + .grid-row > .row { .col:last-child { margin-right: -10px; From 047280013dcc6b8c55fdf5ad4bf44270fc81b3bc Mon Sep 17 00:00:00 2001 From: gavin Date: Thu, 23 Jul 2020 18:42:44 +0530 Subject: [PATCH 34/34] fix: Fetch latest files filtered by names (#11056) --- frappe/utils/backups.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/utils/backups.py b/frappe/utils/backups.py index bb03c85bf9..9f9a64f296 100644 --- a/frappe/utils/backups.py +++ b/frappe/utils/backups.py @@ -104,11 +104,11 @@ class BackupGenerator: this_file = cstr(this_file) this_file_path = os.path.join(get_backup_path(), this_file) if not is_file_old(this_file_path, older_than): - if "_private_files" in this_file_path: + if "-private-files" in this_file_path: backup_path_private_files = this_file_path - elif "_files" in this_file_path: + elif "-files" in this_file_path: backup_path_files = this_file_path - elif "_database" in this_file_path: + elif "-database" in this_file_path: backup_path_db = this_file_path elif "site_config" in this_file_path: site_config_backup_path = this_file_path