Class: Katalyst::Tables::Cells::EnumComponent

Inherits:
Katalyst::Tables::CellComponent show all
Defined in:
app/components/katalyst/tables/cells/enum_component.rb

Overview

Displays an enum value using data inferred from the model.

Instance Attribute Summary

Attributes inherited from Katalyst::Tables::CellComponent

#collection, #column, #record, #row

Instance Method Summary collapse

Methods inherited from Katalyst::Tables::CellComponent

#call, #heading?, #initialize, #inspect, #label, #to_s, #value, #with_content_wrapper

Constructor Details

This class inherits a constructor from Katalyst::Tables::CellComponent

Instance Method Details

#rendered_valueObject



8
9
10
11
12
13
# File 'app/components/katalyst/tables/cells/enum_component.rb', line 8

def rendered_value
  if (value = self.value).present?
    label = collection.model.human_attribute_name("#{column}.#{value}")
    (:small, label, data: { enum: column, value: })
  end
end