From e9de0e24b4c1558ecb759329016e8c50ff23cef4 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 8 Aug 2012 10:12:21 +0800 Subject: [PATCH] Fix fb share, redirect with js when the page is not requested by fb but by user --- app/controllers/application_controller.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/views/shared/render_share.html.erb | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 88c14bfa..109d4742 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -112,7 +112,7 @@ class ApplicationController < ActionController::Base @object = object_class.find(params[:id]) module_app = ModuleApp.first(:conditions => {:key => params[:key]}) @item = Item.where(module_app_id: module_app.id).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first - @orig_url = "http://#{request.host}/#{@item.path}?id=#{@object.id}" + @orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}" render 'shared/render_share', :layout => false end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e9211c76..63526229 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -163,7 +163,7 @@ module ApplicationHelper javascripts << "\n" javascripts << "\n" # javascripts << "\n" - javascripts << "\n" + javascripts << "\n" javascripts << "\n" page.design.javascripts.each do |js| # javascripts << "" diff --git a/app/views/shared/render_share.html.erb b/app/views/shared/render_share.html.erb index 33cc4b00..f8d3c930 100644 --- a/app/views/shared/render_share.html.erb +++ b/app/views/shared/render_share.html.erb @@ -3,8 +3,12 @@ - - + +