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

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/solidus_admin/orders/show/adjustments/index/adjustable/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/adjustable/component.rb', line 6

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

Instance Attribute Details

#adjustableObject (readonly)

Returns the value of attribute adjustable.



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

def adjustable
  @adjustable
end

#adjustmentObject (readonly)

Returns the value of attribute adjustment.



4
5
6
# File 'app/components/solidus_admin/orders/show/adjustments/index/adjustable/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/adjustable/component.rb', line 4

def model_name
  @model_name
end

Instance Method Details

#callObject



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

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

#captionObject



22
23
# File 'app/components/solidus_admin/orders/show/adjustments/index/adjustable/component.rb', line 22

def caption
end

#detailObject



25
26
# File 'app/components/solidus_admin/orders/show/adjustments/index/adjustable/component.rb', line 25

def detail
end

#thumbnailObject



18
19
20
# File 'app/components/solidus_admin/orders/show/adjustments/index/adjustable/component.rb', line 18

def thumbnail
  render(component("ui/thumbnail").for(adjustment.adjustable, class: "basis-10"))
end