Class: UiBibz::Ui::Core::Navbar

Inherits:
Component show all
Defined in:
lib/ui_bibz/ui/core/nav/navbar.rb

Overview

Create a Navbar

This element is an extend of UiBibz::Ui::Core::Component.

Attributes

  • content - Content of element

  • options - Options of element

  • html_options - Html Options of element

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

  • type - Symbol (default: :default) (:inverse, :default)

  • glyph

  • position - Symbol (:top, :bottom)

  • title - String

Signatures

UiBibz::Ui::Core::Navbar.new(options = nil, html_options = nil).tap do |nb|
  ...
  nb.nav(options = nil, html_options = nil) do |n|
    n.link content options = nil, html_options = nil, &block
    n.link content options = nil, html_options = nil, &block
  end
  ...
end

Examples

UiBibz::Ui::Core::Navbar.new().tap do |nb|
  nb.nav(position: :right) do |n|
    n.link 'Link 1', "#"
    n.link 'Link 2', "#"
  end
end.render

Helper

navbar(options = { tap: true }, html_options = {}) do |nb|
  nb.nav(options = { tap: true }, html_options = {}) do |n|
    n.link(content, options = {}, html_options = {})
    n.link(options = {}, html_options = {}) do
      content
    end
  end
end

Instance Attribute Summary

Attributes inherited from Component

#content, #html_options, #options

Attributes inherited from Base

#output_buffer

Instance Method Summary (collapse)

Methods inherited from Component

#add_classes, #badge_html, #class_and_html_options, #glyph, #glyph_and_content_html, #glyph_with_space, #options_in_html_options, #state, #states, #status

Methods inherited from Base

#i18n_set?

Constructor Details

- (Navbar) initialize(content = nil, options = nil, html_options = nil, &block)

Returns a new instance of Navbar



59
60
61
62
# File 'lib/ui_bibz/ui/core/nav/navbar.rb', line 59

def initialize content = nil, options = nil, html_options = nil, &block
  super
  @items = []
end

Instance Method Details

- (Object) form(content = nil, options = nil, html_options = nil, &block)



78
79
80
# File 'lib/ui_bibz/ui/core/nav/navbar.rb', line 78

def form content = nil, options = nil, html_options = nil, &block
 # @items << UiBibz::Ui::Core::Form.new(content, options, html_options).tap(&block)
end


73
74
75
76
# File 'lib/ui_bibz/ui/core/nav/navbar.rb', line 73

def nav content = nil, options = nil, html_options = nil, &block
  options = options || {}
  @items << UiBibz::Ui::Core::NavbarNav.new(content, options, html_options).tap(&block).render
end

- (Object) render



64
65
66
67
68
69
70
71
# File 'lib/ui_bibz/ui/core/nav/navbar.rb', line 64

def render
   :nav, class_and_html_options(['navbar', type, position]) do
     :div, class: 'container-fluid' do
      concat header_html
      concat body_html
    end
  end
end

- (Object) text(content = nil, options = nil, html_options = nil, &block)



82
83
84
# File 'lib/ui_bibz/ui/core/nav/navbar.rb', line 82

def text content = nil, options = nil, html_options = nil, &block
 # @items << UiBibz::Ui::Core::Text.new(content, options, html_options).tap(&block)
end