Class: Trestle::Toolbar::Link

Inherits:
Item
  • Object
show all
Defined in:
lib/trestle/toolbar/item.rb

Instance Attribute Summary collapse

Attributes inherited from Item

#label, #menu

Instance Method Summary collapse

Methods inherited from Item

#==, #button_classes, #button_label, #button_style, #button_style_classes, #options, #render_menu, #to_s

Constructor Details

#initialize(template, label, instance_or_url = nil, **options, &block) ⇒ Link

Returns a new instance of Link.



79
80
81
82
# File 'lib/trestle/toolbar/item.rb', line 79

def initialize(template, label, instance_or_url=nil, **options, &block)
  super(template, label, **options, &block)
  @instance_or_url = instance_or_url
end

Instance Attribute Details

#instance_or_urlObject (readonly)

Returns the value of attribute instance_or_url.



77
78
79
# File 'lib/trestle/toolbar/item.rb', line 77

def instance_or_url
  @instance_or_url
end

Instance Method Details

#renderObject



84
85
86
# File 'lib/trestle/toolbar/item.rb', line 84

def render
  admin_link_to(button_label(label, options), instance_or_url, **options)
end