Class: Matestack::Ui::Bootstrap::Components::Navbar

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

Constant Summary collapse

POS_ATTRIBUTES =
%i[fixed_top fixed_bottom sticky_top]

Instance Method Summary collapse

Instance Method Details

#prepareObject



18
19
20
# File 'lib/matestack/ui/bootstrap/components/navbar.rb', line 18

def prepare
  @toggle = context.toggle.is_a?(Hash) ? context.toggle : { position: context.toggle }
end

#response(&block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/matestack/ui/bootstrap/components/navbar.rb', line 22

def response(&block)
  nav navbar_attributes do
    bs_container size: "#{context.container_size.present? ? context.container_size : "fluid" }" do
      # custom elements for navbar
      if slots && slots[:custom_items]
        slot :custom_items
      else
        toggle_button if @toggle[:position] == :left
        brand_partial
        toggle_button if !@toggle[:position].present? || @toggle[:position] == :right
        navbar_content_partial(&block)
      end
    end
  end
end