Coder Social home page Coder Social logo

Comments (9)

brendon avatar brendon commented on August 20, 2024

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.

brendon avatar brendon commented on August 20, 2024

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.

lassebunk avatar lassebunk commented on August 20, 2024

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.

brendon avatar brendon commented on August 20, 2024

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.

lassebunk avatar lassebunk commented on August 20, 2024

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.

brendon avatar brendon commented on August 20, 2024

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.

lassebunk avatar lassebunk commented on August 20, 2024

Thanks – it was good :-)

from gretel.

ehlyzov avatar ehlyzov commented on August 20, 2024

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.

brendon avatar brendon commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.