Module: WnmSupport::ViewHelpers::Youtube

Defined in:
lib/wnm_support/view_helpers/youtube.rb

Instance Method Summary collapse

Instance Method Details

#youtube_prepare_url(url) ⇒ Object



4
5
6
7
8
# File 'lib/wnm_support/view_helpers/youtube.rb', line 4

def youtube_prepare_url(url)
  url = url.to_s.gsub(/watch\?v=/, "v/").gsub(/&feature=.*/, "")
  url << "?fs=1&amp;hl=sk_SK"
  url
end

#youtube_video(url, width, height) ⇒ Object



10
11
12
13
14
15
# File 'lib/wnm_support/view_helpers/youtube.rb', line 10

def youtube_video(url, width, height)
  url = url.to_s
  width = width.to_i.to_s
  height = height.to_i.to_s
  '<object width="'+width+'" height="'+height+'"><param name="movie" value="'+url+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+url+'" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" allowscriptaccess="always" allowfullscreen="true"></embed></object>'.html_safe
end