update
This commit is contained in:
parent
efbf71a7c7
commit
b65696fea6
|
@ -22,6 +22,9 @@
|
||||||
<a href="#sidebar-nav" data-toggle="tab"><%= t('preferences.sidebar_nav') %></a>
|
<a href="#sidebar-nav" data-toggle="tab"><%= t('preferences.sidebar_nav') %></a>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<li>
|
||||||
|
<a href="#page_set" data-toggle="tab"><%= t('preferences.page_set') %></a>
|
||||||
|
</li>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="#system-email" data-toggle="tab"><%= t('preferences.system_email') %></a>
|
<a href="#system-email" data-toggle="tab"><%= t('preferences.system_email') %></a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -58,7 +61,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<!-- Page set -->
|
||||||
|
<div id="page_set" class="tab-pane fade">
|
||||||
|
<%= f.fields_for :page_sets do |page_set| %>
|
||||||
|
<%= page_set.check_box :auto_convert_flag %> <%= t('preferences.auto_convert_flag') %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<!-- System Email -->
|
<!-- System Email -->
|
||||||
<%= f.fields_for :site_settings, @site['site_settings'] do |f| %>
|
<%= f.fields_for :site_settings, @site['site_settings'] do |f| %>
|
||||||
|
|
||||||
|
@ -274,6 +282,46 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('preferences.orbit_bar_background_color') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :orbit_bar_background_color, :class=>'set_color',:type=>'color',:value=>@site.orbit_bar_background_color%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('preferences.orbit_bar_text_color') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :orbit_bar_text_color, :class=>'set_color',:type=>'color',:value=>@site.orbit_bar_text_color%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('preferences.orbit_bar_submenu_background_color') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :orbit_bar_submenu_background_color, :class=>'set_color',:type=>'color',:value=>@site.orbit_bar_submenu_background_color%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('preferences.orbit_bar_submenu_text_color') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :orbit_bar_submenu_text_color, :class=>'set_color',:type=>'color',:value=>@site.orbit_bar_submenu_text_color%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('preferences.is_hidden_orbit_bar') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%if @site.is_hidden_orbit_bar%>
|
||||||
|
<%= f.check_box :is_hidden_orbit_bar ,:checked=>'checked'%>
|
||||||
|
<%else%>
|
||||||
|
<%= f.check_box :is_hidden_orbit_bar ,:checked=>false%>
|
||||||
|
<%end%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('preferences.orbit_bar_animation_time') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :orbit_bar_animation_time ,:value=>@site.orbit_bar_animation_time %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted">Orbit <%= t('preferences.site_logo') %>(second image or the only one image)</label>
|
<label class="control-label muted">Orbit <%= t('preferences.site_logo') %>(second image or the only one image)</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class MembersController < ApplicationController
|
class MembersController < ApplicationController
|
||||||
helper_method :current_user
|
helper_method :current_user
|
||||||
|
include AttributeValuesHelper
|
||||||
def index
|
def index
|
||||||
page_roles = OrbitHelper.page_categories
|
page_roles = OrbitHelper.page_categories
|
||||||
page_role_status = OrbitHelper.page_role_status
|
page_role_status = OrbitHelper.page_role_status
|
||||||
|
@ -15,22 +16,8 @@ class MembersController < ApplicationController
|
||||||
member_sort_position = OrbitHelper.member_sort_position
|
member_sort_position = OrbitHelper.member_sort_position
|
||||||
sort = nil
|
sort = nil
|
||||||
if !member_sort_position
|
if !member_sort_position
|
||||||
# sort = "data['list_order']"
|
sort_select = fields_to_show.to_enum.with_index.select{|v| v[0]['key']=='name'}
|
||||||
# else
|
sort = sort_select.blank? ? nil : sort_select[0][1]
|
||||||
# sort = fields_to_show
|
|
||||||
# .collect.with_index{|field,idx| {'sort_order'=>field['sort_order'], 'index'=>idx}}
|
|
||||||
# .select{|field|!field['sort_order'].blank?}
|
|
||||||
# .sort_by{|field|field['sort_order']}
|
|
||||||
# .collect.with_index{|field| "data['profile_data'][#{field['index']}]['sort_value'] rescue 0"}
|
|
||||||
# # sort = "[(data['first_name'][0])]"
|
|
||||||
|
|
||||||
# sort = '[('+sort.join('),(')+')]'
|
|
||||||
fields_to_show.each_with_index do |field, idx|
|
|
||||||
if field["key"] == "name"
|
|
||||||
# sort = "[(data['profile_data'][idx]['sort_value'] rescue 0)]"
|
|
||||||
sort = idx
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if page_roles.include?("all")
|
if page_roles.include?("all")
|
||||||
roles = Role.all.asc(:key).collect do |role|
|
roles = Role.all.asc(:key).collect do |role|
|
||||||
|
@ -38,7 +25,7 @@ class MembersController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
page_role_status.each do |status_id|
|
page_role_status.each do |status_id|
|
||||||
page_roles << RoleStatus.find(status_id).role.id.to_s
|
page_roles << (RoleStatus.find(status_id).role.id.to_s rescue '')
|
||||||
end
|
end
|
||||||
roles = Role.where(:id.in => page_roles.uniq).asc(:key).collect do |role|
|
roles = Role.where(:id.in => page_roles.uniq).asc(:key).collect do |role|
|
||||||
{ "title" => role.title, "id" => role.id, "status" => RoleStatus.where(:role_id=>role, :_id.in=>page_role_status).asc(:key).to_a }
|
{ "title" => role.title, "id" => role.id, "status" => RoleStatus.where(:role_id=>role, :_id.in=>page_role_status).asc(:key).to_a }
|
||||||
|
@ -134,14 +121,14 @@ class MembersController < ApplicationController
|
||||||
def get_member_data(member, fields_to_show)
|
def get_member_data(member, fields_to_show)
|
||||||
image = member.avatar.present? ? member.avatar.thumb.url : ActionController::Base.helpers.asset_path('member-pic.png')
|
image = member.avatar.present? ? member.avatar.thumb.url : ActionController::Base.helpers.asset_path('member-pic.png')
|
||||||
member_data_return = member_data(member, fields_to_show)
|
member_data_return = member_data(member, fields_to_show)
|
||||||
if !member_data_return.nil? && (!member_data_return.empty? rescue false)
|
if !member_data_return.blank?
|
||||||
{
|
{
|
||||||
'profile_data'=> member_data_return,
|
'profile_data'=> member_data_return,
|
||||||
'list_order' => member.position,
|
'list_order' => member.position,
|
||||||
'name' => member.name,
|
'name' => member.name,
|
||||||
'image'=>image,
|
'image'=>image,
|
||||||
"link_to_show" => OrbitHelper.url_to_show(member.to_param)
|
"link_to_show" => OrbitHelper.url_to_show(member.to_param)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
@ -149,7 +136,7 @@ class MembersController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
member = MemberProfile.find_by(uid: params[:uid])
|
member = MemberProfile.find_by(uid: params[:uid]) rescue nil
|
||||||
page = Page.where(:page_id => params[:page_id]).first rescue nil
|
page = Page.where(:page_id => params[:page_id]).first rescue nil
|
||||||
|
|
||||||
profile_data = []
|
profile_data = []
|
||||||
|
@ -162,8 +149,10 @@ class MembersController < ApplicationController
|
||||||
role_status = member.role_statuses.where(role_id: role.id).map{|t|t.title.to_s}.join(',') rescue ''
|
role_status = member.role_statuses.where(role_id: role.id).map{|t|t.title.to_s}.join(',') rescue ''
|
||||||
profile_data = profile_data.push({"key"=>"role_status", "title"=>"", "value"=> role_status, "title_class"=>"member-data-title-role-status", "value_class"=>"member-data-value-role-status"}) if !role_status.blank?
|
profile_data = profile_data.push({"key"=>"role_status", "title"=>"", "value"=> role_status, "title_class"=>"member-data-title-role-status", "value_class"=>"member-data-value-role-status"}) if !role_status.blank?
|
||||||
if fields_to_show.blank?
|
if fields_to_show.blank?
|
||||||
attribute_field = role.attribute_fields.where(:key => 'job_title').first
|
attribute_field = role.attribute_fields.first
|
||||||
profile_data = profile_data + member_data(member, [{"id"=> attribute_field.id.to_s, "key"=> attribute_field.key, "type"=>"role"}]) if !attribute_field.blank? and !attribute_field.to_show.blank?
|
if !attribute_field.blank? && !attribute_field.to_show.blank?
|
||||||
|
profile_data = profile_data + member_data(member, [{"id"=> attribute_field.id.to_s, "key"=> attribute_field.key.to_s, "type"=>"role"}])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fields_to_show.blank?
|
if fields_to_show.blank?
|
||||||
|
@ -190,7 +179,7 @@ class MembersController < ApplicationController
|
||||||
role_fields_to_show = []
|
role_fields_to_show = []
|
||||||
member.roles.where(:disabled => false).asc("_id").collect do |role|
|
member.roles.where(:disabled => false).asc("_id").collect do |role|
|
||||||
role.attribute_fields.where(:key.ne => 'job_title').asc("_id").each do |attribute_field|
|
role.attribute_fields.where(:key.ne => 'job_title').asc("_id").each do |attribute_field|
|
||||||
role_fields_to_show << {"id"=> attribute_field.id.to_s, "key"=> attribute_field.key, "type"=>"role"} if !attribute_field.to_show.blank?
|
role_fields_to_show << {"id"=> attribute_field.id.to_s,"key"=> attribute_field.key.to_s, "type"=>"role"} if !attribute_field.to_show.blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
profile_data = profile_data + member_data(member, role_fields_to_show)
|
profile_data = profile_data + member_data(member, role_fields_to_show)
|
||||||
|
@ -337,120 +326,113 @@ class MembersController < ApplicationController
|
||||||
def member_data(member, fields_to_show)
|
def member_data(member, fields_to_show)
|
||||||
profile_data = []
|
profile_data = []
|
||||||
fields_to_show.each do |field|
|
fields_to_show.each do |field|
|
||||||
privacy_approved_status = true
|
privacy_approved_status = true
|
||||||
if field['type'] != 'role'
|
if field['type'] != 'role'
|
||||||
field_key = field["key"]
|
field_key = field["key"]
|
||||||
else
|
else
|
||||||
field_key = field["id"]
|
field_key = field["id"]
|
||||||
end
|
end
|
||||||
privacy_approved_status = false if member.get_privacy_type_for_field(field_key) != "public"
|
privacy_approved_status = false if member.get_privacy_type_for_field(field_key) != "public"
|
||||||
if !OrbitHelper.current_user.nil?
|
if !OrbitHelper.current_user.nil?
|
||||||
if(member.get_privacy_type_for_field(field_key) == "logged_in")
|
if(member.get_privacy_type_for_field(field_key) == "logged_in")
|
||||||
privacy_approved_status = true
|
privacy_approved_status = true
|
||||||
elsif(member.get_privacy_type_for_field(field_key) == "locked")
|
elsif(member.get_privacy_type_for_field(field_key) == "locked")
|
||||||
if member.user.id == OrbitHelper.current_user.id || OrbitHelper.current_user.is_admin?
|
if member.user.id == OrbitHelper.current_user.id || OrbitHelper.current_user.is_admin?
|
||||||
privacy_approved_status = true
|
privacy_approved_status = true
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if member.get_privacy_type_for_field(field_key) == "default"
|
|
||||||
if field['type'] != 'role'
|
|
||||||
privacy_approved_status = true #Todo: set not role field's default privacy_approved_status
|
|
||||||
else
|
|
||||||
case AttributeField.find(field["id"]).privacy_default
|
|
||||||
when 'public'
|
|
||||||
privacy_approved_status = true
|
|
||||||
when 'logged_in'
|
|
||||||
privacy_approved_status = true if !OrbitHelper.current_user.nil?
|
|
||||||
when 'locked'
|
|
||||||
if !OrbitHelper.current_user.nil?
|
|
||||||
privacy_approved_status = true if member.user.id == OrbitHelper.current_user.id || OrbitHelper.current_user.is_admin?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
case field['type']
|
|
||||||
when 'profile'
|
|
||||||
next if !privacy_approved_status
|
|
||||||
field_data = member.get_attribute_data(field) rescue {}
|
|
||||||
when 'custom'
|
|
||||||
if !field['id'].blank?
|
|
||||||
next if !privacy_approved_status
|
|
||||||
field_data = member.member_profile_field_values.find_by(:member_profile_field_id=>field['id'],:key=>field['key']).get_field_value rescue {"value" => " "}
|
|
||||||
else
|
|
||||||
field_data = member.member_profile_field_values.find_by(:key=>field['key']).get_field_value rescue {"value" => " "}
|
|
||||||
end
|
end
|
||||||
when 'role'
|
end
|
||||||
if !field['id'].blank?
|
end
|
||||||
next if !privacy_approved_status
|
if member.get_privacy_type_for_field(field_key) == "default"
|
||||||
av = member.attribute_values.find_by(:attribute_field_id=>field['id'],:key=>field['key']) rescue nil
|
if field['type'] != 'role'
|
||||||
av = member.attribute_values.find_by(:attribute_field_id=>field['id']) rescue nil if av.nil? #some role's key has been changed to sort number,so it doesn't work when searching field from using its key
|
privacy_approved_status = true #Todo: set not role field's default privacy_approved_status
|
||||||
field_data = {"value" => " "}
|
else
|
||||||
|
case (AttributeField.find(field["id"]).privacy_default rescue nil)
|
||||||
|
when 'public'
|
||||||
|
privacy_approved_status = true
|
||||||
|
when 'logged_in'
|
||||||
|
privacy_approved_status = true if !OrbitHelper.current_user.nil?
|
||||||
|
when 'locked'
|
||||||
|
if !OrbitHelper.current_user.nil?
|
||||||
|
privacy_approved_status = true if member.user.id == OrbitHelper.current_user.id || OrbitHelper.current_user.is_admin?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
case field['type']
|
||||||
|
when 'profile'
|
||||||
|
next if !privacy_approved_status
|
||||||
|
field_data = member.get_attribute_data(field) rescue {}
|
||||||
|
when 'custom'
|
||||||
|
if !field['id'].blank?
|
||||||
|
next if !privacy_approved_status
|
||||||
|
field_data = member.member_profile_field_values.find_by(:member_profile_field_id=>field['id'],:key=>field['key']).get_field_value rescue {"value" => " "}
|
||||||
|
else
|
||||||
|
field_data = member.member_profile_field_values.find_by(:key=>field['key']).get_field_value rescue {"value" => " "}
|
||||||
|
end
|
||||||
|
when 'role'
|
||||||
|
av = member.attribute_values.find_by(:attribute_field_id=>field['id']) rescue nil #some role's key has been changed to sort number,so it doesn't work when searching field from using its key
|
||||||
|
field_data = {"value" => " "}
|
||||||
|
if !av.nil?
|
||||||
|
next if !privacy_approved_status
|
||||||
|
r = av.attribute_field.role rescue nil
|
||||||
|
if !r.nil?
|
||||||
|
if member.roles.include?(r)
|
||||||
|
field_data = av.get_field_value(member) rescue {"value" => " "}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
avs = member.attribute_values.find_by(:key=>field['key']) rescue []
|
||||||
|
avs.each do |av|
|
||||||
if !av.nil?
|
if !av.nil?
|
||||||
r = av.attribute_field.role rescue nil
|
r = av.attribute_field.role rescue nil
|
||||||
if !r.nil?
|
if !r.nil? && member.roles.include?(r)
|
||||||
if member.roles.include?(r)
|
field_data = av.get_field_value(member) rescue {"value" => " "}
|
||||||
field_data = av.get_field_value rescue {"value" => " "}
|
break
|
||||||
else
|
|
||||||
field_data = {"value" => " "}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
field_data = {"value" => " "}
|
|
||||||
end
|
end
|
||||||
else
|
|
||||||
field_data = {"value" => " "}
|
|
||||||
end
|
end
|
||||||
else
|
end
|
||||||
avs = member.attribute_values.where(:key=>field['key']) rescue nil
|
if avs.blank? && !field['id'].nil?
|
||||||
field_data = {"value" => " "}
|
attr_field = AttributeField.find(field['id']) rescue nil
|
||||||
avs.each do |av|
|
if !attr_field.blank? && attr_field.markup.eql?("member_relationship")
|
||||||
if !av.nil?
|
field_data = {
|
||||||
r = av.attribute_field.role rescue nil
|
"key" => attr_field.key,
|
||||||
if !r.nil?
|
"title" => attr_field.title,
|
||||||
if member.roles.include?(r)
|
"value" => get_member_show(attr_field.get_member_relationship(member.id.to_s))
|
||||||
field_data = av.get_field_value rescue {"value" => " "}
|
}
|
||||||
break
|
if field_data['value'].blank?
|
||||||
else
|
field_data['value'] = ' '
|
||||||
field_data = {"value" => " "}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
field_data = {"value" => " "}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
field_data = {"value" => " "}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next if field_data.blank? or field_data['value'].blank? or (OrbitHelper.params[:target_action] == "show" && field_data['value'] == " ")
|
end
|
||||||
|
next if field_data.blank? || field_data['value'].blank? || (OrbitHelper.params[:target_action] == "show" && field_data['value'] == " ")
|
||||||
|
|
||||||
if field['sort_order']
|
if field['sort_order']
|
||||||
field_data['sort_value'] = field_data['val'].blank? ? field_data['value'] : field_data['val']
|
field_data['sort_value'] = field_data['val'].blank? ? field_data['value'] : field_data['val']
|
||||||
if !field_data['sort_value'].is_a?(Hash)
|
if !field_data['sort_value'].is_a?(Hash)
|
||||||
if field_data['sort_value'].is_a?(Integer) || (field_data['sort_value'].is_i? rescue false)
|
if field_data['sort_value'].is_a?(Integer) || (field_data['sort_value'].is_i? rescue false)
|
||||||
field_data['sort_value'] = field_data['sort_value'].to_i rescue field_data['sort_value']
|
field_data['sort_value'] = field_data['sort_value'].to_i rescue field_data['sort_value']
|
||||||
else
|
elsif I18n.locale == :zh_tw
|
||||||
if I18n.locale == :zh_tw
|
field_data['sort_value'] = field_data['sort_value'].strip.encode("Big5") rescue "簡".encode("Big5")
|
||||||
field_data['sort_value'] = field_data['sort_value'].strip.encode("Big5") rescue "簡".encode("Big5")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@current_field_value = field_data['value']
|
@current_field_value = field_data['value']
|
||||||
if (@current_field_value.gsub(' ','').strip rescue nil) == ""
|
if (@current_field_value.gsub(' ','').strip rescue nil) == ""
|
||||||
@locale = I18n.locale
|
@locale = I18n.locale
|
||||||
@site_in_use_locales = current_site.in_use_locales
|
@site_in_use_locales = current_site.in_use_locales
|
||||||
@new_field_data = Hash.new
|
@new_field_data = Hash.new
|
||||||
@site_in_use_locales.each_with_index do |locale,i|
|
@site_in_use_locales.each_with_index do |locale,i|
|
||||||
I18n.locale = locale
|
I18n.locale = locale
|
||||||
@new_field_data = member.get_attribute_data(field) rescue {}
|
@new_field_data = member.get_attribute_data(field) rescue {}
|
||||||
break if @new_field_data['value'].to_s.gsub(' ','').strip !=""
|
break if @new_field_data['value'].to_s.gsub(' ','').strip !=""
|
||||||
end
|
end
|
||||||
field_data['value'] = @new_field_data['value'].nil? ? " " : @new_field_data['value']
|
field_data['value'] = @new_field_data['value'].nil? ? " " : @new_field_data['value']
|
||||||
I18n.locale = @locale
|
I18n.locale = @locale
|
||||||
end
|
end
|
||||||
if field['link_to_show']
|
if field['link_to_show']
|
||||||
if field_data['value'] == ' ' #空白欄位
|
if field_data['value'] == ' ' #空白欄位
|
||||||
field_data['value'] = "" #若無網站連結,刪除實驗室網站字樣
|
field_data['value'] = "" #若無網站連結,刪除實驗室網站字樣
|
||||||
field_data['title'] = "" #無網站連結,則不顯示
|
field_data['title'] = "" #無網站連結,則不顯示
|
||||||
elsif field_data['value'].include? 'href='
|
elsif field_data['value'].include? 'href='
|
||||||
|
@ -465,9 +447,9 @@ class MembersController < ApplicationController
|
||||||
field_data['value'] = (field_data['value'].length > field['max_length']) ? field_data['value'][0..field['max_length']]+'...' : field_data['value']
|
field_data['value'] = (field_data['value'].length > field['max_length']) ? field_data['value'][0..field['max_length']]+'...' : field_data['value']
|
||||||
end
|
end
|
||||||
|
|
||||||
field_data['title_class'] = "member-data-title-"+field['key'].underscore.gsub('_','-')
|
field_data['title_class'] = "member-data-title-"+field['key'].to_s.underscore.gsub('_','-')
|
||||||
field_data['value_class'] = "member-data-value-"+field['key'].underscore.gsub('_','-')
|
field_data['value_class'] = "member-data-value-"+field['key'].to_s.underscore.gsub('_','-')
|
||||||
if !field_data['title'].blank? && !field_data['value'].blank?
|
if !field_data['title'].blank? && !field_data['value'].blank?
|
||||||
profile_data.push(field_data)
|
profile_data.push(field_data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
class PageSet
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
belongs_to :site
|
||||||
|
field :auto_convert_flag, type: Boolean, :default => false
|
||||||
|
end
|
|
@ -4,7 +4,8 @@ class Site
|
||||||
include Slug
|
include Slug
|
||||||
|
|
||||||
DEBUG = false
|
DEBUG = false
|
||||||
|
has_many :page_sets, :autosave => true, :dependent => :destroy
|
||||||
|
accepts_nested_attributes_for :page_sets, :allow_destroy => true
|
||||||
field :title, as: :slug_title, type: String, localize: true
|
field :title, as: :slug_title, type: String, localize: true
|
||||||
field :school, type: String
|
field :school, type: String
|
||||||
field :department, type: String
|
field :department, type: String
|
||||||
|
@ -59,12 +60,45 @@ class Site
|
||||||
field :home_link_1, :type => String, :default=>"/"
|
field :home_link_1, :type => String, :default=>"/"
|
||||||
field :site_title, :type => Hash, :default=>{:zh_tw=>"主頁",:en=>"home_page"}
|
field :site_title, :type => Hash, :default=>{:zh_tw=>"主頁",:en=>"home_page"}
|
||||||
field :site_title_1, :type => Hash, :default=>{:zh_tw=>"主頁",:en=>"home_page"}
|
field :site_title_1, :type => Hash, :default=>{:zh_tw=>"主頁",:en=>"home_page"}
|
||||||
|
field :is_hidden_orbit_bar , type: Boolean, :default => false
|
||||||
|
field :orbit_bar_background_color , type: String, :default => ""
|
||||||
|
field :orbit_bar_text_color , type: String, :default => ""
|
||||||
|
field :orbit_bar_submenu_background_color , type: String, :default => ""
|
||||||
|
field :orbit_bar_submenu_text_color , type: String, :default => ""
|
||||||
|
field :orbit_bar_animation_time , type: String, :default => "0.3s"
|
||||||
mount_uploader :default_image, ImageUploader
|
mount_uploader :default_image, ImageUploader
|
||||||
mount_uploader :site_logo, ImageUploader
|
mount_uploader :site_logo, ImageUploader
|
||||||
mount_uploader :site_logo_1, ImageUploader
|
mount_uploader :site_logo_1, ImageUploader
|
||||||
mount_uploader :favicon, ImageUploader
|
mount_uploader :favicon, ImageUploader
|
||||||
mount_uploader :mobile_icon, ImageUploader
|
mount_uploader :mobile_icon, ImageUploader
|
||||||
|
after_initialize do
|
||||||
|
if !self.new_record?
|
||||||
|
if self.is_hidden_orbit_bar.nil?
|
||||||
|
self.is_hidden_orbit_bar = false
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
if self.orbit_bar_background_color.nil?
|
||||||
|
self.orbit_bar_background_color = ""
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
if self.orbit_bar_text_color.nil?
|
||||||
|
self.orbit_bar_text_color = ""
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
if self.orbit_bar_submenu_background_color.nil?
|
||||||
|
self.orbit_bar_submenu_background_color = ""
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
if self.orbit_bar_submenu_text_color.nil?
|
||||||
|
self.orbit_bar_submenu_text_color = ""
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
if self.orbit_bar_animation_time.nil?
|
||||||
|
self.orbit_bar_animation_time = "0.3s"
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
def register_site(url,university,department,email,country)
|
def register_site(url,university,department,email,country)
|
||||||
api_key = STORE_CONFIG[:store_settings]["api_key"]
|
api_key = STORE_CONFIG[:store_settings]["api_key"]
|
||||||
self.generate_site_token
|
self.generate_site_token
|
||||||
|
|
Loading…
Reference in New Issue