59 lines
1.5 KiB
Ruby
59 lines
1.5 KiB
Ruby
class SiteRequest
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
include Slug
|
|
|
|
field :site_id
|
|
field :host_with_rulingdigital, type: Boolean, default: false
|
|
field :server_details
|
|
field :maintenance, type: Boolean, default: false
|
|
field :maintenance_years, type: Integer
|
|
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: []
|
|
field :sites_added, type: Array, default: []
|
|
field :completed, type: Boolean, :default => false
|
|
field :type
|
|
field :site_title
|
|
field :upgrade_r2_site
|
|
field :new_site_url
|
|
|
|
belongs_to :site_purchase
|
|
belongs_to :request_contract
|
|
|
|
belongs_to :c_panel_user
|
|
|
|
has_one :site_timeline
|
|
has_many :project_posts
|
|
|
|
def get_site
|
|
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
|
|
end
|
|
|
|
def get_request_type
|
|
case self.type
|
|
when "upgrade"
|
|
t = "Upgrade"
|
|
when "newsite"
|
|
t = "New Site"
|
|
when "existing"
|
|
t = "New Feature"
|
|
when "addsites"
|
|
t = "Sites Addition"
|
|
end
|
|
t
|
|
end
|
|
end |