-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting the last link as the current url #28
Comments
Just following this up. Perhaps I'm using the gem wrong but this is what I'm doing: crumb :site_settings do
link "Site Settings", edit_admin_site_settings_path
end
crumb :theme do |theme|
parent :site_settings
end
crumb :theme_assets do |theme|
parent :site_settings
end
crumb :users_and_groups do
link "Users & Groups", admin_users_path
end
crumb :user do
parent :users_and_groups
end
crumb :group do
parent :users_and_groups
end
crumb :component_instance do |component_instance|
parent :parent_component_instance, component_instance.parent if component_instance.parent
end
crumb :parent_component_instance do |parent_component_instance|
parent_component_instance.self_and_ancestors.each do |component_instance|
link component_instance.name, [:admin, component_instance]
end
end Then this is my renderer: - breadcrumbs(:display_single_fragment => true, :link_current => true) do |links|
- if links.any?
%ul.breadcrumb
- links.each do |link|
%li
= link_to link.text, link.url
%span.divider > I think I might have mentioned this before but I just use the page heading as the 'current breadcrumb' so it looks like Home > Classrooms > Room 1 I find it more flexible. It also more easily allows for multiple actions per object (i.e. see :user and :group - the new and edit actions render nicely because the page title is say 'Edit User' and the crumbs just point to the parent (:users_and_groups). If there's another way to code up what I'm trying to achieve I'd be happy to give it a try :) I thought I could probably code around this by putting blank links for each crumb and then not rendering the last link in the array in my custom renderer but this seems messy. I'll see if I can make a patch that allows the feature to be turned off. |
This seems to do the trick though: #29 It leaves your default behaviour in place but allows one to disable it. Added a test for it too :) |
Hmm, I see that. |
Thanks Lasse :) I'm continually amazed at how much simpler gretel is to my I've still yet to test your test helpers but will report back when I do. Merry Christmas! Brendon On Fri, Dec 20, 2013 at 11:06 AM, Lasse Bunk notifications@github.comwrote:
|
Okay, glad to hear you like it. Maybe wait a bit on the test helpers as I'm not sure about the Thanks, and merry Christmas :-) fredag den 20. december 2013 skrev Brendon Muir :
|
Thanks Lasse :) Hope you had a good holiday! On Fri, Dec 20, 2013 at 2:11 PM, Lasse Bunk notifications@github.comwrote:
|
Thanks – it was good :-) |
Hi, Lasse! |
Hi Eugene, in the meantime you can use my fork and branch if you like. https://github.com/brendon/gretel/tree/Optionall-re-link-last-crumb-to-current-url On Tue, Jan 28, 2014 at 11:29 PM, Eugene Hlyzov notifications@github.comwrote:
|
Hi Lasse :)
I'm having trouble with this code:
https://github.com/lassebunk/gretel/blob/master/lib/gretel/link_renderer.rb#L80
where it sets the link of the last crumb to be that of the current url. Is there a way to turn this off? I don't display a crumb for the current page so this overwrites what I intend to be the link for the parent crumb.
The text was updated successfully, but these errors were encountered: