Class: Happenings::BoxComponent

Inherits:
CommonComponent show all
Defined in:
app/components/happenings/box_component.rb

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(happening:) ⇒ BoxComponent

Returns a new instance of BoxComponent.



4
5
6
# File 'app/components/happenings/box_component.rb', line 4

def initialize(happening:)
  @happening = happening
end

Instance Method Details

#infoObject



8
9
10
11
12
13
14
15
16
# File 'app/components/happenings/box_component.rb', line 8

def info
  ary = [
    [ t(".start_at"), l(@happening.start_at, format: :short), "start-at" ],
    [ t(".max_tickets"), @happening.max_tickets, "max-tickets" ],
    [ t(".max_tickets_for_user"), @happening.max_tickets_for_user, "max-tickets-for-user" ],
    [ t(".available_tickets"), tag.span(@happening.tickets_available, id: "available_#{@happening.id}"), "available-tickets" ]
  ]
  level ary
end