Class: Events::InfoboxComponent
- Inherits:
-
CommonComponent
- Object
- ViewComponent::Base
- CommonComponent
- Events::InfoboxComponent
- Defined in:
- app/components/events/infobox_component.rb
Overview
This class render the event information box
Instance Method Summary collapse
-
#call ⇒ String
Html_safe events information box.
- #infobox ⇒ Object
-
#initialize(event:, editor: false) ⇒ InfoboxComponent
constructor
A new instance of InfoboxComponent.
- #ribbon_tag ⇒ Object
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.
8 9 10 11 12 |
# File 'app/components/events/infobox_component.rb', line 8 def initialize(event:, editor: false) super @event = event @editor = editor end |
Instance Method Details
#call ⇒ String
Returns html_safe events information box.
15 16 17 |
# File 'app/components/events/infobox_component.rb', line 15 def call tag.div infobox + ribbon_tag + tag.hr(class: "hr") + @event.body.to_s, class: "box is-inactive has-ribbon block" end |
#infobox ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/components/events/infobox_component.rb', line 23 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_tag ⇒ Object
19 20 21 |
# File 'app/components/events/infobox_component.rb', line 19 def ribbon_tag link_to icon("fas fa-edit"), edit_editor_event_path(@event), class: "ribbon is-link" if @editor end |