ERPNext Conference 2019* ERPNext.com Blog

How to remove breadcrumbs from desk erpnext


#1

Hello guys is there a way to customize the breadcrumbs and remove the explore from breadcrumbs and just start with the modules directly?

Any help will be much appreciated, Thank you.


#2

This is a voluntary forum. Please don’t tag users for help.


ERROR When Install Demo Data
#3

The solution was to add a custom href attribute link for the explore to the page i wanted. This was done by adding a new js file in the public folder of our custom app.
frappe_custom/frappe_custom/public/js/new_nav_bar.js

// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt

$(document).ready(function() {

	//$('.navbar-home').html('FL');
	$('.navbar-home').attr("href", "#dashboard")
	

});

frappe.breadcrumbs.update = function(){
	var breadcrumbs = frappe.breadcrumbs.all[frappe.breadcrumbs.current_page()];

	if(!frappe.visible_modules) {
		frappe.visible_modules = $.map(frappe.get_desktop_icons(true), (m) => { return m.module_name; });
	}

	var $breadcrumbs = $("#navbar-breadcrumbs").empty();
	if(!breadcrumbs) {
		$("body").addClass("no-breadcrumbs");
		return;
	}

	// get preferred module for breadcrumbs, based on sent via module
	var from_module = frappe.breadcrumbs.get_doctype_module(breadcrumbs.doctype);

	if(from_module) {
		breadcrumbs.module = from_module;
	} else if(frappe.breadcrumbs.preferred[breadcrumbs.doctype]!==undefined) {
		// get preferred module for breadcrumbs
		breadcrumbs.module = frappe.breadcrumbs.preferred[breadcrumbs.doctype];
	}

	if(breadcrumbs.doctype && frappe.get_route()[0]==="Form") {
		if(breadcrumbs.doctype==="User"
			&& frappe.user.is_module("Setup")===-1
			|| frappe.get_doc('DocType', breadcrumbs.doctype).issingle) {
			// no user listview for non-system managers and single doctypes
		} else {
			var route;
			if(frappe.boot.treeviews.indexOf(breadcrumbs.doctype) !== -1) {
				var view = frappe.model.user_settings[breadcrumbs.doctype].last_view || 'Tree';
				route = view + '/' + breadcrumbs.doctype;
			} else {
				route = 'List/' + breadcrumbs.doctype;
			}
			$(repl('<li><a href="#%(route)s">%(label)s</a></li>',
				{route: route, label: __(breadcrumbs.doctype)}))
				.appendTo($breadcrumbs);
		}
	}

	$("body").removeClass("no-breadcrumbs");
}