Class: Katalyst::Tables::Cells::EnumComponent
- Inherits:
-
Katalyst::Tables::CellComponent
- Object
- ViewComponent::Base
- Katalyst::Tables::CellComponent
- Katalyst::Tables::Cells::EnumComponent
- 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_value ⇒ Object
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}") content_tag(:small, label, data: { enum: column, value: }) end end |