roidrage / crumble

How did these breadcrumbs in your Rails application? Oh right, with this plugin!
http://github.com/mattmatt/crumble
74 stars 9 forks source link

Dynamically add additional breadcrumbs #7

Open mooman opened 14 years ago

mooman commented 14 years ago

Hi there,

I have a need to configure breadcrumbs in multiple places dynamically. for example, i have the intended config/initializers/breadcrumbs.rb, which have the Breadcrumb.configure in it. But i also have a need to define breadcrumbs dynamically elsewhere based on some logic. So i call Breadcrumb.configure again and every crumbs defined anywhere else (like the one in config) gets cleared.

I notice that this is due to lines 34 and 35 in crumble/lib/breadcrumb.rb. is there a reason why this needs to be cleared out? i'd like to be able to add more crumbs and use already defined ones dynamically.

Thank you!

roidrage commented 13 years ago

The original idea was to have one place to configure the breadcrumbs, i.e. an initializer, so this feature would be counterintuitive to my original intents with it. I'd be happy to merge a supplied patch though.

mooman commented 13 years ago

Hi mattmatt,

This wouldn't hinder your original intention, i wouldn't think. One can still define it in the initializer and be done with.

this came up because i have a modular system where "plugins" can be added to the system, and those plugins define their own views and so forth, so they will need also a way to specify crumbs, which are not known in advanced by the application.

I am running a modified code without those lines and things seems to work quite well... i'll run tests and send a pull request to get your opinion again.

thanks for the great software!