Module: YouthTree::Helpers::EmbedHelper
- Defined in:
- lib/youth_tree/helpers/embed_helper.rb
Instance Method Summary collapse
-
#has_share_this_js ⇒ Object
Share this embed js.
-
#share_this_link(text, options = {}) ⇒ Object
Link to share something.
-
#social_media_link(name, text, link) ⇒ Object
Links with added hinting to make them useful for social networking buttons.
-
#sponsor_link(name, url) ⇒ Object
Embed a sponsor logo.
-
#youtube_video(video_id, opts = {}) ⇒ Object
YouTube Video Embed.
Instance Method Details
#has_share_this_js ⇒ Object
Share this embed js
25 26 27 28 29 30 |
# File 'lib/youth_tree/helpers/embed_helper.rb', line 25 def has_share_this_js if Settings.share_this.publisher? has_js "http://w.sharethis.com/button/sharethis.js#publisher=#{Settings.share_this.publisher}&type=website&button=false" has_jammit_js :share_this end end |
#share_this_link(text, options = {}) ⇒ Object
Link to share something.
33 34 35 36 37 38 39 |
# File 'lib/youth_tree/helpers/embed_helper.rb', line 33 def share_this_link(text, = {}) target = .delete(:for) .stringify_keys! ["data-share-this-target"] = target.to_s if target [:class] = [[:class], 'share-this'].join(" ").squeeze(" ") link_to(text, '#', ) end |
#social_media_link(name, text, link) ⇒ Object
Links with added hinting to make them useful for social networking buttons.
6 7 8 |
# File 'lib/youth_tree/helpers/embed_helper.rb', line 6 def (name, text, link) link_to text.html_safe, link, :title => text, :class => "social-media-link #{name.to_s.dasherize}" end |
#sponsor_link(name, url) ⇒ Object
Embed a sponsor logo
42 43 44 |
# File 'lib/youth_tree/helpers/embed_helper.rb', line 42 def sponsor_link(name, url) link_to image_tag("sponsors/#{name.underscore.gsub(/[\ \_]+/, "-")}-logo.jpg"), url, :title => name, :class => 'sponsor' end |
#youtube_video(video_id, opts = {}) ⇒ Object
YouTube Video Embed.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/youth_tree/helpers/embed_helper.rb', line 11 def youtube_video(video_id, opts = {}) = {:height => 360, :width => 480, :color1 => 'AAAAAA', :color2 => '999999'}.merge(opts) video_url = "http://www.youtube-nocookie.com/v/#{video_id}?hl=en_US&fs=1&rel=0&color1=0x#{[:color1]}&color2=0x#{[:color2]}" inner = ActiveSupport::SafeBuffer.new.tap do |i| i << tag(:param, :name => "movie", :value => video_url) i << tag(:param, :name => "allowFullScreen", :value => "true") i << tag(:param, :name => "allowscriptaccess", :value => "always") i << tag(:embed, :src => video_url, :height => [:height], :width => [:width], :allowfullscreen => "true", :type => "application/x-shockwave-flash", :allowscriptaccess => "always") end content_tag(:object, inner, :height => [:height], :width => [:width]) end |