Class: Maglove::Widget::LegacyYoutube

Inherits:
V1
  • Object
show all
Defined in:
lib/maglove/widget/youtube.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

Instance Method Summary collapse

Methods inherited from V1

#drop_container, #widget_options

Methods inherited from Base

#initialize, #style_string, #widget_options

Constructor Details

This class inherits a constructor from Maglove::Widget::Base

Instance Method Details

#defaultsObject



22
23
24
25
26
27
28
# File 'lib/maglove/widget/youtube.rb', line 22

def defaults
  {
    youtube_id: "LFYNP40vfmE",
    width: "800",
    height: "600"
  }
end

#identifierObject



18
19
20
# File 'lib/maglove/widget/youtube.rb', line 18

def identifier
  "youtube"
end

#render(&block) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/maglove/widget/youtube.rb', line 30

def render(&block)
  super do
    haml_tag :div, class: "flex-video widescreen", style: style_string(options, :margin, :padding) do
      haml_tag :iframe, src: "https://www.youtube.com/embed/#{options[:youtube_id]}", type: "text/html", style: "max-width: 100%; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;", allowfullscreen: "", frameborder: "0", webkitallowfullscreen: "", mozallowfullscreen: ""
    end
  end
end