Class: Phlexi::Table::Components::ActionsColumn

Inherits:
Base
  • Object
show all
Includes:
Concerns::DisplaysHeader
Defined in:
lib/phlexi/table/components/actions_column.rb

Direct Known Subclasses

Base::ActionsColumn

Instance Attribute Summary

Attributes inherited from Base

#key, #options, #parent

Instance Method Summary collapse

Methods included from Concerns::DisplaysHeader

#colspan, #header_cell, #header_cell_attributes

Constructor Details

#initialize(&block) ⇒ ActionsColumn

Returns a new instance of ActionsColumn.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
# File 'lib/phlexi/table/components/actions_column.rb', line 9

def initialize(*, **, &block)
  raise ArgumentError, "block is required" unless block.present?

  super(*, **)
  @block = block
end

Instance Method Details

#alignmentObject



39
# File 'lib/phlexi/table/components/actions_column.rb', line 39

def alignment = nil

#data_cell_attributes(object) ⇒ Object



33
34
35
# File 'lib/phlexi/table/components/actions_column.rb', line 33

def data_cell_attributes(object)
  @attributes
end

#dom_idObject



29
30
31
# File 'lib/phlexi/table/components/actions_column.rb', line 29

def dom_id
  "#{super}_actions_cell"
end

#label(label = nil) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/phlexi/table/components/actions_column.rb', line 16

def label(label = nil)
  if label.nil?
    options[:label]
  else
    options[:label] = label
    self
  end
end

#render_actions(object) ⇒ Object



25
26
27
# File 'lib/phlexi/table/components/actions_column.rb', line 25

def render_actions(object)
  @block.call(object)
end

#typeObject



37
# File 'lib/phlexi/table/components/actions_column.rb', line 37

def type = "actions"