Comments (9)
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
Maths (that's the heading)
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.
from gretel.
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 :)
from gretel.
Hmm, I see that.
I think I'll disable it altogether. I think the only place this is actually used is in the gretel-trails gem, so I think it it should actually go there.
Thanks for pointing to this.
from gretel.
Thanks Lasse :) I'm continually amazed at how much simpler gretel is to my
previous attempts at breadcrumbs! I'm re-writing my product from scratch
and it's saving so much time :)
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 [email protected]:
Hmm, I see that.
I think I'll disable it alltogether. I think the only place this is
actually used is in the gretel-trails http://lassebunk/gretel-trailsgem, so I think it it should actually go there.
Thanks for pointing to this.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-30971159
.
from gretel.
Okay, glad to hear you like it.
Maybe wait a bit on the test helpers as I'm not sure about the
implementation. Think it's too messy and unlogical so I think I'll revert
it and do something else.
Thanks, and merry Christmas :-)
fredag den 20. december 2013 skrev Brendon Muir :
Thanks Lasse :) I'm continually amazed at how much simpler gretel is to my
previous attempts at breadcrumbs! I'm re-writing my product from scratch
and it's saving so much time :)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 <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>wrote:
Hmm, I see that.
I think I'll disable it alltogether. I think the only place this is
actually used is in the gretel-trails http://lassebunk/gretel-trailsgem,
so I think it it should actually go there.
Thanks for pointing to this.—
Reply to this email directly or view it on GitHub<
https://github.com/lassebunk/gretel/issues/28#issuecomment-30971159>
.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-30981848
.
from gretel.
Thanks Lasse :) Hope you had a good holiday!
On Fri, Dec 20, 2013 at 2:11 PM, Lasse Bunk [email protected]:
Okay, glad to hear you like it.
Maybe wait a bit on the test helpers as I'm not sure about the
implementation. Think it's too messy and unlogical so I think I'll revert
it and do something else.Thanks, and merry Christmas :-)
fredag den 20. december 2013 skrev Brendon Muir :
Thanks Lasse :) I'm continually amazed at how much simpler gretel is to
my
previous attempts at breadcrumbs! I'm re-writing my product from scratch
and it's saving so much time :)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 <[email protected]<javascript:_e({},
'cvml', '[email protected]');>>wrote:Hmm, I see that.
I think I'll disable it alltogether. I think the only place this is
actually used is in the gretel-trails http://lassebunk/gretel-trailsgem,so I think it it should actually go there.
Thanks for pointing to this.
—
Reply to this email directly or view it on GitHub<
https://github.com/lassebunk/gretel/issues/28#issuecomment-30971159>
.—
Reply to this email directly or view it on GitHub<
https://github.com/lassebunk/gretel/issues/28#issuecomment-30981848>
.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-30982033
.
from gretel.
Thanks – it was good :-)
from gretel.
Hi, Lasse!
Thanks for the neat gem :-) Is there any issues with related PR? I have similar layout with @brendon and prefer using header to stress current crumb too. It would be nice to have proposed option.
from gretel.
Hi Eugene, in the meantime you can use my fork and branch if you like.
Lasse is going to remove the feature anyway but this gets around it in the
meantime:
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 [email protected]:
Hi, Lasse!
Thanks for the neat gem :-) Is there any issues with related PR? I have
similar layout with @brendon https://github.com/brendon and prefer
using header to stress current crumb too. It would be nice to have proposed
option.Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-33466692
.
from gretel.
Related Issues (20)
- Status of the project HOT 9
- Add a screenshot of a generated breadcrumb to the README.md HOT 2
- Nullable parent for specific crumb HOT 5
- Bootstrap 4 HOT 2
- is this thread-safe? HOT 4
- current tag link is relative to the route not the url provided? HOT 2
- alias_method_chain is deprecated in Rails 5 HOT 10
- using jRuby yields uninitialized constant error HOT 1
- Using tap instead breadcrumbs blocks HOT 4
- Add examples page to dummy rails application?
- breadcrumbs not accepting any arguments HOT 3
- Could you release a new version? HOT 3
- Foundation 6 support ? HOT 1
- Support of I18n HOT 2
- Do not depend on "rails" gem, depend on parts of Rails that Gretel uses HOT 2
- Update `Building the breadcrumbs manually` example HOT 1
- Outside Div HOT 1
- Specify class for link HOT 3
- Add breadcrumbs in controller actions
- Subtle test order dependency when mixing Gretel breadcrumbs with TrailBlazer Cells HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gretel.