Class: UiBibz::Ui::Core::Lists::ListGroup
- Includes:
- UiBibz::Ui::Concerns::HtmlConcern
- Defined in:
- lib/ui_bibz/ui/core/lists/list_group.rb
Overview
Create a list group
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:
-
flush- Boolean -
tag_type- Type of list (default: :li) (:a,:button,:li)
Signatures
UiBibz::Ui::Core::ListGroup.new.tap |lg|
...
lg.list content = nil, = nil, = nil, &block
...
end
Examples
UiBibz::Ui::Core::ListGroup.new.tap do |d|
d.list 'Test', status: :success
d.list 'Test2', status: :primary
end.render
UiBibz::Ui::Core::ListGroup.new(tag_type: :li).tap do |d|
d.list 'Test', status: :success, url: '#test'
d.list(status: :primary) do
'Test 2'
end
d.list(state: :active) do |l|
l.header 'My title', nil, class: 'my-title'
l.body do
'My content'
end
end
end.render
Helper
list_group( = {}, = {}) do |l|
l.list(content, = {}, = {})
l.list( = {}, = {}) do
content
end
l.list( = {}, = {}) do |li|
li.header(content, = {}, = {})
# or
li.header( = {}, = {}) do
content
end
li.body(content, = {}, = {})
# or
li.body( = {}, = {}) do
content
end
end
end
Direct Known Subclasses
Constant Summary
Constants inherited from Component
Component::BREAKPOINTS, Component::SIZES, Component::STATUSES
Instance Attribute Summary
Attributes inherited from Component
#content, #html_options, #options
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ ListGroup
constructor
See UiBibz::Ui::Core::Component.initialize.
-
#list(content = nil, options = {}, html_options = nil, &block) ⇒ Object
Add group list See UiBibz::Ui::Core::List.
-
#pre_render ⇒ Object
Render html tag.
Methods inherited from Component
Methods included from PopoverExtension
#popover_data_html, #tooltip_data_html
Methods included from GlyphExtension
#generate_glyph, #glyph_and_content_html
Methods included from KlassExtension
#exclude_classes, #exclude_classes_in_html_options, #join_classes, #status
Methods inherited from Base
#generate_id, #i18n_set?, #inject_url
Constructor Details
#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ ListGroup
See UiBibz::Ui::Core::Component.initialize
77 78 79 80 |
# File 'lib/ui_bibz/ui/core/lists/list_group.rb', line 77 def initialize(content = nil, = nil, = nil, &block) super @lists = [] end |
Instance Method Details
#list(content = nil, options = {}, html_options = nil, &block) ⇒ Object
Add group list See UiBibz::Ui::Core::List
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ui_bibz/ui/core/lists/list_group.rb', line 89 def list(content = nil, = {}, = nil, &block) = .merge({ tag_type: [:tag_type] }) unless [:tag_type].nil? @lists << if tapped?(block) content = (content || {}).merge() UiBibz::Ui::Core::Lists::Components::List.new(content, , ).tap(&block).render else UiBibz::Ui::Core::Lists::Components::List.new(content, , , &block).render end end |
#pre_render ⇒ Object
Render html tag
83 84 85 |
# File 'lib/ui_bibz/ui/core/lists/list_group.rb', line 83 def pre_render content_tag tag_type, @lists.join.html_safe, end |