update facebook setting

This commit is contained in:
spen 2014-03-31 11:25:26 +08:00
parent dea2652581
commit a8a35b7aa0
6 changed files with 131 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -0,0 +1,33 @@
window.SocialShareButton =
openUrl : (url) ->
window.open(url)
false
share : (el) ->
site = $(el).data('site')
title = encodeURIComponent($(el).parent().data('title'))
img = encodeURIComponent($(el).parent().data("img"))
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
url = encodeURIComponent(location.href)
switch site
when "weibo"
SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
when "twitter"
SocialShareButton.openUrl("https://twitter.com/home?status=#{title}: #{url}")
when "douban"
SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}")
when "facebook"
SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{fb_url}")
when "qq"
SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}")
when "tqq"
SocialShareButton.openUrl("http://share.v.t.qq.com/index.php?c=share&a=index&url=#{url}&title=#{title}&pic=#{img}")
when "baidu"
SocialShareButton.openUrl("http://apps.hi.baidu.com/share/?url=#{url}&title=#{title}&content=")
when "kaixin001"
SocialShareButton.openUrl("http://www.kaixin001.com/rest/records.php?url=#{url}&content=#{title}&style=11&pic=#{img}")
when "renren"
SocialShareButton.openUrl("http://widget.renren.com/dialog/share?resourceUrl=#{url}&title=#{title}&description=")
when "google_plus"
SocialShareButton.openUrl("https://plus.google.com/share?url=#{url}&t=#{title}")
false

View File

@ -0,0 +1,90 @@
.social-share-button-baidu {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") 0px 0px no-repeat;
}
.social-share-button-delicious {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -16px 0px no-repeat;
}
.social-share-button-douban {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") 0px -16px no-repeat;
}
.social-share-button-email {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -16px -16px no-repeat;
}
.social-share-button-facebook {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -32px 0px no-repeat;
}
.social-share-button-flickr {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -32px -16px no-repeat;
}
.social-share-button-google {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") 0px -32px no-repeat;
}
.social-share-button-google_plus {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -16px -32px no-repeat;
}
.social-share-button-kaixin001 {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -32px -32px no-repeat;
}
.social-share-button-qq {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -48px 0px no-repeat;
}
.social-share-button-renren {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -48px -16px no-repeat;
}
.social-share-button-tqq {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -48px -32px no-repeat;
}
.social-share-button-twitter {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") 0px -48px no-repeat;
}
.social-share-button-weibo {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -16px -48px no-repeat;
}
.social-share-button-rss {
display:inline-block;
width:16px;
height:16px;
background:url("/assets/social-share-button.png") -32px -48px no-repeat;
}

View File

@ -107,6 +107,11 @@ class Admin::PagePartsController < OrbitBackendController
# params[:page_part][:category] ||= params[:page][:category]
if @part.update_attributes(params[:page_part])
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
@part['category'] = params[:page_part]['category'] == nil ? [] : params[:page_part]['category']
@part['tag'] = params[:page_part]['tag'] == nil ? [] : params[:page_part]['tag']
@part.save
flash.now[:notice] = t('update.success.content')
respond_to do |format|
format.js

View File

@ -31,6 +31,7 @@ class Admin::PagesController < Admin::ItemsController
params[:page][:tag] = []
end
end
@item = Page.find(params[:id])
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )

View File

@ -195,6 +195,7 @@ module ApplicationHelper
stylesheets << "<link href='#{page.design.css_reset.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_reset
# stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
# stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
@ -205,6 +206,7 @@ module ApplicationHelper
javascripts = ''
# javascripts << "<script type='text/javascript' src='/assets/lib/jquery.preload-min.js'></script>\n"
# javascripts << "<script type='text/javascript' src='/assets/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n"
page.design.javascripts.each do |js|
javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
end