Sha256: c63e47e92448067685db7b8304f6acd5f34e8560f213fbdabe786f7e680b16d9

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

module Workarea
  module Admin
    class BlogEntryViewModel < ApplicationViewModel
      include ContentableViewModel
      include FeaturedProductsViewModel

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

      def thumbnail_image_url
        find_asset(model.thumbnail_image).url
      end

      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.placeholder
                      end
        end

        @assets[id]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-blog-3.4.9 app/view_models/workarea/admin/blog_entry_view_model.rb
workarea-blog-3.4.8 app/view_models/workarea/admin/blog_entry_view_model.rb
workarea-blog-3.4.7 app/view_models/workarea/admin/blog_entry_view_model.rb