fix error

This commit is contained in:
chiu 2020-05-13 17:57:30 +08:00
parent 730b9ca196
commit 5c7e1fa3dd
1 changed files with 36 additions and 29 deletions

View File

@ -62,42 +62,49 @@ class Site
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 :is_hidden_orbit_bar , type: Boolean, :default => false
field :orbit_bar_background_color , type: String, :default => "" field :orbit_bar_background_color , type: String, :default => ""
field :orbit_bar_text_color , type: String, :default => "" field :orbit_bar_text_color , type: String, :default => "#ffffff"
field :orbit_bar_submenu_background_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_submenu_text_color , type: String, :default => "#ffffff"
field :orbit_bar_animation_time , type: String, :default => "0.3s" field :orbit_bar_animation_time , type: String, :default => "0.3s"
field :login_text , type: String, :default => "", localize: true
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 after_initialize do |record|
if !self.new_record? if !record.new_record?
if self.is_hidden_orbit_bar.nil? if record.is_hidden_orbit_bar.nil?
self.is_hidden_orbit_bar = false record.is_hidden_orbit_bar = false
self.save record.save
end end
if self.orbit_bar_background_color.nil? if record.orbit_bar_background_color.nil?
self.orbit_bar_background_color = "" record.orbit_bar_background_color = ""
self.save record.save
end end
if self.orbit_bar_text_color.nil? if record.orbit_bar_text_color.nil?
self.orbit_bar_text_color = "" record.orbit_bar_text_color = ""
self.save record.save
end end
if self.orbit_bar_submenu_background_color.nil? if record.orbit_bar_submenu_background_color.nil?
self.orbit_bar_submenu_background_color = "" record.orbit_bar_submenu_background_color = ""
self.save record.save
end end
if self.orbit_bar_submenu_text_color.nil? if record.orbit_bar_submenu_text_color.nil?
self.orbit_bar_submenu_text_color = "" record.orbit_bar_submenu_text_color = ""
self.save record.save
end end
if self.orbit_bar_animation_time.nil? if record.orbit_bar_animation_time.nil?
self.orbit_bar_animation_time = "0.3s" record.orbit_bar_animation_time = "0.3s"
self.save record.save
end end
end end
if record.orbit_bar_background_color == '#000000' && record.orbit_bar_text_color == '#000000'
record.update(:orbit_bar_text_color => '#ffffff')
end
if record.orbit_bar_submenu_background_color == '#000000' && record.orbit_bar_submenu_text_color == '#000000'
record.update(:orbit_bar_submenu_text_color => '#ffffff')
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"]