Sha256: b68f6e14f58201774ef972d9306c3ba284173f16a451d3055927c2c17763c676

Contents?: true

Size: 970 Bytes

Versions: 12

Compression:

Stored size: 970 Bytes

Contents

class Tramway::Event::Events::Show::EventDecorator < ::Tramway::Core::ApplicationDecorator
  class << self
    def collections
      [ :all ]
    end
  end

  delegate :title, to: :object
  delegate :description, to: :object
  delegate :participant_form_fields, to: :object
  delegate :sections, to: :object
  delegate :partakings, to: :object
  delegate :request_collecting_state, to: :object

  def background
    object.photo
  end

  def duration
    if object.begin_date.to_date == object.end_date.to_date
      "#{I18n.l(object.begin_date, format: '%d %B %Y')}"
    elsif object.begin_date.month == object.end_date.month
      "#{I18n.t('date.from')} #{I18n.l(object.begin_date, format: '%d')} #{I18n.t('date.to')} #{I18n.l(object.end_date, format: '%d %B %Y')}"
    else
      "#{I18n.t('date.from')} #{I18n.l(object.begin_date, format: '%d %B %Y')} #{I18n.t('date.to')} #{I18n.l(object.end_date, format: '%d %B %Y')}"
    end
  end

  alias tagline duration
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
tramway-event-1.8.10 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.9 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.8 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.7 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.6 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.5 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.4 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.3 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.2 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.1.1 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8.1 app/decorators/tramway/event/events/show/event_decorator.rb
tramway-event-1.8 app/decorators/tramway/event/events/show/event_decorator.rb