README.md in gretel-3.0.0.beta3 vs README.md in gretel-3.0.0.beta4

- old
+ new

@@ -15,22 +15,25 @@ Read more about trails below. * Breadcrumbs can now be rendered in different styles like ul- and ol lists, and for use with the [Twitter Bootstrap](http://getbootstrap.com/) framework. See the `:style` option below for more info. * Defining breadcrumbs using `Gretel::Crumbs.layout do ... end` in an initializer has been removed. See below for details on how to upgrade. * The `:show_root_alone` option is now called `:display_single_fragment` and can be used to hide the breadcrumbs when there is only one link, also if it is not the root breadcrumb. The old `:show_root_alone` option is still supported until Gretel version 4.0 and will show a deprecation warning when it's used. +* Links yielded from `<%= breadcrumbs do |links| %>` now have a `current?` helper that returns true if the link is the last in the trail. +* New view helper: `parent_breadcrumb` returns the parent breadcrumb link (with `#key`, `#text`, and `#url`). You can supply options like `:autoroot` etc. + If you supply a block, it will yield the parent breadcrumb if it is present. -I hope you find these changes as useful as I did when I made them – if you have more suggestions, please create an [Issue](https://github.com/lassebunk/gretel/issues) or [Pull Request](https://github.com/lassebunk/gretel/pulls). +I hope you find these changes as useful as I did – if you have more suggestions, please create an [Issue](https://github.com/lassebunk/gretel/issues) or [Pull Request](https://github.com/lassebunk/gretel/pulls). See below for more info or the [changelog](https://github.com/lassebunk/gretel/blob/master/CHANGELOG.md) for less significant changes. Installation ------------ In your *Gemfile*: ```ruby -gem "gretel", "3.0.0.beta2" +gem "gretel", "3.0.0.beta4" ``` And run: ```bash @@ -228,10 +231,25 @@ <% end %> <% end %> <% end %> ``` +Getting the parent breadcrumb +----------------------------- + +If you want to add a link to the parent breadcrumb in the trail, you can use the `parent_breadcrumb` view helper. +By default it returns a link instance that has the properties `#key`, `#text`, and `#url`. +You can supply options like `autoroot: false` etc. + +If you supply a block, it will yield the link if it is present: + +```erb +<% parent_breadcrumb do |parent| %> + <%= link_to "Back to #{link.text}", link.url %> +<% end %> +``` + Setting breadcrumb trails -------------------------------- You can set a breadcrumb trail via `params[:trail]`. This makes it possible to link back to a different breadcrumb trail than the one specified in your breadcrumb. @@ -275,10 +293,10 @@ ### Custom trail param The default trail param is `params[:trail]`. You can change it in an initializer: ```ruby -Gretel::Trail.trail_param = :other_param +Gretel.trail_param = :other_param ``` ### Note Please use the trail functionality with care; the trails can get very long.