Module: BreadcrumbsHelper
- Defined in:
- app/helpers/breadcrumbs_helper.rb
Overview
View helper: breadcrumbs.
Instance Method Summary collapse
-
#breadcrumb_home ⇒ String
Link to the home page.
-
#build_breadcrumb(*args) ⇒ Object
Build breadcrumb navigation with flexible argument support.
Instance Method Details
#breadcrumb_home ⇒ String
Returns link to the home page.
30 31 32 |
# File 'app/helpers/breadcrumbs_helper.rb', line 30 def link_to fa_icon('house'), cms_link('/') end |
#build_breadcrumb(*args) ⇒ Object
Build breadcrumb navigation with flexible argument support
Examples:
build_breadcrumb({ href: images_path, title: 'Images' }, { title: 'Edit Image Uploads' })
build_breadcrumb(@object, 'Edit')
build_breadcrumb('Edit Images Uploads') # Legacy support
build_breadcrumb({ href: customers_path, title: 'Customers' }, @customer, 'Edit')
19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/breadcrumbs_helper.rb', line 19 def (*args) # A trailing Hash is presenter context (only `{ tab: … }` today, read by # BreadcrumbPresenter#build_for_product_line) — but ONLY when it isn't a # segment. Popping unconditionally silently swallowed the last segment of # every `build_breadcrumb(…, { title: 'New' })` call, which is the form the # examples above use and ~39 views rely on. context = args.last.is_a?(Hash) && !segment_hash?(args.last) ? args.pop : {} Crm::BreadcrumbPresenter.new(args, context). end |