zHaytam / SmartBreadcrumbs

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
https://blog.zhaytam.com/2018/06/24/asp-net-core-using-smartbreadcrumbs/
MIT License
161 stars 77 forks source link

More than one DefaultBreadcrumb or option to hide it #31

Closed rutenio closed 5 years ago

rutenio commented 5 years ago

Hello, Is it possible to add more than one DefaultBreadcrumb or hide it with some option? I'm in a scenario where the application has 4 modules for different user groups (departments). A "Home" option is not very feasible since once you access the system in your specific module, it will hardly change the module because you would not have permissions to do so. Ideally each module would have its "Home"

zHaytam commented 5 years ago

Hi, how would you know which default breadcrumb to use? I'm asking so that we brainstorm an idea.

rutenio commented 5 years ago

I thought DefaultBreadcrumb is used as root only if a "Root" is not defined. Something in this drawing. You would have to create the "Root" option. Or a bool for "UseRoot", if false (Default = true) the path starts from the current point.

zHaytam commented 5 years ago

Basically an option where if true, the check for a default breadcrumb is removed? I guess if developers use this options they need to take responsibility, hum..

rutenio commented 5 years ago

I think that currently you already check all the path according to FromAction and FromController. So you mount the path to the source. The only difference is that if the last object does not have these parameters defined it still has the option "UseAsRoot" = true (maybe it makes more sense), it becomes the first breadcrumb item

zHaytam commented 5 years ago

I added an option DontLookForDefaultNode in 2.1.0. If you set it to true (in services.AddBreadcrumbs(assembly, options => { ... }) then it won't check for the default node (and it won't use it neither), this means you'll always need to be sure that the last node in your path is the one you actually want to be first.

rutenio commented 5 years ago

Thanks, man!