class Jekyll::WistiaPopoverComponent

Public Instance Methods

template(context) click to toggle source
# File lib/jekyll/jelly/components/blocks/wistia_popover.rb, line 5
def template(context)
  unless @props["id"]
    return ""
  end

  id = @props["id"].gsub("wistia_", "").gsub("Wistia_", "")
  class_name = @props["class"]
  content = @props["content"]
  popover_content = @props["popoverContent"] || "link"
  selector = @props["selector"] || "span"
  style = @props["style"]

  popover_content = "popoverContent=#{popover_content}"

  render = %Q[
    <script src="https://fast.wistia.com/embed/medias/#{id}.jsonp" async></script>
    <#{selector}
      class="
        #{class_name}
        wistia_embed wistia_async_#{id}
        popover=true popoverAnimateThumbnail=true
        #{popover_content}
      "
      style="#{style}"
    >
      #{content}
    </#{selector}>
  ]
end