Class: Embed::WistiaMedia

Inherits:
Spark::Component::Base show all
Defined in:
app/components/spark/embed/wistia_media_component.rb

Instance Method Summary collapse

Methods inherited from Spark::Component::Base

#selector, #to_s, #unique_id

Constructor Details

#initializeWistiaMedia

Returns a new instance of WistiaMedia.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/components/spark/embed/wistia_media_component.rb', line 10

def initialize(*)
  super

  classname.base = 'spark-wistia-media'
  wistia_embed_options = {
    class: "wistia_embed wistia_async_#{video_id} popover=true seo=false popoverContent=link popoverAnimation=none",
    style: 'height:100%;width:100%'
  }

  wistia_embed_background_options = {
    class: 'wistia-embed-background',
    style: "background-image: url('#{background_image_url}')"
  }

  unless height.blank?
    tag_attrs.merge!(style: "height: #{height}px;max-width: #{width}px")
  end
end