Class: UiBibz::Ui::Core::Navbar
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
( = { tap: true }, = {}) do |nb|
nb.nav( = { tap: true }, = {}) do |n|
n.link(content, = {}, = {})
n.link( = {}, = {}) do
content
end
end
end
Instance Attribute Summary
Attributes inherited from Component
#content, #html_options, #options
Attributes inherited from Base
Instance Method Summary (collapse)
- - (Object) form(content = nil, options = nil, html_options = nil, &block)
-
- (Navbar) initialize(content = nil, options = nil, html_options = nil, &block)
constructor
A new instance of Navbar.
- - (Object) nav(content = nil, options = nil, html_options = nil, &block)
- - (Object) render
- - (Object) text(content = nil, options = nil, html_options = nil, &block)
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
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, = nil, = 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, = nil, = nil, &block # @items << UiBibz::Ui::Core::Form.new(content, options, html_options).tap(&block) end |
- (Object) nav(content = nil, options = nil, html_options = nil, &block)
73 74 75 76 |
# File 'lib/ui_bibz/ui/core/nav/navbar.rb', line 73 def nav content = nil, = nil, = nil, &block = || {} @items << UiBibz::Ui::Core::NavbarNav.new(content, , ).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 content_tag :nav, (['navbar', type, position]) do content_tag :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, = nil, = nil, &block # @items << UiBibz::Ui::Core::Text.new(content, options, html_options).tap(&block) end |