Fix fb share, redirect with js when the page is not requested by fb but by user
This commit is contained in:
parent
db16fdc7b5
commit
e9de0e24b4
|
@ -112,7 +112,7 @@ class ApplicationController < ActionController::Base
|
||||||
@object = object_class.find(params[:id])
|
@object = object_class.find(params[:id])
|
||||||
module_app = ModuleApp.first(:conditions => {:key => params[:key]})
|
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
|
@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
|
render 'shared/render_share', :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ module ApplicationHelper
|
||||||
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
|
||||||
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
|
||||||
# javascripts << "<script type='text/javascript' src='/assets/social-share-button.js'></script>\n"
|
# javascripts << "<script type='text/javascript' src='/assets/social-share-button.js'></script>\n"
|
||||||
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.coffee'></script>\n"
|
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n"
|
||||||
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
|
||||||
page.design.javascripts.each do |js|
|
page.design.javascripts.each do |js|
|
||||||
# javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
# javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
||||||
|
|
|
@ -3,8 +3,12 @@
|
||||||
<head>
|
<head>
|
||||||
<meta property="og:title" content="<%= @object.title %>" />
|
<meta property="og:title" content="<%= @object.title %>" />
|
||||||
<meta property="og:description" content="<%= strip_tags @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) unless @object.image.blank? %>" />
|
||||||
<meta property="og:image" content="<%= 'http://' + request.env['HTTP_HOST'] + @object.image.url %>" />
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
window.location = "<%= @orig_url %>"
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue