Class: Maglove::Widgets::Youtube

Inherits:
Base
  • Object
show all
Defined in:
lib/maglove/widgets/youtube.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

Instance Method Summary collapse

Methods inherited from Base

#initialize, #widget_options

Constructor Details

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

Instance Method Details

#defaultsObject



8
9
10
11
12
13
14
# File 'lib/maglove/widgets/youtube.rb', line 8

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

#identifierObject



4
5
6
# File 'lib/maglove/widgets/youtube.rb', line 4

def identifier
  "youtube"
end

#template(&block) ⇒ Object



16
17
18
19
20
# File 'lib/maglove/widgets/youtube.rb', line 16

def template(&block)
  haml_tag :div, class: "flex-video widescreen", style: style_string(options) 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