Class: Maglove::Widgets::Video

Inherits:
Base
  • Object
show all
Defined in:
lib/maglove/widgets/video.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
15
16
17
18
19
20
21
# File 'lib/maglove/widgets/video.rb', line 8

def defaults
  {
    width: "640",
    height: "360",
    preload: "auto",
    style: "default",
    source: false,
    poster: false,
    autoplay: false,
    controls: true,
    loop: false,
    margin_bottom: "0"
  }
end

#identifierObject



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

def identifier
  "video"
end

#template(&block) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/maglove/widgets/video.rb', line 23

def template(&block)
  haml_tag :div, style: "margin-bottom: #{options[:margin_bottom]}", class: "video-widget player-style-#{options[:style]}" do
    haml_tag :video, controls: true, poster: options[:poster], style: "width: 100%" do
      haml_tag :source, src: options[:source].to_s, type: "video/mp4"
    end
  end
end