Lesson 4 — Breadcrumb
Breadcrumbs help users understand where they are in the app hierarchy. KanbanFlow needs them on the board show page and will need them on card detail pages in later modules.
|
|
Note: The vanish configuration pattern again. Breadcrumb uses the same approach as Table — vanish(&) yields the block early to collect configuration (the list of items) before any HTML is rendered. Each item call pushes to @items and returns nil, so nothing reaches the buffer during the vanish phase. The items are then used to render the nav in a single pass. This pattern is worth recognising: whenever a component needs to collect an ordered list of declarative inputs before rendering, vanish + a collection method is the right tool.
Usage in Views::Boards::Show:
|
|
The last item has no url: — it renders as plain text since it
represents the current page. All previous items render as links.
Add a Lookbook preview:
|
|
Update Views::Boards::Show to include the breadcrumb:
|
|