Class: Events::InfoboxComponent

Inherits:
CommonComponent show all
Defined in:
app/components/events/infobox_component.rb

Overview

This class render the event information box

Instance Method Summary collapse

Methods inherited from CommonComponent

#icon, #icon_text, #level, #level_item, #pagy, #turbo_yield

Methods included from ApplicationHelper

#fas_icon, #icon, #icon_text, #l_date, #l_long, #l_time, #notifications, #notify, #notify_status, #t_enum

Constructor Details

#initialize(event:, editor: false) ⇒ InfoboxComponent

Returns a new instance of InfoboxComponent.

Parameters:

  • opts (Hash)

    to generate content



10
11
12
13
14
# File 'app/components/events/infobox_component.rb', line 10

def initialize(event:, editor: false)
  super
  @event = event
  @editor = editor
end

Instance Method Details

#callString

Returns html_safe events information box.

Returns:

  • (String)

    html_safe events information box



17
18
19
# File 'app/components/events/infobox_component.rb', line 17

def call
  tag.div infobox + ribbon_tag + tag.hr(class: "hr") + @event.body.to_s, class: "box is-inactive has-ribbon block"
end

#infoboxObject



25
26
27
28
29
30
31
32
# File 'app/components/events/infobox_component.rb', line 25

def infobox
  ary = [
    [ t(".start_on"), (l(@event.start_on) if @event.start_on?) ],
    [ t(".stop_on"), (l(@event.stop_on) if @event.stop_on?) ],
    [ t(".tickets_frequency"), t(".#{@event.tickets_frequency}") ]
  ]
  level ary
end

#ribbon_tagObject



21
22
23
# File 'app/components/events/infobox_component.rb', line 21

def ribbon_tag
    link_to icon("fas fa-edit"), edit_editor_event_path(@event), class: "ribbon is-link" if @editor
end