Class: FlexiAdmin::Components::Resources::ListView::CellComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/flexi_admin/components/resources/list_view/cell_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, width: nil, **options) ⇒ CellComponent

Returns a new instance of CellComponent.



7
8
9
10
11
12
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 7

def initialize(value, width: nil, **options)
  @value = value
  @width = width
  @options = options
  @justify = options[:justify]
end

Instance Attribute Details

#justifyObject (readonly)

Returns the value of attribute justify.



5
6
7
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 5

def justify
  @justify
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 5

def options
  @options
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 5

def value
  @value
end

#widthObject (readonly)

Returns the value of attribute width.



5
6
7
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 5

def width
  @width
end

Instance Method Details

#justify_classObject



18
19
20
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 18

def justify_class
  justify ? "text-#{justify}" : ""
end

#merged_classesObject



22
23
24
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 22

def merged_classes
  [width_class, justify_class].join(" ")
end

#width_classObject



14
15
16
# File 'lib/flexi_admin/components/resources/list_view/cell_component.rb', line 14

def width_class
  width ? "col-#{width}" : "col"
end