class Trestle::Toolbar::Item
Attributes
label[R]
Public Class Methods
new(template, label, options={}, &block)
click to toggle source
# File lib/trestle/toolbar/item.rb, line 8 def initialize(template, label, options={}, &block) @template = template @label, @options, @block = label, options @menu = Menu.new(template) @menu.build(&block) if block_given? @icon = options.delete(:icon) @style = options.delete(:style) end
Public Instance Methods
==(other)
click to toggle source
# File lib/trestle/toolbar/item.rb, line 19 def ==(other) to_s == other.to_s end
options()
click to toggle source
# File lib/trestle/toolbar/item.rb, line 44 def options @options.merge(class: button_classes) end
render()
click to toggle source
# File lib/trestle/toolbar/item.rb, line 33 def render raise NotImplementedError end
to_s()
click to toggle source
# File lib/trestle/toolbar/item.rb, line 23 def to_s if menu.items.any? content_tag(:div, class: "btn-group", role: "group") do safe_join([render, render_menu], "\n") end else render end end