class Trestle::Toolbar::Link

Attributes

instance_or_url[R]

Public Class Methods

new(template, label, instance_or_url={}, options={}, &block) click to toggle source
Calls superclass method Trestle::Toolbar::Item::new
# File lib/trestle/toolbar/item.rb, line 80
def initialize(template, label, instance_or_url={}, options={}, &block)
  if instance_or_url.is_a?(Hash)
    super(template, label, instance_or_url, &block)
  else
    super(template, label, options, &block)
    @instance_or_url = instance_or_url
  end
end

Public Instance Methods

render() click to toggle source
# File lib/trestle/toolbar/item.rb, line 89
def render
  if @instance_or_url
    admin_link_to(button_label(label, options), instance_or_url, options)
  else
    admin_link_to(button_label(label, options), options)
  end
end