Class: UiBibz::Ui::Core::Nav
Overview
Create a nav
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 (:pills, :tab)
Signatures
UiBibz::Ui::Core::Nav.new(content, options = nil, html_options = nil)
UiBibz::Ui::Core::Nav.new(options = nil, html_options = nil).tap do |n|
...
n.link content = nil, options = nil, html_options = nil, block
n.link content = nil, options = nil, html_options = nil, block
n.dropdown content = nil, options = nil, html_options = nil, block
...
end
Examples
UiBibz::Ui::Core::Nav.new(type: :pills).tap do |n|
n.link 'Test', url: '#test'
n.link 'Test2', url: '#test2', status: :active
n.dropdown('Action') do |d|
d.list content = nil, = nil, = nil, &block
end
end.render
Helper
nav( = { tap: true }, = {}) do |n|
n.link(content, = {}, = {})
n.link( = {}, = {}) do
content
end
n.dropdown(name, = {}, = {}) do |d|
d.list(content, = {}, = {})
d.list( = {}, = {}) do
content
end
end
end
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Component
#content, #html_options, #options
Attributes inherited from Base
Instance Method Summary (collapse)
-
- (Object) dropdown(content = nil, options = {}, html_options = nil, &block)
Add nav dropdown items See UiBibz::Ui::Core::NavDropdown.
-
- (Nav) initialize(content = nil, options = nil, html_options = nil, &block)
constructor
See UiBibz::Ui::Core::Component.initialize.
-
- (Object) link(content = nil, options = {}, html_options = nil, &block)
Add nav link items See UiBibz::Ui::Core::NavLink.
-
- (Object) render
Render html tag.
Methods inherited from Component
#add_classes, #badge_html, #class_and_html_options, #glyph, #glyph_and_content_html, #glyph_with_space, #state
Methods inherited from Base
Constructor Details
- (Nav) initialize(content = nil, options = nil, html_options = nil, &block)
See UiBibz::Ui::Core::Component.initialize
62 63 64 65 |
# File 'lib/ui_bibz/ui/core/nav/nav.rb', line 62 def initialize content = nil, = nil, = nil, &block super @items = [] end |
Instance Method Details
- (Object) dropdown(content = nil, options = {}, html_options = nil, &block)
Add nav dropdown items See UiBibz::Ui::Core::NavDropdown
80 81 82 |
# File 'lib/ui_bibz/ui/core/nav/nav.rb', line 80 def dropdown content = nil, = {}, = nil, &block @items << NavDropdown.new(content, , ).tap(&block).render end |
- (Object) link(content = nil, options = {}, html_options = nil, &block)
Add nav link items See UiBibz::Ui::Core::NavLink
74 75 76 |
# File 'lib/ui_bibz/ui/core/nav/nav.rb', line 74 def link content = nil, = {}, = nil, &block @items << NavLink.new(content, .merge({ nav_type: type }), , &block).render end |
- (Object) render
Render html tag
68 69 70 |
# File 'lib/ui_bibz/ui/core/nav/nav.rb', line 68 def render content_tag :ul, @items.join.html_safe, (["nav", type, position]) end |