Class: UiBibz::Ui::Core::NavDropdown

Inherits:
Dropdown show all
Defined in:
lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb

Overview

Create a dropdown

This element is an extend of UiBibz::Ui::Core::Component. You can use tap method to add list items.

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:

  • state - State of élement with symbol value: (:default, :primary, :info, :warning, :danger)

  • size (:xs, :sm, :lg)

  • glyph - Add glyph with name or hash options

    • name - String

    • size - Integer

    • type - Symbol

Signatures

UiBibz::Ui::Core::NavDropdown.new(options = nil, html_options = nil).tap do |d|
  ...
  d.list content = nil, options = nil, html_options = nil, &block
  d.list content = nil, options = nil, html_options = nil, &block
  d.list content = nil, options = nil, html_options = nil, &block
  ...
end

Examples

UiBibz::Ui::Core::NavDropdown.new(name, state: :success).tap do |d|
  d.list link_to('test', '#')
  d.list link_to('test2', '#')
end.render

Instance Attribute Summary

Attributes inherited from Component

#content, #html_options, #options

Attributes inherited from Base

#output_buffer

Instance Method Summary (collapse)

Methods inherited from Dropdown

#divider, #header, #html, #link

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

#i18n_set?

Constructor Details

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

See UiBibz::Ui::Core::Component.initialize



47
48
49
# File 'lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb', line 47

def initialize content, options = nil, html_options  = nil, &block
  super
end

Instance Method Details

- (Object) render

Render html tag



52
53
54
55
56
57
# File 'lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb', line 52

def render
   :li, class_and_html_options(type) do
    concat link_html
    concat ul_html
  end
end