Class: SolidusAdmin::Orders::Show::Component
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- SolidusAdmin::Orders::Show::Component
- Includes:
- Layout::PageHelpers
- Defined in:
- app/components/solidus_admin/orders/show/component.rb
Instance Method Summary collapse
- #customer_name(user) ⇒ Object
- #form_id ⇒ Object
- #format_address(address) ⇒ Object
-
#initialize(order:) ⇒ Component
constructor
A new instance of Component.
- #turbo_frames ⇒ Object
Constructor Details
#initialize(order:) ⇒ Component
Returns a new instance of Component.
6 7 8 |
# File 'app/components/solidus_admin/orders/show/component.rb', line 6 def initialize(order:) @order = order end |
Instance Method Details
#customer_name(user) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'app/components/solidus_admin/orders/show/component.rb', line 40 def customer_name(user) ( user.default_user_bill_address || user.default_user_ship_address || user.user_addresses.where(default: true).first || user.user_addresses.first )&.address&.name end |
#form_id ⇒ Object
10 11 12 |
# File 'app/components/solidus_admin/orders/show/component.rb', line 10 def form_id @form_id ||= "#{stimulus_id}--form-#{@order.id}" end |
#format_address(address) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/components/solidus_admin/orders/show/component.rb', line 14 def format_address(address) return unless address safe_join([ address.name, tag.br, address.address1, tag.br, address.address2, address.city, address.zipcode, address.state&.name, tag.br, address.country.name, tag.br, address.phone, ], " ") end |
#turbo_frames ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/components/solidus_admin/orders/show/component.rb', line 32 def turbo_frames %w[ edit_order_email_modal edit_order_bill_address_modal edit_order_ship_address_modal ] end |