Class: Jekyll::WistiaComponent

Inherits:
ComponentTag
  • Object
show all
Defined in:
lib/jekyll/jelly/components/tags/wistia.rb

Instance Method Summary collapse

Instance Method Details

#template(context) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jekyll/jelly/components/tags/wistia.rb', line 5

def template(context)
  unless @props["id"]
    return ""
  end

  id = @props["id"].gsub("wistia_", "").gsub("Wistia_", "").gsub("wistia-", "").gsub("Wistia-", "")
  class_name = @props["class"]

  render = %Q[
    <script src='https://fast.wistia.com/embed/medias/#{id}.jsonp' async></script>
    <div class='wistia_responsive_padding #{class_name}' style='padding:56.25% 0 0 0;position:relative;'>
      <div class='wistia_responsive_wrapper' style='height:100%;left:0;position:absolute;top:0;width:100%;'>
        <div class='wistia_embed wistia_async_#{id} videoFoam=true' style='height:100%;width:100%'>
          &nbsp;
        </div>
      </div>
    </div>
  ]
end