diff --git a/app/models/site_construct.rb b/app/models/site_construct.rb index d52f2bc..eddb422 100644 --- a/app/models/site_construct.rb +++ b/app/models/site_construct.rb @@ -1,8 +1,9 @@ class SiteConstruct include Mongoid::Document include Mongoid::Timestamps - - SERVER_TYPES = SiteServer.all.map{|s| s.server_name} + def self.server_types + SiteServer.all.map{|s| s.server_name} + end SITE_TYPES = ["School","Gravity"] field :server_type diff --git a/app/models/site_server.rb b/app/models/site_server.rb index bbb6c16..6e1afd7 100644 --- a/app/models/site_server.rb +++ b/app/models/site_server.rb @@ -6,8 +6,21 @@ class SiteServer include OrbitModel::Status field :server_name , type: String ,default: '' field :domain_name , type: String ,default: '' + field :domain_names, type: Array, default: [] field :ip , type: String ,default: '' field :account , type: String ,default: '' field :password , type: String ,default: '' field :active , type: Boolean ,default: true + def domain_names + if self.domain_name != '' + [self.domain_name] + else + super + end + end + before_save do + if self.domain_name != '' && self.domain_names.length !=0 + self.domain_name = '' + end + end end \ No newline at end of file diff --git a/app/views/admin/site_panel/_form.html.erb b/app/views/admin/site_panel/_form.html.erb index d05e293..2db14f3 100644 --- a/app/views/admin/site_panel/_form.html.erb +++ b/app/views/admin/site_panel/_form.html.erb @@ -23,7 +23,16 @@