Module: MaquinaComponents::BreadcrumbsHelper
- Defined in:
- app/helpers/maquina_components/breadcrumbs_helper.rb
Overview
Breadcrumbs Helper
Provides helper methods for rendering breadcrumb navigation. Supports both simple hash-based API and composable partials.
Instance Method Summary collapse
-
#breadcrumbs(links = {}, current_page = nil, css_classes: "") ⇒ String
Render breadcrumbs from a hash of links.
-
#responsive_breadcrumbs(links = {}, current_page = nil, css_classes: "", collapse_after: nil) ⇒ String
Render responsive breadcrumbs that auto-collapse on overflow.
Instance Method Details
#breadcrumbs(links = {}, current_page = nil, css_classes: "") ⇒ String
Render breadcrumbs from a hash of links
23 24 25 26 27 28 29 |
# File 'app/helpers/maquina_components/breadcrumbs_helper.rb', line 23 def (links = {}, current_page = nil, css_classes: "") render "components/breadcrumbs", css_classes: css_classes do render "components/breadcrumbs/list" do (links, current_page, responsive: false) end end end |
#responsive_breadcrumbs(links = {}, current_page = nil, css_classes: "", collapse_after: nil) ⇒ String
Render responsive breadcrumbs that auto-collapse on overflow
Uses Stimulus controller to hide middle items when space is limited, showing an ellipsis element instead.
collapse_after is accepted and ignored. It existed only because the width-based collapse never fired -- the last item's flex-shrink absorbed the overflow, so scrollWidth never exceeded clientWidth -- and it compensated by collapsing on item count alone, with no idea how much room there was. Space-based collapsing works now, so a count threshold can only collapse a bar that fits. Still in the signature so existing callers do not raise; drop it in 0.8.0.
55 56 57 58 59 60 61 |
# File 'app/helpers/maquina_components/breadcrumbs_helper.rb', line 55 def (links = {}, current_page = nil, css_classes: "", collapse_after: nil) render "components/breadcrumbs", css_classes: css_classes, responsive: true do render "components/breadcrumbs/list" do (links, current_page, responsive: true) end end end |