Public: List of breadcrumbs encountered in this request. Add to this list any breadcrumb as you go through your routing tree in the app:
Example
define do
breadcrumbs << "Home"
on "users" do
breadcrumbs << "Users"
on get do
# render the list
end
on ":id" do |id|
user = User[id]
breadcrumbs << user.name
# etc
end
end
end
This will automatically build a list with the following breadcrumbs:
[
Migajas::Crumb.new("Home", "/"),
Migajas::Crumb.new("Users", "/users"),
Migajas::Crumb.new("Profile", "/users/5")
]
In the view you can, then:
<% breadcrumbs.each do |crumb| %>
<li class="<%= "active" if crumb.current? %>">
<a href="<%= crumb.url %>"><%= crumb.name %></a>
</li>
<% end %>
Returns a Migajas::Trail
.
def breadcrumbs
migajas_env["app.breadcrumbs"] ||= Trail.new(migajas_env)
end