Module: BreadcrumbsHelper

Defined in:
app/helpers/breadcrumbs_helper.rb

Instance Method Summary collapse

Instance Method Details



22
23
24
# File 'app/helpers/breadcrumbs_helper.rb', line 22

def breadcrumb_home
  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')

Parameters:

  • args (Array)

    Variable number of arguments supporting:

    • Hash with :href and :title for linked breadcrumbs
    • Hash with only :title for active (non-linked) breadcrumbs
    • String for action/title text
    • Objects for automatic breadcrumb generation
    • nil values are ignored


16
17
18
19
20
# File 'app/helpers/breadcrumbs_helper.rb', line 16

def build_breadcrumb(*args)
  # Extract context from the last argument if it's a hash
  context = args.last.is_a?(Hash) ? args.pop : {}
  Crm::BreadcrumbPresenter.new(args, context).breadcrumb
end