From b95da2a670efab0a909c2e54441942eaa140967a Mon Sep 17 00:00:00 2001 From: P-Froggy <60393001+P-Froggy@users.noreply.github.com> Date: Tue, 31 Mar 2020 19:06:24 +0200 Subject: [PATCH] Add default sort filter "communication_date" --- .../doctype/communication/communication.js | 3 +- .../js/frappe/views/inbox/inbox_view.js | 54 +++---------------- 2 files changed, 7 insertions(+), 50 deletions(-) diff --git a/frappe/core/doctype/communication/communication.js b/frappe/core/doctype/communication/communication.js index 3924fbd05b..83c3b36577 100644 --- a/frappe/core/doctype/communication/communication.js +++ b/frappe/core/doctype/communication/communication.js @@ -176,8 +176,7 @@ frappe.ui.form.on("Communication", { }, freeze: true, callback: function(r) { - frappe.msgprint(__("Email has been moved to Account {0}", [values.email_account])); - frm.reload_doc(); + window.history.back(); } }); } diff --git a/frappe/public/js/frappe/views/inbox/inbox_view.js b/frappe/public/js/frappe/views/inbox/inbox_view.js index 0b40faff96..ca4e8a15f8 100644 --- a/frappe/public/js/frappe/views/inbox/inbox_view.js +++ b/frappe/public/js/frappe/views/inbox/inbox_view.js @@ -40,6 +40,11 @@ frappe.views.InboxView = class InboxView extends frappe.views.ListView { setup_defaults() { super.setup_defaults(); + + // initialize with saved order by + this.sort_by = this.view_user_settings.sort_by || 'communication_date'; + this.sort_order = this.view_user_settings.sort_order || 'desc'; + this.email_account = frappe.get_route()[3]; this.page_title = this.email_account; this.filters = this.get_inbox_filters(); @@ -84,53 +89,6 @@ frappe.views.InboxView = class InboxView extends frappe.views.ListView { this.render_tags(); } - /* render() { - this.emails = this.data; - this.render_inbox_view(); - } - - render_inbox_view() { - let html = this.emails.map(this.render_email_row.bind(this)).join(""); - - this.$result.html(` - ${this.get_header_html()} - ${html} - `); - } - - get_header_html() { - return this.get_header_html_skeleton(` -
- - ${__('Subject')} -
- - `); - } - - render_email_row(email) { - if (!email.css_seen && email.seen) - email.css_seen = "seen"; - - const columns_html = ` -
- - - - ${email.subject} - - -
- - `; - - return this.get_list_row_html_skeleton(columns_html, this.get_meta_html(email)); - }*/ - get_meta_html(email) { const attachment = email.has_attachment ? `` : ''; @@ -145,7 +103,7 @@ frappe.views.InboxView = class InboxView extends frappe.views.ListView { const communication_date = comment_when(email.communication_date, true); const status = email.status == "Closed" ? `` : email.status == "Replied" ? `` - : ""; + : ""; return `