2017-03-07 09:37:28 +00:00
|
|
|
class SiteRequest
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include Slug
|
|
|
|
|
|
|
|
field :site_id
|
|
|
|
field :host_with_rulingdigital, type: Boolean, default: false
|
|
|
|
field :server_details
|
2017-03-27 07:15:25 +00:00
|
|
|
field :maintenance, type: Boolean, default: false
|
|
|
|
field :maintenance_years, type: Integer
|
2017-03-07 09:37:28 +00:00
|
|
|
field :optional_modules, type: Array, default: []
|
|
|
|
field :custom_module, type: Boolean, default: false
|
|
|
|
field :custom_module_details
|
|
|
|
field :template_number
|
|
|
|
field :custom_template, type: Boolean, default: false
|
|
|
|
field :custom_template_details
|
|
|
|
field :rwd, type: Boolean, default: false
|
|
|
|
field :sites_to_add, type: Array, default: []
|
2017-03-10 06:53:25 +00:00
|
|
|
field :sites_added, type: Array, default: []
|
2017-03-07 09:37:28 +00:00
|
|
|
field :completed, type: Boolean, :default => false
|
|
|
|
field :type
|
2017-10-09 09:44:59 +00:00
|
|
|
field :site_title
|
|
|
|
field :upgrade_r2_site
|
|
|
|
field :new_site_url
|
2017-03-07 09:37:28 +00:00
|
|
|
|
|
|
|
belongs_to :site_purchase
|
|
|
|
belongs_to :request_contract
|
|
|
|
|
|
|
|
belongs_to :c_panel_user
|
|
|
|
|
2017-10-09 09:44:59 +00:00
|
|
|
has_one :site_timeline
|
2017-11-28 11:47:23 +00:00
|
|
|
has_many :project_posts
|
2017-10-09 09:44:59 +00:00
|
|
|
|
2017-03-07 09:37:28 +00:00
|
|
|
def get_site
|
2017-10-09 09:44:59 +00:00
|
|
|
self.site_id == "newsite" || self.site_id == "upgrade" ? nil : (RegisteredSite.find(self.site_id) rescue nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_r2_site_link
|
|
|
|
if self.upgrade_r2_site.starts_with?("http://") || self.upgrade_r2_site.starts_with?("https://")
|
|
|
|
self.upgrade_r2_site
|
|
|
|
else
|
|
|
|
"http://#{self.upgrade_r2_site}"
|
|
|
|
end
|
2017-03-07 09:37:28 +00:00
|
|
|
end
|
|
|
|
|
2017-03-10 06:53:25 +00:00
|
|
|
def get_request_type
|
2017-03-07 09:37:28 +00:00
|
|
|
case self.type
|
2017-10-09 09:44:59 +00:00
|
|
|
when "upgrade"
|
|
|
|
t = "Upgrade"
|
2017-03-07 09:37:28 +00:00
|
|
|
when "newsite"
|
|
|
|
t = "New Site"
|
|
|
|
when "existing"
|
|
|
|
t = "New Feature"
|
|
|
|
when "addsites"
|
|
|
|
t = "Sites Addition"
|
|
|
|
end
|
|
|
|
t
|
|
|
|
end
|
|
|
|
end
|