Fix fb share, redirect with js when the page is not requested by fb but by user
This commit is contained in:
parent
a03d1ad10b
commit
05e61b63bb
|
@ -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
|
||||
|
||||
|
|
|
@ -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/kernel.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"
|
||||
page.design.javascripts.each do |js|
|
||||
# javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
<head>
|
||||
<meta property="og:title" content="<%= @object.title %>" />
|
||||
<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 %>" />
|
||||
<meta property="og:image" content="<%= ('http://' + request.env['HTTP_HOST'] + @object.image.url) unless @object.image.blank? %>" />
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
window.location = "<%= @orig_url %>"
|
||||
//-->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue