From 6cfdf0f25a24eaf200eb4b0c99d34563614a1444 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 8 Aug 2012 06:50:28 +0800 Subject: [PATCH] Change the way the orig_url is passed to fb --- app/assets/javascripts/lib/social-share-button.coffee | 2 +- app/controllers/application_controller.rb | 2 +- app/views/shared/render_share.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/lib/social-share-button.coffee b/app/assets/javascripts/lib/social-share-button.coffee index 8e97d0ef..8a72a2ac 100644 --- a/app/assets/javascripts/lib/social-share-button.coffee +++ b/app/assets/javascripts/lib/social-share-button.coffee @@ -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") diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bf9da2f7..7601f91a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/views/shared/render_share.html.erb b/app/views/shared/render_share.html.erb index 110d30f5..33cc4b00 100644 --- a/app/views/shared/render_share.html.erb +++ b/app/views/shared/render_share.html.erb @@ -2,7 +2,7 @@ - +