Class: Crm::RoomLayoutPreviewComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/crm/room_layout_preview_component.rb

Overview

ViewComponent: renders the room layout preview block.

Shows the room configuration's interactive room plan when one exists and
the reception came from the design tool; otherwise links to the first
uploaded room layout image in a Fancybox viewer, or a "No layout" label.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(room_configuration:, size: '92x61>') ⇒ RoomLayoutPreviewComponent

Returns a new instance of RoomLayoutPreviewComponent.

Parameters:

  • room_configuration (RoomConfiguration, nil)

    the room configuration to preview

  • size (String) (defaults to: '92x61>')

    Dragonfly geometry string for the preview thumbnail



19
20
21
22
# File 'app/components/crm/room_layout_preview_component.rb', line 19

def initialize(room_configuration:, size: '92x61>')
  @room_configuration = room_configuration
  @size = size
end

Instance Attribute Details

#room_configurationRoomConfiguration? (readonly)

Returns the room configuration being previewed.

Returns:



15
16
17
# File 'app/components/crm/room_layout_preview_component.rb', line 15

def room_configuration
  @room_configuration
end

#sizeObject (readonly)

Returns the value of attribute size.



15
# File 'app/components/crm/room_layout_preview_component.rb', line 15

attr_reader :room_configuration, :size

Instance Method Details

#render?Boolean

Returns true when there is a room configuration to preview.

Returns:

  • (Boolean)

    true when there is a room configuration to preview



25
26
27
# File 'app/components/crm/room_layout_preview_component.rb', line 25

def render?
  room_configuration.present?
end