diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 4589f19..2b0ca72 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -31,6 +31,8 @@ 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? @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id ) @@ -70,6 +72,7 @@ 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 332e19b..4df87c9 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}})") + 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}})") 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/models/page.rb b/app/models/page.rb index 1b6ef08..f0a82f4 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -21,6 +21,7 @@ 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 7ea505c..1eb8abb 100644 --- a/app/views/admin/pages/_default_front.html.erb +++ b/app/views/admin/pages/_default_front.html.erb @@ -43,6 +43,15 @@ <% end %> +
+ +

+ +

+
diff --git a/built_in_extensions.rb b/built_in_extensions.rb index 10b154c..b93cb20 100644 --- a/built_in_extensions.rb +++ b/built_in_extensions.rb @@ -1,5 +1,6 @@ #built-in-modules -gem 'announcement', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-announcement.git' +# gem 'announcement', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-announcement.git' +gem 'announcement', '0.0.1', :path => '/Users/H4RRY/github/modules' gem 'gallery', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-gallery.git' gem 'member', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-member.git' gem 'member_staff', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-memberstaff.git' diff --git a/lib/orbit_app/module/widget.rb b/lib/orbit_app/module/widget.rb index ca5fd56..f8d9cdf 100644 --- a/lib/orbit_app/module/widget.rb +++ b/lib/orbit_app/module/widget.rb @@ -103,6 +103,7 @@ module OrbitApp @query = nil @widget_title_enabled = false @column_title_enabled = true + @facebook_enabled = false @image = nil @more_link = {} @fields = [] @@ -124,7 +125,7 @@ module OrbitApp end def to_module_app_format - {"query"=>@query,"image"=>@image,"more_link"=>@more_link,"enabled_styles"=>@enabled_styles,"widget_title_enabled"=>@widget_title_enabled, "column_title_enabled"=>@column_title_enabled} rescue nil + {"query"=>@query,"image"=>@image,"more_link"=>@more_link,"enabled_styles"=>@enabled_styles,"widget_title_enabled"=>@widget_title_enabled, "column_title_enabled"=>@column_title_enabled, "facebook_enabled"=>@facebook_enabled} rescue nil end def link_field(field_name,setting) @@ -151,6 +152,10 @@ module OrbitApp @widget_title_enabled = var end + def facebook_enabled(var) + @facebook_enabled = var + end + def column_title_enabled(var) @column_title_enabled = var end