README.md in gretel-3.0.2 vs README.md in gretel-3.0.3
- old
+ new
@@ -113,16 +113,17 @@
### Styles
These are the styles you can use with `breadcrumbs style: :xx`.
-Style | Description
------------- | -----------
-`:default` | Renders each link by itself with `›` as the seperator.
-`:ol` | Renders the links in `<li>` elements contained in an outer `<ol>`.
-`:ul` | Renders the links in `<li>` elements contained in an outer `<ul>`.
-`:bootstrap` | Renders the links for use in [Twitter Bootstrap](http://getbootstrap.com/).
+Style | Description
+-------------- | -----------
+`:default` | Renders each link by itself with `›` as the seperator.
+`:ol` | Renders the links in `<li>` elements contained in an outer `<ol>`.
+`:ul` | Renders the links in `<li>` elements contained in an outer `<ul>`.
+`:bootstrap` | Renders the links for use in [Twitter Bootstrap](http://getbootstrap.com/).
+`:foundation5` | Renders the links for use in [Foundation 5](http://foundation.zurb.com/).
Or you can build the breadcrumbs manually for full customization; see below.
If you add other widely used styles, please submit a [Pull Request](https://github.com/lassebunk/gretel/pulls) so others can use them too.
@@ -236,11 +237,11 @@
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| %>
+<% parent_breadcrumb do |link| %>
<%= link_to "Back to #{link.text}", link.url %>
<% end %>
```
## Nice to know
@@ -252,10 +253,15 @@
### Using multiple breadcrumb configuration files
If you have a large site and you want to split your breadcrumbs configuration over multiple files, you can create a folder named `config/breadcrumbs` and put your configuration files (e.g. `products.rb` or `frontend.rb`) in there.
The format is the same as `config/breadcrumbs.rb` which is also loaded.
+### Loading breadcrumbs from engines
+
+Breadcrumbs are automatically loaded from any engines' `config/breadcrumbs.rb` and `config/breadcrumbs/**/*.rb`.
+Breadcrumbs defined in your main app will override breadcrumbs from engines.
+
### Inferring breadcrumbs
Breadcrumbs can be automatically inferred if you pass an instance of an object that responds to `model_name` (like an ActiveRecord model instance).
For example:
@@ -266,9 +272,36 @@
is short for
```erb
<% breadcrumb :product, @product %>
+```
+
+### Passing options to links
+
+You can pass options to links to be used when you render breadcrumbs manually.
+
+In *config/breadcrumbs.rb*:
+
+```ruby
+crumb :something do
+ link "My Link", my_path, title: "My Title", other: "My Other Option"
+end
+```
+
+Example methods you can then use in the view:
+
+```ruby
+breadcrumbs do |links|
+ links.each do |link|
+ link.title? # => true
+ link.title # => "My Title"
+ link.other? # => true
+ link.other # => "My Other Option"
+ link.nonexisting_option? # => false
+ link.nonexisting_option # => nil
+ end
+end
```
### Automatic reloading of breadcrumb configuration files
Since Gretel version 2.1.0, the breadcrumb configuration files are now reloaded in the Rails development environment if they change. In other environments, like production, the files are loaded once, when first needed.