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

Inherits:
Component
  • Object
show all
Defined in:
app/concepts/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



15
16
17
# File 'app/concepts/matestack/ui/bootstrap/components/navbar.rb', line 15

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

#responseObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/concepts/matestack/ui/bootstrap/components/navbar.rb', line 19

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