Class: Trestle::Table::ActionsColumn
- Inherits:
-
Object
- Object
- Trestle::Table::ActionsColumn
- Defined in:
- lib/trestle/table/actions_column.rb
Defined Under Namespace
Classes: ActionsBuilder, Renderer
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#toolbar ⇒ Object
readonly
Returns the value of attribute toolbar.
Instance Method Summary collapse
- #default_actions ⇒ Object
-
#initialize(options = {}, &block) ⇒ ActionsColumn
constructor
A new instance of ActionsColumn.
- #renderer(table:, template:) ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ ActionsColumn
Returns a new instance of ActionsColumn.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/trestle/table/actions_column.rb', line 6 def initialize(={}, &block) @options = @toolbar = Toolbar.new(ActionsBuilder) if block_given? @toolbar.append(&block) else @toolbar.append(&default_actions) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/trestle/table/actions_column.rb', line 4 def @options end |
#toolbar ⇒ Object (readonly)
Returns the value of attribute toolbar.
4 5 6 |
# File 'lib/trestle/table/actions_column.rb', line 4 def @toolbar end |
Instance Method Details
#default_actions ⇒ Object
21 22 23 24 25 |
# File 'lib/trestle/table/actions_column.rb', line 21 def default_actions ->(, instance, admin) do .delete if admin && admin.actions.include?(:destroy) end end |