Class: SolidusAdmin::Orders::Show::Adjustments::Index::Source::Component

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/solidus_admin/orders/show/adjustments/index/source/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adjustment) ⇒ Component

Returns a new instance of Component.



6
7
8
9
10
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 6

def initialize(adjustment)
  @adjustment = adjustment
  @source = adjustment.source
  @model_name = source&.model_name&.human
end

Instance Attribute Details

#adjustmentObject (readonly)

Returns the value of attribute adjustment.



4
5
6
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 4

def adjustment
  @adjustment
end

#model_nameObject (readonly)

Returns the value of attribute model_name.



4
5
6
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 4

def model_name
  @model_name
end

#sourceObject (readonly)

Returns the value of attribute source.



4
5
6
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 4

def source
  @source
end

Instance Method Details

#callObject



12
13
14
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 12

def call
  render component("ui/thumbnail_with_caption").new(icon:, caption:, detail:)
end

#captionObject



16
17
18
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 16

def caption
  adjustment.label
end

#detailObject



20
21
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 20

def detail
end

#iconObject



23
24
25
# File 'app/components/solidus_admin/orders/show/adjustments/index/source/component.rb', line 23

def icon
  "question-line"
end