weppos / breadcrumbs_on_rails

A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
https://simonecarletti.com/code/breadcrumbs-on-rails
MIT License
944 stars 188 forks source link

breadcrumb trail is reset across controller boundaries #26

Closed roscom closed 12 years ago

roscom commented 12 years ago

I am trying out the gem.

Noticed that the trail seems to be within controller; that is, it resets when navigating to a new controller thus destroying the trail.

Using: breadcrumbs_on_rails (2.2.0) / rails 3.0.12 / ruby1.8.7-p358.

Would appreciate advice.

Regards

weppos commented 12 years ago

I'm sorry, but I didn't understand the issue.

roscom commented 12 years ago

Sorry. PagesController excerpt:

class PagesController < ApplicationController

add_breadcrumb "home", :root_path

def aboutus @title = 'About Us' @wire_frames = %w(08) add_breadcrumb bc_title, page_url end

def contactus @title = 'Contact Us' @wire_frames = %w(07) add_breadcrumb bc_title, page_url end ..........

Case #1 Navigating from page to page will always render the breadcrumb trail as "Home > [current page]"; not "Home > page >next page > next page". You could say that is reasonable behaviour.

Case #2 If I navigate to another controller, say, "JobsController" all I get is the first add_breadcrumb from the jobs controller action and no prior breadcrumb history from the pages controller.

Clearly I am doing something wrong else I wouldn't have confused you. Is that how it is supposed to work, maybe? Or have I misunderstood something.

And I appreciate your help.

Ross

weppos commented 12 years ago

Breadcrumb navigation is intended to display current navigation status, not hold user navigation history. If the user requested JobsController#index, why would you display the breadcrumb navigation for PagesController#contact?

roscom commented 12 years ago

Yes, perhaps a bad example. I think I may have the wrong understanding of the gem's purpose. Can you point to an example where it is deployed as you intended?

weppos commented 12 years ago

I don't have any public example. However, if you search for breadcrumbs_on_rails, there should be a few examples. https://github.com/search?utf8=%E2%9C%93&q=breadcrumbs_on_rails&type=Everything&repo=&langOverride=&start_value=1