diff --git a/app/assets/images/social-share-button.png b/app/assets/images/social-share-button.png new file mode 100644 index 0000000..3507161 Binary files /dev/null and b/app/assets/images/social-share-button.png differ diff --git a/app/assets/javascripts/lib/social-share-button.coffee b/app/assets/javascripts/lib/social-share-button.coffee new file mode 100644 index 0000000..cec9fcb --- /dev/null +++ b/app/assets/javascripts/lib/social-share-button.coffee @@ -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 \ No newline at end of file diff --git a/app/assets/stylesheets/social-share-button.css b/app/assets/stylesheets/social-share-button.css new file mode 100644 index 0000000..1acc138 --- /dev/null +++ b/app/assets/stylesheets/social-share-button.css @@ -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; +} \ No newline at end of file diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index 442f5e7..f7bc8cc 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -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 diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 2b0ca72..43e6757 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -31,7 +31,6 @@ class Admin::PagesController < Admin::ItemsController params[:page][:tag] = [] end end - params[:page][:facebook_enabled] = params[:page][:facebook_enabled] ? true : false @item = Page.find(params[:id]) if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank? @@ -72,7 +71,6 @@ class Admin::PagesController < Admin::ItemsController if params[:val].eql?("default_widget") @checked_style = @item.frontend_style.present? ? @item.frontend_style : nil if @item && @item.app_frontend_url.eql?("default_widget") @enabled_styles = @module_app.get_default_widget["enabled_styles"] - @facebook_enabled = @module_app.get_default_widget["facebook_enabled"] @widget_fields = @module_app.widget_fields.collect do |widget_field| label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}") [label, widget_field[0], class: widget_field[2]] diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index 4df87c9..332e19b 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -43,7 +43,7 @@ class DefaultWidgetController< OrbitWidgetController if !params[:id].blank? and !params["clicked_field_name"].blank? clicked_field_name = params["clicked_field_name"].to_sym - redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}, facebook_share: #{@page_part.facebook_enabled}})") + redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})") elsif !params[:id].blank? and params["preview"] clicked_field_name = :title @preview_pages = @page_part.module_app.widget_fields_link_method.find_all{|t| t[1].has_key?(:preview)}.collect{|t| t[0]} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a1a81c4..a6fd8f8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -195,6 +195,7 @@ module ApplicationHelper stylesheets << "\n" if page.design.css_reset # stylesheets << "\n" # stylesheets << "\n" + stylesheets << "\n" stylesheets << "\n" if page.design.css_default theme = page.design.themes.detect{ |d| d.id == page.theme_id } stylesheets << "\n" if theme @@ -205,6 +206,7 @@ module ApplicationHelper javascripts = '' # javascripts << "\n" # javascripts << "\n" + javascripts << "\n" page.design.javascripts.each do |js| javascripts << "" end diff --git a/app/models/page.rb b/app/models/page.rb index f0a82f4..1b6ef08 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -21,7 +21,6 @@ class Page < Item field :frontend_sat_to_link , :type => Array,:default => [] field :frontend_data_count - field :facebook_enabled, :type => Boolean, :default => false belongs_to :theme belongs_to :design diff --git a/app/views/admin/pages/_default_front.html.erb b/app/views/admin/pages/_default_front.html.erb index 1eb8abb..7ea505c 100644 --- a/app/views/admin/pages/_default_front.html.erb +++ b/app/views/admin/pages/_default_front.html.erb @@ -43,15 +43,6 @@ <% end %> -
- -
-