Class: UiBibz::Ui::Core::Navigations::Toolbar
- Includes:
- UiBibz::Ui::Concerns::HtmlConcern
- Defined in:
- lib/ui_bibz/ui/core/navigations/toolbar.rb
Overview
Create a toolbar
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:
-
status
- status of element withsymbol
value: (:primary
,:secondary
,:info
,:warning
,:danger
) -
size
- Size of element withsymbol
value: (:xs
,:sm
,:lg
) -
position
- Position vertical or horizontal withsymbol
value: (:vertical
,:horizontal
)
Signatures
UiBibz::Ui::Core::Navigations::Toolbar.new(options = nil, html_options = nil) do |bt|
...
end
Examples
UiBibz::Ui::Core::Navigations::Toolbar.new(status: :primary, size: :xs) do |bt|
bt. do |bg|
bg. 'test 1'
bg. 'test 2'
end
bt. do |bg|
bg. 'test 3'
bg. 'test 4'
end
end.render
Helper
( = {}, = {}) do |bt|
bt. do |bg|
bg. 'content'
bg. 'Link', url: '#'
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
- #button_group(cont = nil, opt = nil, hopt = nil, &block) ⇒ Object
-
#form(model_or_url, options = {}, &block) ⇒ Object
Add navbar form items See UiBibz::Ui::Core::ToolbarForm.
-
#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ Toolbar
constructor
See UiBibz::Ui::Core::Component.initialize.
-
#pre_render ⇒ Object
Render html tag.
- #spacer(num = 'auto') ⇒ Object
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) ⇒ Toolbar
See UiBibz::Ui::Core::Component.initialize
58 59 60 61 |
# File 'lib/ui_bibz/ui/core/navigations/toolbar.rb', line 58 def initialize(content = nil, = nil, = nil, &block) super @items = [] end |
Instance Method Details
#button_group(cont = nil, opt = nil, hopt = nil, &block) ⇒ Object
68 69 70 71 72 |
# File 'lib/ui_bibz/ui/core/navigations/toolbar.rb', line 68 def (cont = nil, opt = nil, hopt = nil, &block) cont = @options.merge(cont || {}) (cont || {}).delete(:class) @items << UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(cont, opt, hopt).tap(&block) end |
#form(model_or_url, options = {}, &block) ⇒ Object
Add navbar form items See UiBibz::Ui::Core::ToolbarForm
81 82 83 |
# File 'lib/ui_bibz/ui/core/navigations/toolbar.rb', line 81 def form(model_or_url, = {}, &block) @items << UiBibz::Ui::Core::Navigations::ToolbarForm.new(model_or_url, , &block) end |
#pre_render ⇒ Object
Render html tag
64 65 66 |
# File 'lib/ui_bibz/ui/core/navigations/toolbar.rb', line 64 def pre_render content_tag :div, @items.map(&:render).join.html_safe, end |
#spacer(num = 'auto') ⇒ Object
74 75 76 77 |
# File 'lib/ui_bibz/ui/core/navigations/toolbar.rb', line 74 def spacer(num = 'auto') kls = "me-#{num}" @items.last.['class'] = join_classes(@items.last..delete(:class), @items.last.[:class], kls) end |