Module: Proscenium::UI::Breadcrumbs::Control::ClassMethods

Defined in:
lib/proscenium/ui/breadcrumbs/control.rb

Instance Method Summary collapse

Instance Method Details

#add_breadcrumb(name, path = nil, **filter_options) ⇒ Object

Appends a new breadcrumb element into the collection.

Parameters:

  • name (String, Symbol, Proc, #for_breadcrumb)

    The name or content of the breadcrumb.

  • path (String, Symbol, Array, Proc, nil) (defaults to: nil)

    The path (route) to use as the HREF for the breadcrumb.

  • filter_options (Hash)

    Options to pass through to the before_action filter.



22
23
24
25
26
27
28
# File 'lib/proscenium/ui/breadcrumbs/control.rb', line 22

def add_breadcrumb(name, path = nil, **filter_options)
  element_options = filter_options.delete(:options) || {}

  before_action(filter_options) do |controller|
    controller.send :add_breadcrumb, name, path, element_options
  end
end

#prepend_breadcrumb(name, path = nil, **filter_options) ⇒ Object

Prepend a new breadcrumb element into the collection.

Parameters:

  • name (String, Symbol, Proc, #for_breadcrumb)

    The name or content of the breadcrumb.

  • path (String, Symbol, Array, Proc, nil) (defaults to: nil)

    The path (route) to use as the HREF for the breadcrumb.

  • filter_options (Hash)

    Options to pass through to the before_action filter.



36
37
38
39
40
41
42
# File 'lib/proscenium/ui/breadcrumbs/control.rb', line 36

def prepend_breadcrumb(name, path = nil, **filter_options)
  element_options = filter_options.delete(:options) || {}

  before_action(filter_options) do |controller|
    controller.send :prepend_breadcrumb, name, path, element_options
  end
end