lassebunk/gretel — Issue #9: Option for separator at end of crumbs
Author: carlivar
Created: 2012-01-31 05:54:56+00:00
State: open

I like to have my crumbs look like this:

Home > Category > Subcategory >

Page Title

Or such. I like that last greater-than sign at the end.

I can't just put this in application.html.erb because if there are no crumbs on a particular page, the ">" is there by itself (I don't show root breadcrumb).

Anyway, I overrode the breadcrumbs method to allow for a 'posttext' option. Sorry, I'd submit this in a git way, but I'm still a git newbie.

```ruby
module Gretel
module HelperMethods
def breadcrumb(*args)
options = args.extract_options!
name, object = args[0], args[1]

if name
@_breadcrumb_name = name
@_breadcrumb_object = object
else
if @_breadcrumb_name
crumb = breadcrumb_for(@_breadcrumb_name, @_breadcrumb_object, options)
elsif options[:show_root_alone]
crumb = breadcrumb_for(:root, options)
end
end

if crumb && options[:pretext]
crumb = options[:pretext].html_safe + " " + crumb
end

if crumb && options[:posttext]
crumb = crumb + " " + options[:posttext].html_safe
end

crumb
end
end
end
```