Class: FestivityEventList::FestivityEvent
- Inherits:
-
Object
- Object
- FestivityEventList::FestivityEvent
- Includes:
- Festivity::Admin::AssetsHelper
- Defined in:
- app/models/festivity_event_list/festivity_event.rb
Instance Attribute Summary collapse
-
#assets ⇒ Object
readonly
Returns the value of attribute assets.
-
#buy_url ⇒ Object
readonly
Returns the value of attribute buy_url.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#featured_item ⇒ Object
readonly
Returns the value of attribute featured_item.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#locations ⇒ Object
readonly
Returns the value of attribute locations.
-
#performances ⇒ Object
readonly
Returns the value of attribute performances.
-
#short_description ⇒ Object
readonly
Returns the value of attribute short_description.
-
#sub_header ⇒ Object
readonly
Returns the value of attribute sub_header.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #image ⇒ Object
-
#initialize(event_id, performances) ⇒ FestivityEvent
constructor
A new instance of FestivityEvent.
Methods included from Festivity::Admin::AssetsHelper
#image_url, #image_url_from_all_assets
Constructor Details
#initialize(event_id, performances) ⇒ FestivityEvent
Returns a new instance of FestivityEvent.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 7 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 |
Instance Attribute Details
#assets ⇒ Object (readonly)
Returns the value of attribute assets.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def assets @assets end |
#buy_url ⇒ Object (readonly)
Returns the value of attribute buy_url.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def buy_url @buy_url end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def categories @categories end |
#featured_item ⇒ Object (readonly)
Returns the value of attribute featured_item.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def featured_item @featured_item end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def header @header end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def id @id end |
#locations ⇒ Object (readonly)
Returns the value of attribute locations.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def locations @locations end |
#performances ⇒ Object (readonly)
Returns the value of attribute performances.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def performances @performances end |
#short_description ⇒ Object (readonly)
Returns the value of attribute short_description.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def short_description @short_description end |
#sub_header ⇒ Object (readonly)
Returns the value of attribute sub_header.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def sub_header @sub_header end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 4 def title @title end |
Instance Method Details
#image ⇒ Object
34 35 36 37 |
# File 'app/models/festivity_event_list/festivity_event.rb', line 34 def image image = assets.select { |asset| asset.title == "featured_image" }.first if assets.size > 0 image.thumbnail(:normal) unless image.nil? end |