Sha256: fd868f6da77e8c7eab74e5f6e56e6aca185cec8f4f893b5986a5e3f226886e22

Contents?: true

Size: 1.32 KB

Versions: 82

Compression:

Stored size: 1.32 KB

Contents

class FestivityEventList::FestivityEvent
  include Festivity::Admin::AssetsHelper

  attr_reader :id, :performances, :locations, :categories, :title, :short_description,
              :assets, :header, :sub_header, :featured_item, :buy_url

  def initialize(event_id, performances)
    @id = event_id
    @performances = performances
    @title = performances.first.event_title
    @short_description = performances.first.short_description
    @header = performances.first.header
    @sub_header = performances.first.sub_header
    @featured_item = performances.first.featured_item
    @buy_url = performances.first.buy_url

    @locations = self.performances.
        map{ |performance| FestivityEventList::FestivityLocation.new ({
        id: performance.location_id,
        slug: performance.location_slug,
        title: performance.location_title,
        directions_url: performance.festivity_directions_url,
        area_id: performance.area_id,
        area_slug: performance.area_slug,
        area_title: performance.area_title}) }.
        uniq{ |location| location.id }

    @categories = performances.first.festivity_categories

    @assets = performances.first.assets

  end

  def image
    image = assets.select { |asset| asset.title == "featured_image" }.first if assets.size > 0
    image.thumbnail(:normal) unless image.nil?
  end


end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
trusty-festivity-extension-2.3.1 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.0 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.9 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.8 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.7 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.6 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.5 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.4 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.3 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.2 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.1 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.2.0 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.1.1 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.1.0 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.0.7 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.0.6 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.0.5 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.0.4 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.0.3 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.0.2 app/models/festivity_event_list/festivity_event.rb