From 23bd9749f670dcc26692faa9dd31e8fe870cb82e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 5 Jun 2022 19:36:38 +0530 Subject: [PATCH] feat(UX): refresh URL when updating filters --- frappe/public/js/frappe/list/list_view.js | 34 ++++------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index d57c57a0b6..1ca37e1138 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -1454,7 +1454,11 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { on_update() {} - get_share_url() { + on_filter_change() { + window.history.replaceState(null, null, this.get_url_with_filters()); + } + + get_url_with_filters() { const query_params = this.get_filters_for_args() .map((filter) => { filter[3] = encodeURIComponent(filter[3]); @@ -1476,27 +1480,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { return full_url; } - share_url() { - const d = new frappe.ui.Dialog({ - title: __("Share URL"), - fields: [ - { - fieldtype: "Code", - fieldname: "url", - label: "URL", - default: this.get_share_url(), - read_only: 1, - }, - ], - primary_action_label: __("Copy to clipboard"), - primary_action: () => { - frappe.utils.copy_to_clipboard(this.get_share_url()); - d.hide(); - }, - }); - d.show(); - } - get_menu_items() { const doctype = this.doctype; const items = []; @@ -1561,13 +1544,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { shortcut: "Ctrl+K", }); - items.push({ - label: __("Share URL", null, "Button in list view menu"), - action: () => this.share_url(), - standard: true, - shortcut: "Ctrl+L", - }); - if ( frappe.user.has_role("System Manager") && frappe.boot.developer_mode === 1