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.5.3 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.2 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.1 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.0 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.4.6 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.4.5 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.4.4 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.4.3 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.4.2 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.4.1 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.4.0 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.30 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.29 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.28 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.27 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.26 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.25 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.24 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.23 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.3.22 app/models/festivity_event_list/festivity_event.rb