Skip to content
Snippets Groups Projects
Unverified Commit 30de0806 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

iframe host

parent 35a48041
No related branches found
No related tags found
No related merge requests found
......@@ -33,8 +33,7 @@ module Communication::Website::WithSecurity
blocks.where(template_kind: :video).each do |block|
video_url = block.template.url
next unless video_url.present?
video_iframe_url = Video::Provider.find(video_url).iframe_url
list << URI.parse(video_iframe_url).host
list << Video::Provider.find(video_url).iframe_host
end
list
end
......
class Video::Provider::Default
DOMAINS = []
attr_reader :video_url
include ActionView::Helpers::TagHelper
......@@ -17,6 +17,10 @@ class Video::Provider::Default
video_url
end
def iframe_host
URI.parse(iframe_url).host
end
def iframe_tag(**iframe_options)
content_tag(:iframe, nil, default_iframe_options.merge(iframe_options))
end
......@@ -36,8 +40,8 @@ class Video::Provider::Default
protected
def url_in_domains?
self.class::DOMAINS.any? do |domain|
video_url.include?(domain)
self.class::DOMAINS.any? do |domain|
video_url.include?(domain)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment