diff --git a/frappe/public/js/frappe/list/base_list.js b/frappe/public/js/frappe/list/base_list.js index e297afea89..388c84b30f 100644 --- a/frappe/public/js/frappe/list/base_list.js +++ b/frappe/public/js/frappe/list/base_list.js @@ -28,7 +28,6 @@ frappe.views.BaseList = class BaseList { this.setup_fields, // make view this.setup_page, - this.setup_side_bar, this.setup_main_section, this.setup_view, this.setup_view_menu, @@ -222,7 +221,6 @@ frappe.views.BaseList = class BaseList { parent: this.views_menu, page: this.page, list_view: this, - sidebar: this.list_sidebar, icon_map: icon_map, label_map: label_map, }); @@ -277,20 +275,6 @@ frappe.views.BaseList = class BaseList { frappe.breadcrumbs.add(this.meta.module, this.doctype); } - setup_side_bar() { - if (this.page.disable_sidebar_toggle) { - return; - } - - this.list_sidebar = new frappe.views.ListSidebar({ - doctype: this.doctype, - stats: this.stats, - parent: this.$page.find(".layout-side-section"), - page: this.page, - list_view: this, - }); - } - show_or_hide_sidebar() { let show_sidebar = JSON.parse(localStorage.show_sidebar || "true"); $(document.body).toggleClass("no-list-sidebar", !show_sidebar); diff --git a/frappe/public/js/frappe/list/list_sidebar.html b/frappe/public/js/frappe/list/list_sidebar.html deleted file mode 100644 index 04f7771fee..0000000000 --- a/frappe/public/js/frappe/list/list_sidebar.html +++ /dev/null @@ -1,29 +0,0 @@ -
- diff --git a/frappe/public/js/frappe/list/list_sidebar.js b/frappe/public/js/frappe/list/list_sidebar.js deleted file mode 100644 index c30c4704d9..0000000000 --- a/frappe/public/js/frappe/list/list_sidebar.js +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -// MIT License. See license.txt -import ListFilter from "./list_filter"; -frappe.provide("frappe.views"); - -// opts: -// stats = list of fields -// doctype -// parent - -frappe.views.ListSidebar = class ListSidebar { - constructor(opts) { - $.extend(this, opts); - this.make(); - } - - make() { - var sidebar_content = frappe.render_template("list_sidebar", { doctype: this.doctype }); - - this.sidebar = $('') - .html(sidebar_content) - .appendTo(this.page.sidebar.empty()); - - this.setup_list_filter(); - this.setup_list_group_by(); - this.setup_collapsible(); - - // do not remove - // used to trigger custom scripts - $(document).trigger("list_sidebar_setup"); - - if ( - this.list_view.list_view_settings && - this.list_view.list_view_settings.disable_sidebar_stats - ) { - this.sidebar.find(".list-tags").remove(); - } else { - this.sidebar.find(".list-stats").on("show.bs.dropdown", (e) => { - this.reload_stats(); - }); - } - } - - setup_views() { - var show_list_link = false; - - if (frappe.views.calendar[this.doctype]) { - this.sidebar.find('.list-link[data-view="Calendar"]').removeClass("hide"); - this.sidebar.find('.list-link[data-view="Gantt"]').removeClass("hide"); - show_list_link = true; - } - //show link for kanban view - this.sidebar.find('.list-link[data-view="Kanban"]').removeClass("hide"); - if (this.doctype === "Communication" && frappe.boot.email_accounts.length) { - this.sidebar.find('.list-link[data-view="Inbox"]').removeClass("hide"); - show_list_link = true; - } - - if (frappe.treeview_settings[this.doctype] || frappe.get_meta(this.doctype).is_tree) { - this.sidebar.find(".tree-link").removeClass("hide"); - } - - this.current_view = "List"; - var route = frappe.get_route(); - if (route.length > 2 && frappe.views.view_modes.includes(route[2])) { - this.current_view = route[2]; - - if (this.current_view === "Kanban") { - this.kanban_board = route[3]; - } else if (this.current_view === "Inbox") { - this.email_account = route[3]; - } - } - - // disable link for current view - this.sidebar - .find('.list-link[data-view="' + this.current_view + '"] a') - .attr("disabled", "disabled") - .addClass("disabled"); - - //enable link for Kanban view - this.sidebar - .find('.list-link[data-view="Kanban"] a, .list-link[data-view="Inbox"] a') - .attr("disabled", null) - .removeClass("disabled"); - - // show image link if image_view - if (this.list_view.meta.image_field) { - this.sidebar.find('.list-link[data-view="Image"]').removeClass("hide"); - show_list_link = true; - } - - if ( - this.list_view.settings.get_coords_method || - (this.list_view.meta.fields.find((i) => i.fieldname === "latitude") && - this.list_view.meta.fields.find((i) => i.fieldname === "longitude")) || - this.list_view.meta.fields.find( - (i) => i.fieldname === "location" && i.fieldtype == "Geolocation" - ) - ) { - this.sidebar.find('.list-link[data-view="Map"]').removeClass("hide"); - show_list_link = true; - } - - if (show_list_link) { - this.sidebar.find('.list-link[data-view="List"]').removeClass("hide"); - } - } - - setup_list_filter() { - this.list_filter = new ListFilter({ - wrapper: this.page.sidebar.find(".list-filters"), - doctype: this.doctype, - list_view: this.list_view, - section_title: this.page.sidebar.find(".save-filter-section .sidebar-label"), - }); - } - - setup_collapsible() { - // tags and save filter sections should be collapsible - let sections = [ - ["tags-section", "list-tags"], - ["save-filter-section", "list-filters"], - ["filter-section", "list-group-by"], - ]; - - for (let s of sections) { - this.page.sidebar.find(`.${s[0]} .sidebar-label`).on("click", () => { - let list_tags = this.page.sidebar.find("." + s[1]); - let icon = "#es-line-down"; - list_tags.toggleClass("hide"); - if (list_tags.hasClass("hide")) { - icon = "#es-line-right-chevron"; - } - this.page.sidebar.find(`.${s[0]} .es-line use`).attr("href", icon); - }); - } - } - - setup_kanban_boards() { - const $dropdown = this.page.sidebar.find(".kanban-dropdown"); - frappe.views.KanbanView.setup_dropdown_in_sidebar(this.doctype, $dropdown); - } - - setup_list_group_by() { - this.list_group_by = new frappe.views.ListGroupBy({ - doctype: this.doctype, - sidebar: this, - list_view: this.list_view, - page: this.page, - }); - } -}; diff --git a/frappe/public/js/frappe/list/list_sidebar_group_by.js b/frappe/public/js/frappe/list/list_sidebar_group_by.js index f3b2c35589..eb890c1ac5 100644 --- a/frappe/public/js/frappe/list/list_sidebar_group_by.js +++ b/frappe/public/js/frappe/list/list_sidebar_group_by.js @@ -2,6 +2,7 @@ frappe.provide("frappe.views"); frappe.views.ListGroupBy = class ListGroupBy { constructor(opts) { + // TODO: move assigned to and owner logic in this file, currently this file is not use $.extend(this, opts); this.make_wrapper(); diff --git a/frappe/public/js/frappe/list/list_view_select.js b/frappe/public/js/frappe/list/list_view_select.js index da818865e2..5a61b1551f 100644 --- a/frappe/public/js/frappe/list/list_view_select.js +++ b/frappe/public/js/frappe/list/list_view_select.js @@ -67,7 +67,7 @@ frappe.views.ListViewSelect = class ListViewSelect { action: () => frappe.set_route("report"), }; } - this.setup_dropdown_in_sidebar("Report", reports, default_action); + this.setup_dropdown_in_navbar("Report", reports, default_action); }, }, Dashboard: { @@ -79,7 +79,7 @@ frappe.views.ListViewSelect = class ListViewSelect { action: () => this.set_route("calendar", "default"), current_view_handler: () => { this.get_calendars().then((calendars) => { - this.setup_dropdown_in_sidebar("Calendar", calendars); + this.setup_dropdown_in_navbar("Calendar", calendars); }); }, }, @@ -99,7 +99,7 @@ frappe.views.ListViewSelect = class ListViewSelect { action: () => frappe.new_doc("Email Account"), }; } - this.setup_dropdown_in_sidebar("Inbox", accounts, default_action); + this.setup_dropdown_in_navbar("Inbox", accounts, default_action); }, }, Image: { @@ -144,7 +144,7 @@ frappe.views.ListViewSelect = class ListViewSelect { }); } - setup_dropdown_in_sidebar(view, items, default_action) { + setup_dropdown_in_navbar(view, items, default_action) { let placeholder = __("Select {0}", [__(view)]); if (items && items.length) { diff --git a/frappe/public/js/list.bundle.js b/frappe/public/js/list.bundle.js index e40ef94a81..54951cd03b 100644 --- a/frappe/public/js/list.bundle.js +++ b/frappe/public/js/list.bundle.js @@ -16,8 +16,6 @@ import "./frappe/list/list_view.js"; import "./frappe/list/list_factory.js"; import "./frappe/list/list_view_select.js"; -import "./frappe/list/list_sidebar.js"; -import "./frappe/list/list_sidebar.html"; import "./frappe/list/list_sidebar_stat.html"; import "./frappe/list/list_sidebar_group_by.js"; import "./frappe/list/list_view_permission_restrictions.html";