Change the way the orig_url is passed to fb

This commit is contained in:
Christophe Vilayphiou 2012-08-08 06:50:28 +08:00
parent 4bed925e0f
commit 6cfdf0f25a
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ window.SocialShareButton =
img = encodeURIComponent($(el).parent().data("img"))
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
url = encodeURIComponent(location.href)
fb_full_url = encodeURIComponent("#{fb_url}?orig_url=#{location.href}")
fb_full_url = encodeURIComponent("#{fb_url}?orig_host=#{location.host}&orig_path=#{location.pathname}")
switch site
when "weibo"
SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")

View File

@ -110,7 +110,7 @@ class ApplicationController < ActionController::Base
def render_share
object_class = params[:model].classify.constantize
@object = object_class.find(params[:id])
@orig_url = params[:orig_url]
@orig_url = "http://#{params[:orig_host]}/#{params[:orig_path]}"
render 'shared/render_share', :layout => false
end

View File

@ -2,7 +2,7 @@
<html>
<head>
<meta property="og:title" content="<%= @object.title %>" />
<meta property="og:description" content="<%= @object.subtitle %>" />
<meta property="og:description" content="<%= strip_tags @object.subtitle %>" />
<meta property="og:url" content="<%= @orig_url %>" />
<meta property="og:image" content="<%= 'http://' + request.env['HTTP_HOST'] + @object.image.url %>" />
</head>