orbit4-5/app/models/site.rb

51 lines
2.0 KiB
Ruby
Raw Normal View History

2014-04-08 10:46:27 +00:00
class Site
include Mongoid::Document
include Mongoid::Timestamps
include Slug
2014-04-08 10:46:27 +00:00
field :title, as: :slug_title, type: String, localize: true
2014-04-08 10:46:27 +00:00
field :school, type: String
field :department, type: String
field :address, type: String
field :footer, localize: true
field :sub_menu, localize: true
field :site_map_link, type: String, :default => "/sitemap"
field :terms_of_use_link, type: String
2014-04-08 10:46:27 +00:00
field :google_analytics, type: String
field :in_use_locales, :type => Array
field :valid_locales, :type => Array
field :site_active, :type => Boolean
field :frontend_open, :type => Boolean, :default => true
field :backend_openness_on, :type => Boolean, :default => false
field :mobile_api_openness_on, :type => Boolean, :default => false
field :desktop_closed, :type => Boolean, :default => false
field :enable_language_detection, :type => Boolean, :default => false
2014-07-09 02:05:02 +00:00
field :enable_zh_cn, :type => Boolean, :default => true
field :default_locale, :default => "zh_tw"
field :mobile_on, :type => Boolean, :default => false
field :announcement_category, :type => Array, :default=>[]
field :mobile_bar_color, :type => Array, :default=>[]
field :phone_number, :type => Array,:default=>[]
field :title_always_on, :type => Boolean, :default => false
field :sitemap_menu_in_header, :type => Boolean, :default => false
field :enable_terms_of_use, :type => Boolean, :default => false
field :search,:type => Hash
field :site_settings
field :template, type: String
2014-10-27 11:07:01 +00:00
field :store_token
field :month_traffic_cache
mount_uploader :default_image, ImageUploader
mount_uploader :site_logo, ImageUploader
mount_uploader :favicon, ImageUploader
mount_uploader :mobile_icon, ImageUploader
2014-07-02 09:37:34 +00:00
def register_site(url,university,department,email,country)
api_key = STORE_CONFIG[:store_settings]["api_key"]
self.generate_site_token
store = Store.new(self.id.to_s,self.site_token,api_key)
store.post_client(self.id.to_s,self.site_token,self.title,url,university,department,email,country)
end
2014-04-08 10:46:27 +00:00
end