Module: OEmbedHelper
- Defined in:
- app/helpers/o_embed_helper.rb
Instance Method Summary collapse
- #link_to_oembed_image(cache, prefix = 'thumbnail_') ⇒ Object
- #o_embed_html(cache) ⇒ Object
- #oembed_image_tag(cache, prefix) ⇒ Object
Instance Method Details
#link_to_oembed_image(cache, prefix = 'thumbnail_') ⇒ Object
26 27 28 |
# File 'app/helpers/o_embed_helper.rb', line 26 def (cache, prefix = 'thumbnail_') link_to((cache, prefix), cache.url, :target => '_blank') end |
#o_embed_html(cache) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/o_embed_helper.rb', line 2 def (cache) data = cache.data data = {} if data.blank? title = data.fetch('title', cache.url) html = link_to(title, cache.url, :target => '_blank') return html unless data.has_key?('type') case data['type'] when 'video', 'rich' if cache.is_trusted_and_has_html? html = data['html'] elsif data.has_key?('thumbnail_url') html = (cache) end when 'photo' if data.has_key?('url') = cache.('') html = (cache, '') end else end return html.gsub('http://', 'https://').html_safe end |
#oembed_image_tag(cache, prefix) ⇒ Object
30 31 32 |
# File 'app/helpers/o_embed_helper.rb', line 30 def (cache, prefix) image_tag(cache.data[prefix + 'url'], cache.(prefix)) end |