share setting included in orbit kernel to toggle on and off
This commit is contained in:
parent
2f87ce09a4
commit
f8adebd463
|
@ -31,6 +31,8 @@ class Admin::PagesController < Admin::ItemsController
|
||||||
params[:page][:tag] = []
|
params[:page][:tag] = []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
params[:page][:facebook_enabled] = params[:page][:facebook_enabled] ? true : false
|
||||||
|
|
||||||
@item = Page.find(params[:id])
|
@item = Page.find(params[:id])
|
||||||
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
|
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 )
|
@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")
|
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")
|
@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"]
|
@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|
|
@widget_fields = @module_app.widget_fields.collect do |widget_field|
|
||||||
label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}")
|
label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}")
|
||||||
[label, widget_field[0], class: widget_field[2]]
|
[label, widget_field[0], class: widget_field[2]]
|
||||||
|
|
|
@ -43,7 +43,7 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
|
|
||||||
if !params[:id].blank? and !params["clicked_field_name"].blank?
|
if !params[:id].blank? and !params["clicked_field_name"].blank?
|
||||||
clicked_field_name = params["clicked_field_name"].to_sym
|
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"]
|
elsif !params[:id].blank? and params["preview"]
|
||||||
clicked_field_name = :title
|
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]}
|
@preview_pages = @page_part.module_app.widget_fields_link_method.find_all{|t| t[1].has_key?(:preview)}.collect{|t| t[0]}
|
||||||
|
|
|
@ -21,6 +21,7 @@ class Page < Item
|
||||||
field :frontend_sat_to_link , :type => Array,:default => []
|
field :frontend_sat_to_link , :type => Array,:default => []
|
||||||
|
|
||||||
field :frontend_data_count
|
field :frontend_data_count
|
||||||
|
field :facebook_enabled, :type => Boolean, :default => false
|
||||||
|
|
||||||
belongs_to :theme
|
belongs_to :theme
|
||||||
belongs_to :design
|
belongs_to :design
|
||||||
|
|
|
@ -43,6 +43,15 @@
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="facebook-enabled" class="checkbox-groups">
|
||||||
|
<label>Share setting</label>
|
||||||
|
<p>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= check_box_tag 'page[facebook_enabled]', true, @item && @item.facebook_enabled || false %>
|
||||||
|
Enable facebook sharing
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<label><%= t("default_widget.fields_") %></label>
|
<label><%= t("default_widget.fields_") %></label>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#built-in-modules
|
#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 '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', '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'
|
gem 'member_staff', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-memberstaff.git'
|
||||||
|
|
|
@ -103,6 +103,7 @@ module OrbitApp
|
||||||
@query = nil
|
@query = nil
|
||||||
@widget_title_enabled = false
|
@widget_title_enabled = false
|
||||||
@column_title_enabled = true
|
@column_title_enabled = true
|
||||||
|
@facebook_enabled = false
|
||||||
@image = nil
|
@image = nil
|
||||||
@more_link = {}
|
@more_link = {}
|
||||||
@fields = []
|
@fields = []
|
||||||
|
@ -124,7 +125,7 @@ module OrbitApp
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_module_app_format
|
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
|
end
|
||||||
|
|
||||||
def link_field(field_name,setting)
|
def link_field(field_name,setting)
|
||||||
|
@ -151,6 +152,10 @@ module OrbitApp
|
||||||
@widget_title_enabled = var
|
@widget_title_enabled = var
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def facebook_enabled(var)
|
||||||
|
@facebook_enabled = var
|
||||||
|
end
|
||||||
|
|
||||||
def column_title_enabled(var)
|
def column_title_enabled(var)
|
||||||
@column_title_enabled = var
|
@column_title_enabled = var
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue