Class: Workarea::Admin::BlogEntryViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Includes:
ContentableViewModel, FeaturedProductsViewModel
Defined in:
app/view_models/workarea/admin/blog_entry_view_model.rb

Instance Method Summary collapse

Instance Method Details

#find_asset(id) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/view_models/workarea/admin/blog_entry_view_model.rb', line 15

def find_asset(id)
  id = id.to_s
  @assets ||= Hash.new do |hash, key|
    hash[key] = begin
                  Content::Asset.find(id)
                rescue StandardError
                  Content::Asset.image_placeholder
                end
  end

  @assets[id]
end

#thumbnail_image_urlObject



11
12
13
# File 'app/view_models/workarea/admin/blog_entry_view_model.rb', line 11

def thumbnail_image_url
  find_asset(model.thumbnail_image).url
end

#timelineObject



7
8
9
# File 'app/view_models/workarea/admin/blog_entry_view_model.rb', line 7

def timeline
  @timeline ||= TimelineViewModel.new(model)
end