fix: Allow overriding breadcrumbs modules

Some modules like Core, Email, Automation are shown in the Settings
module. This change will allow apps to define which module the original
module should map to.
This commit is contained in:
Faris Ansari 2019-07-10 18:48:21 +05:30
parent 5f1d0f3d2b
commit b2764ca4dc
2 changed files with 13 additions and 3 deletions

View file

@ -11,6 +11,16 @@ frappe.breadcrumbs = {
"Dashboard Chart Source": "Customization",
},
module_map: {
'Core': 'Settings',
'Email': 'Settings',
'Custom': 'Settings',
'Workflow': 'Settings',
'Printing': 'Settings',
'Automation': 'Settings',
'Setup': 'Settings',
},
set_doctype_module: function(doctype, module) {
localStorage["preferred_breadcrumbs:" + doctype] = module;
},
@ -73,8 +83,8 @@ frappe.breadcrumbs = {
}
if(breadcrumbs.module) {
if(in_list(["Core", "Email", "Custom", "Workflow", "Print"], breadcrumbs.module)) {
breadcrumbs.module = "Setup";
if (frappe.breadcrumbs.module_map[breadcrumbs.module]) {
breadcrumbs.module = frappe.breadcrumbs.module_map[breadcrumbs.module];
}
if(frappe.get_module(breadcrumbs.module)) {

View file

@ -62,7 +62,7 @@ frappe.views.TreeView = Class.extend({
this.page = this.parent.page;
frappe.container.change_to(this.page_name);
frappe.breadcrumbs.add(me.opts.breadcrumb || locals.DocType[me.doctype].module);
frappe.breadcrumbs.add(me.opts.breadcrumb || locals.DocType[me.doctype].module, me.doctype);
this.set_title();