* Throw away old system * Add new system * Add new example files * Replace all calls * add the most important docs * Add Specs * rename disable_ssl_requirement to require_ssl * cloudfiles isn't used/called in our code * since community_spotlight.list is only used as enable flag replace it with such one and remove all legacy and irelevant codepaths around it * die if session secret is unset and on heroku * First basic infrastructure for version information
57 lines
1.5 KiB
Ruby
57 lines
1.5 KiB
Ruby
module OpenGraphHelper
|
|
def og_title(post)
|
|
meta_tag_with_property('og:title', post_page_title(post, :length => 140))
|
|
end
|
|
|
|
def og_type(post)
|
|
meta_tag_with_property('og:type', 'article')
|
|
end
|
|
|
|
def og_url(post)
|
|
meta_tag_with_property('og:url', post_url(post))
|
|
end
|
|
|
|
def og_image(post)
|
|
tags = post.photos.map{|x| meta_tag_with_property('og:image', x.url(:thumb_large))}
|
|
tags << meta_tag_with_property('og:image', default_image_url) if tags.empty?
|
|
tags.join(' ')
|
|
end
|
|
|
|
def og_site_name
|
|
meta_tag_with_property('og:site_name', 'Diaspora*')
|
|
end
|
|
|
|
def og_description(post)
|
|
meta_tag_with_property('og:description', post_page_title(post, :length => 1000))
|
|
end
|
|
|
|
def og_type
|
|
meta_tag_with_property('og:type', og_namespace('frame'))
|
|
end
|
|
|
|
def og_namespace(object)
|
|
namespace = AppConfig.services.facebook.open_graph_namespace.present? ? AppConfig.services.facebook.open_graph_namespace : 'joindiaspora'
|
|
"#{namespace}:frame"
|
|
end
|
|
|
|
def og_page_specific_tags(post)
|
|
[og_title(post), og_type,
|
|
og_url(post), og_image(post),
|
|
og_description(post)].join(' ').html_safe
|
|
end
|
|
|
|
def meta_tag_with_property(name, content)
|
|
content_tag(:meta, '', :property => name, :content => content)
|
|
end
|
|
|
|
private
|
|
|
|
# This method compensates for hosting assets off of s3
|
|
def default_image_url
|
|
if image_path('asterisk.png').include?("http")
|
|
image_path('asterisk.png')
|
|
else
|
|
"#{root_url.chop}#{image_path('asterisk.png')}"
|
|
end
|
|
end
|
|
end
|