lib/onebox/engine/cloudapp_onebox.rb in onebox-1.8.79 vs lib/onebox/engine/cloudapp_onebox.rb in onebox-1.8.80

- old
+ new

@@ -8,48 +8,42 @@ always_https def to_html og = get_opengraph - if !Onebox::Helpers::blank?(og[:image]) + if !og.image.nil? return image_html(og) - elsif og[:title].to_s[/\.(mp4|ogv|webm)$/] + elsif og.title.to_s[/\.(mp4|ogv|webm)$/] return video_html(og) else return link_html(og) end end private def link_html(og) - escaped_url = ::Onebox::Helpers.normalize_url_for_output(og[:url]) - <<-HTML - <a href='#{escaped_url}' target='_blank'> - #{og[:title]} + <a href='#{og.url}' target='_blank'> + #{og.title} </a> HTML end def video_html(og) - src = og[:url] - title = og[:title] - direct_src = ::Onebox::Helpers.normalize_url_for_output("#{src}/#{title}") + direct_src = ::Onebox::Helpers.normalize_url_for_output("#{og.get(:url)}/#{og.title}") <<-HTML - <video width='480' height='360' #{Helpers.title_attr(og)} controls loop> + <video width='480' height='360' #{og.title_attr} controls loop> <source src='#{direct_src}' type='video/mp4'> </video> HTML end def image_html(og) - escaped_url = ::Onebox::Helpers.normalize_url_for_output(og[:url]) - <<-HTML - <a href='#{escaped_url}' target='_blank' class='onebox'> - <img src='#{og[:image]}' #{Helpers.title_attr(og)} alt='CloudApp' width='480'> + <a href='#{og.url}' target='_blank' class='onebox'> + <img src='#{og.image}' #{og.title_attr} alt='CloudApp' width='480'> </a> HTML end end end