Class: NfgUi::Bootstrap::Components::Embed
- Inherits:
-
Base
- Object
- Base
- NfgUi::Bootstrap::Components::Embed
show all
- Defined in:
- lib/nfg_ui/bootstrap/components/embed.rb
Overview
Bootstrap Responsive Embed Component
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary
collapse
Methods inherited from Base
#component_family, #data, #href, #html_options, #id, #initialize, #style
Instance Method Details
#aspect_ratio ⇒ Object
8
9
10
|
# File 'lib/nfg_ui/bootstrap/components/embed.rb', line 8
def aspect_ratio
options.fetch(:aspect_ratio, default_aspect_ratio) || default_aspect_ratio
end
|
#autoplay ⇒ Object
21
22
23
|
# File 'lib/nfg_ui/bootstrap/components/embed.rb', line 21
def autoplay
options.fetch(:autoplay, default_autoplay)
end
|
#iframe ⇒ Object
12
13
14
15
|
# File 'lib/nfg_ui/bootstrap/components/embed.rb', line 12
def iframe
return unless iframe?
view_context.content_tag :iframe, nil, src: src, class: 'embed-responsive-item', allowfullscreen: true
end
|
#iframe? ⇒ Boolean
17
18
19
|
# File 'lib/nfg_ui/bootstrap/components/embed.rb', line 17
def iframe?
options[:iframe].present?
end
|
#render ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/nfg_ui/bootstrap/components/embed.rb', line 25
def render
super do
if iframe?
iframe
else
(block_given? ? yield : body)
end
end
end
|