Class: Workarea::Storefront::ProductVideoViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Defined in:
app/view_models/workarea/storefront/product_video_view_model.rb

Instance Method Summary collapse

Instance Method Details

#iframe_attrsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/view_models/workarea/storefront/product_video_view_model.rb', line 4

def iframe_attrs
  attrs = {
    id: model.embed_id,
    frameborder: "0",
    allowfullscreen: "",
    container_style: "padding-bottom: #{model.aspect_ratio}%"
  }

  if vimeo?
    attrs.merge(vimeo_attrs)
  elsif youtube?
    attrs.merge(youtube_attrs)
  end
end

#thumbnailObject



19
20
21
22
# File 'app/view_models/workarea/storefront/product_video_view_model.rb', line 19

def thumbnail
  return unless model.thumbnail.present?
  @thumbnail ||= Workarea::Content::Asset.find_or_initialize_by(id: model.thumbnail)
end