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 %> +
+ +
+