This commit is contained in:
BoHung Chiu 2023-02-03 13:45:11 +08:00
parent 059747abf9
commit 2a62d9b5d4
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@ class SiteConstruct
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
def self.server_types def self.server_types
SiteServer.all.map{|s| s.server_name} SiteServer.where(:active.ne=>false).map{|s| s.server_name}
end end
SITE_TYPES = ["School","Gravity"] SITE_TYPES = ["School","Gravity"]
field :enable_redirect_default_domain, type: Integer, default: 0 #0 => use default, 1 => disable, 2 => enable field :enable_redirect_default_domain, type: Integer, default: 0 #0 => use default, 1 => disable, 2 => enable

View File

@ -37,10 +37,11 @@
<%= f.hidden_field :copy_id, :value => params[:copy_id] %> <%= f.hidden_field :copy_id, :value => params[:copy_id] %>
</div> </div>
<% end %> <% end %>
<% server_types = SiteConstruct.server_types %>
<div class="control-group"> <div class="control-group">
<%= f.label :server_type ,"Server", :class => "control-label muted" %> <%= f.label :server_type ,"Server", :class => "control-label muted" %>
<div class="controls"> <div class="controls">
<%= f.select :server_type, SiteConstruct.server_types %> <%= f.select :server_type, server_types %>
</div> </div>
</div> </div>
@ -49,7 +50,7 @@
<div class="controls" id="root_domain_group"> <div class="controls" id="root_domain_group">
<div class="root_domain_group"> <div class="root_domain_group">
<%= select_tag :root_domain, <%= select_tag :root_domain,
options_for_select((SiteServer.first.domain_names.collect{ |u| [u, u] } rescue [])), options_for_select((SiteServer.where(:server_name=>server_types.first).first.domain_names.collect{ |u| [u, u] } rescue [])),
:class => "root_domain" %> :class => "root_domain" %>
</div> </div>
<%= button_tag 'add root domain',:type => 'button', :id => 'add_root_domain',class: 'btn btn-info',:style => 'margin-top: 1em;' %> <%= button_tag 'add root domain',:type => 'button', :id => 'add_root_domain',class: 'btn btn-info',:style => 'margin-top: 1em;' %>