Class: Panda::Core::Admin::Column

Inherits:
Object
  • Object
show all
Defined in:
app/components/panda/core/admin/table_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, width = nil, sortable: false, sort_key: nil, &block) ⇒ Column

Returns a new instance of Column.



80
81
82
83
84
85
86
# File 'app/components/panda/core/admin/table_component.rb', line 80

def initialize(label, width = nil, sortable: false, sort_key: nil, &block)
  @label = label
  @width = width
  @sortable = sortable
  @sort_key = sort_key || ActiveSupport::Inflector.parameterize(label.to_s, separator: "_")
  @cell = block
end

Instance Attribute Details

#cellObject (readonly)

Returns the value of attribute cell.



78
79
80
# File 'app/components/panda/core/admin/table_component.rb', line 78

def cell
  @cell
end

#labelObject (readonly)

Returns the value of attribute label.



78
79
80
# File 'app/components/panda/core/admin/table_component.rb', line 78

def label
  @label
end

#sort_keyObject (readonly)

Returns the value of attribute sort_key.



78
79
80
# File 'app/components/panda/core/admin/table_component.rb', line 78

def sort_key
  @sort_key
end

#widthObject (readonly)

Returns the value of attribute width.



78
79
80
# File 'app/components/panda/core/admin/table_component.rb', line 78

def width
  @width
end

Instance Method Details

#sortable?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'app/components/panda/core/admin/table_component.rb', line 88

def sortable?
  @sortable
end