문제

So I'm setting up a basic Gretel installation following instructions in https://github.com/lassebunk/gretel.

This is my breadcrumb.rb

crumb :root do
 link 'Root', root_path
end

And this is the code within the show.html.haml (My views are coded in haml)

= breadcrumb :root

And the application.html.haml

= breadcrumbs pretext: "You are here: ", separator: " › "

Now the rendering I got is something like

http://grab.by/uyFW

Any idea what could be going wrong? I was expecting a breadcrumb with the test 'Root'

도움이 되었습니까?

해결책

Replace

= breadcrumb :root
= breadcrumbs pretext: "You are here: ", separator: " › "

with

- breadcrumb :root

= breadcrumbs pretext: "You are here: ", separator: " › "

다른 팁

I was facing the same issue, the only problem in our case that we are trying to see breadcrumbs even for root page.

According to the gem wiki the parameter ":display_single_fragment" is set to false by default. The Parameter is quite self-explanatory.

The code below works as expected:

- breadcrumb :portfolios
= breadcrumbs pretext: "You are here: ", separator: " › ", :autoroot => true, :display_single_fragment => true

for link single link you have to "display_single_fragment" attribute to true in application controller

    <%= breadcrumbs pretext: "current link", display_single_fragment: "true" %>

Change

= breadcrumb :root

to

- breadcrumb :root

Hope it helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top