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.6.3 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.6.2 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.6.1 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.6 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.19 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.18 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.17 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.16 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.15 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.14 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.13 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.12 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.11 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.10 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.9 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.8 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.7 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.6 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.5 app/models/festivity_event_list/festivity_event.rb
trusty-festivity-extension-2.5.4 app/models/festivity_event_list/festivity_event.rb