Class: Matestack::Ui::Bootstrap::Components::Breadcrumb

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/matestack/ui/bootstrap/components/breadcrumb.rb

Instance Method Summary collapse

Instance Method Details

#responseObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/matestack/ui/bootstrap/components/breadcrumb.rb', line 9

def response
  nav class: context.nav_class, "aria-label": "breadcrumb" do
    ol breadcrumb_attributes do
      context.items&.each_with_index do |item, index|
        li link_attrs((context.items.size - 1) == index) do
          case item[:type]
          when :link
            a item
          when :transition
            transition item
          else
            plain item[:text]
          end
        end
      end
      yield if block_given?
    end
  end
end