Sha256: d3107da27ea06646d6a19a5b07ca032ac9627d9074de18680af7ff0253156628

Contents?: true

Size: 1015 Bytes

Versions: 15

Compression:

Stored size: 1015 Bytes

Contents

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

  delegate :title, to: :object
  delegate :description, to: :object
  decorate_association :participants
  decorate_association :participant_form_fields
  decorate_association :sections
  decorate_association :partakings
  decorate_association :partnerships
  decorate_association :organizations

  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

15 entries across 15 versions & 1 rubygems

Version Path
tramway-event-1.9.13 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.12 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.11.2 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.11.1 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.11 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.10.1 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.10 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.9.2 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.9.1 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.9 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.8 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.7 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.6 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.5 app/decorators/tramway/event/event_decorator.rb
tramway-event-1.9.4 app/decorators/tramway/event/event_decorator.rb