class UiBibz::Ui::Core::Navigations::Toolbar
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.button_group do |bg| bg.ui_button 'test 1' bg.ui_button 'test 2' end bt.button_group do |bg| bg.ui_button 'test 3' bg.ui_button 'test 4' end end.render
Helper¶ ↑
ui_toolbar(options = {}, html_options = {}) do |bt| bt.button_group do |bg| bg.ui_button 'content' bg.ui_button_link 'Link', url: '#' end end
Public Class Methods
new(content = nil, options = nil, html_options = nil, &block)
click to toggle source
See UiBibz::Ui::Core::Component.initialize
Calls superclass method
UiBibz::Ui::Core::Component::new
# File lib/ui_bibz/ui/core/navigations/toolbar.rb, line 58 def initialize(content = nil, options = nil, html_options = nil, &block) super @items = [] end
Public Instance Methods
form(model_or_url, options = {}, &block)
click to toggle source
Add navbar form items See UiBibz::Ui::Core::ToolbarForm
# File lib/ui_bibz/ui/core/navigations/toolbar.rb, line 81 def form(model_or_url, options = {}, &block) @items << UiBibz::Ui::Core::Navigations::ToolbarForm.new(model_or_url, options, &block) end
pre_render()
click to toggle source
Render html tag
# File lib/ui_bibz/ui/core/navigations/toolbar.rb, line 64 def pre_render content_tag :div, @items.map(&:render).join.html_safe, html_options end
spacer(num = 'auto')
click to toggle source
# File lib/ui_bibz/ui/core/navigations/toolbar.rb, line 74 def spacer(num = 'auto') kls = "me-#{num}" @items.last.html_options['class'] = join_classes(@items.last.html_options.delete(:class), @items.last.html_options[:class], kls) end
Private Instance Methods
component_html_classes()
click to toggle source
Calls superclass method
UiBibz::Ui::Core::Component#component_html_classes
# File lib/ui_bibz/ui/core/navigations/toolbar.rb, line 87 def component_html_classes super << ['btn-toolbar', justify] end
component_html_options()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/toolbar.rb, line 91 def component_html_options { role: 'toolbar' } end
justify()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/toolbar.rb, line 95 def justify 'justify-content-between' if options[:justify] end