Class: SolidusAdmin::UI::Table::Component::Data

Inherits:
Struct
  • Object
show all
Defined in:
app/components/solidus_admin/ui/table/component.rb

Overview

rubocop:disable Lint/StructNewOverride,Style/StructInheritance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Data

Returns a new instance of Data.



12
13
14
15
16
17
18
19
# File 'app/components/solidus_admin/ui/table/component.rb', line 12

def initialize(**args)
  super

  self.columns = columns.map do |column|
    column.is_a?(Symbol) ? Column.new(wrap: false, header: column, data: column) : Column.new(wrap: false, **column)
  end
  self.batch_actions = batch_actions.to_a.map { |action| BatchAction.new(**action) }
end

Instance Attribute Details

#batch_actionsObject

Returns the value of attribute batch_actions

Returns:

  • (Object)

    the current value of batch_actions



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def batch_actions
  @batch_actions
end

#classObject

Returns the value of attribute class

Returns:

  • (Object)

    the current value of class



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def class
  @class
end

#columnsObject

Returns the value of attribute columns

Returns:

  • (Object)

    the current value of columns



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def columns
  @columns
end

#fadeObject

Returns the value of attribute fade

Returns:

  • (Object)

    the current value of fade



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def fade
  @fade
end

#nextObject

Returns the value of attribute next

Returns:

  • (Object)

    the current value of next



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def next
  @next
end

#prevObject

Returns the value of attribute prev

Returns:

  • (Object)

    the current value of prev



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def prev
  @prev
end

#rowsObject

Returns the value of attribute rows

Returns:

  • (Object)

    the current value of rows



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def rows
  @rows
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



11
12
13
# File 'app/components/solidus_admin/ui/table/component.rb', line 11

def url
  @url
end

Instance Method Details

#plural_nameObject



25
26
27
# File 'app/components/solidus_admin/ui/table/component.rb', line 25

def plural_name
  self[:class].model_name.human.pluralize if self[:class]
end

#singular_nameObject



21
22
23
# File 'app/components/solidus_admin/ui/table/component.rb', line 21

def singular_name
  self[:class].model_name.human if self[:class]
end