Class: Alchemy::Admin::Resource::Action

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/alchemy/admin/resource/action.rb

Overview

Renders a container for a button, which evaluate CanCanCan and shows a tooltip. This is an internal component for the resource table, to make easier to read.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, tooltip = nil, &block) ⇒ Action

Returns a new instance of Action.



33
34
35
36
37
# File 'app/components/alchemy/admin/resource/action.rb', line 33

def initialize(name = nil, tooltip = nil, &block)
  @name = name
  @tooltip = tooltip
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



19
20
21
# File 'app/components/alchemy/admin/resource/action.rb', line 19

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



19
20
21
# File 'app/components/alchemy/admin/resource/action.rb', line 19

def name
  @name
end

#tooltipObject (readonly)

Returns the value of attribute tooltip.



19
20
21
# File 'app/components/alchemy/admin/resource/action.rb', line 19

def tooltip
  @tooltip
end

Instance Method Details

#with_resource(resource) ⇒ Object



39
40
41
42
# File 'app/components/alchemy/admin/resource/action.rb', line 39

def with_resource(resource)
  @resource = resource
  self
end