Fix bug.
This commit is contained in:
parent
37fafc48e6
commit
c3f291ea9e
|
@ -11,6 +11,7 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
super
|
super
|
||||||
@app_title = "client_management"
|
@app_title = "client_management"
|
||||||
end
|
end
|
||||||
|
Is_Rails5 = (Rails.version.to_i > 4)
|
||||||
def can_use
|
def can_use
|
||||||
ClientManagerSetting.create if ClientManagerSetting.count == 0
|
ClientManagerSetting.create if ClientManagerSetting.count == 0
|
||||||
setting = ClientManagerSetting.first
|
setting = ClientManagerSetting.first
|
||||||
|
@ -52,7 +53,11 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
setting_params = params.require(:client_manager_setting).permit!
|
setting_params = params.require(:client_manager_setting).permit!
|
||||||
setting = ClientManagerSetting.first
|
setting = ClientManagerSetting.first
|
||||||
setting.update_attributes(setting_params)
|
setting.update_attributes(setting_params)
|
||||||
redirect_to :back
|
if Is_Rails5
|
||||||
|
redirect_back(fallback_location: { action: "setting"})
|
||||||
|
else
|
||||||
|
redirect_to :back and return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def upload_cert
|
def upload_cert
|
||||||
@site_cert = SiteCert.new
|
@site_cert = SiteCert.new
|
||||||
|
@ -294,7 +299,11 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
redirect_to admin_site_panel_edit_site_path(:id=>params[:id],:type=>'detail',:status=>'changing') and return
|
redirect_to admin_site_panel_edit_site_path(:id=>params[:id],:type=>'detail',:status=>'changing') and return
|
||||||
elsif params[:type] == 'delete_from_list'
|
elsif params[:type] == 'delete_from_list'
|
||||||
SiteConstruct.find(params[:id]).destroy
|
SiteConstruct.find(params[:id]).destroy
|
||||||
redirect_to :back and return
|
if Is_Rails5
|
||||||
|
redirect_back(fallback_location: { action: "sites_list"})
|
||||||
|
else
|
||||||
|
redirect_to :back and return
|
||||||
|
end
|
||||||
elsif params[:type] == 'select_cert'
|
elsif params[:type] == 'select_cert'
|
||||||
is_certbot = true
|
is_certbot = true
|
||||||
if params[:server_names]
|
if params[:server_names]
|
||||||
|
|
|
@ -138,10 +138,13 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var user_name_relations = {};
|
||||||
var domain_name_relations = {};
|
var domain_name_relations = {};
|
||||||
var pre_site_name = '';
|
var pre_site_name = '';
|
||||||
|
var active_user_name = '<%= SiteServer.first.account rescue 'rulingcom' %>';
|
||||||
<% SiteServer.all.each do |server_server| %>
|
<% SiteServer.all.each do |server_server| %>
|
||||||
domain_name_relations['<%= server_server.server_name %>'] = <%= server_server.domain_names.inspect.html_safe %>;
|
domain_name_relations['<%= server_server.server_name %>'] = <%= server_server.domain_names.inspect.html_safe %>;
|
||||||
|
user_name_relations['<%= server_server.server_name %>'] = <%= server_server.account.inspect.html_safe %>;
|
||||||
<% end %>
|
<% end %>
|
||||||
function unique(array) {
|
function unique(array) {
|
||||||
return $.grep(array, function(el, index) {
|
return $.grep(array, function(el, index) {
|
||||||
|
@ -182,9 +185,9 @@
|
||||||
var school = $("#school_name").val();
|
var school = $("#school_name").val();
|
||||||
type = (type == "School" ? "school_sites" : "orbit_sites" );
|
type = (type == "School" ? "school_sites" : "orbit_sites" );
|
||||||
if(school != ""){
|
if(school != ""){
|
||||||
$("#path").val("/home/rulingcom/" + type + "/" + school);
|
$("#path").val("/home/"+active_user_name+"/" + type + "/" + school);
|
||||||
}else{
|
}else{
|
||||||
$("#path").val("/home/rulingcom/" + type);
|
$("#path").val("/home/"+active_user_name+"/" + type);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
function add_change_event_for_root_domain(){
|
function add_change_event_for_root_domain(){
|
||||||
|
@ -198,8 +201,10 @@
|
||||||
}
|
}
|
||||||
add_change_event_for_root_domain()
|
add_change_event_for_root_domain()
|
||||||
$('#site_construct_server_type').change(function(){
|
$('#site_construct_server_type').change(function(){
|
||||||
var domain_name = domain_name_relations[$(this).val()][0];
|
var server_name = $(this).val();
|
||||||
var domain_names = domain_name_relations[$(this).val()];
|
active_user_name = user_name_relations[server_name];
|
||||||
|
var domain_name = domain_name_relations[server_name][0];
|
||||||
|
var domain_names = domain_name_relations[server_name];
|
||||||
$(".root_domain").find('option').remove()
|
$(".root_domain").find('option').remove()
|
||||||
$.each(domain_names,function(i,v){
|
$.each(domain_names,function(i,v){
|
||||||
var o = new Option(v, v);
|
var o = new Option(v, v);
|
||||||
|
@ -232,16 +237,16 @@
|
||||||
$("#db_name").val(val);
|
$("#db_name").val(val);
|
||||||
type = (type == "School" ? "school_sites" : "orbit_sites" );
|
type = (type == "School" ? "school_sites" : "orbit_sites" );
|
||||||
if(school != ""){
|
if(school != ""){
|
||||||
$("#path").val("/home/rulingcom/" + type + "/" + school);
|
$("#path").val("/home/"+active_user_name+"/" + type + "/" + school);
|
||||||
}else{
|
}else{
|
||||||
$("#path").val("/home/rulingcom/" + type);
|
$("#path").val("/home/"+active_user_name+"/" + type);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$("#school_name").on("input",function(){
|
$("#school_name").on("input",function(){
|
||||||
replace_input(this);
|
replace_input(this);
|
||||||
var school = $(this).val();
|
var school = $(this).val();
|
||||||
if(school != ""){
|
if(school != ""){
|
||||||
$("#path").val("/home/rulingcom/school_sites/" + school);
|
$("#path").val("/home/"+active_user_name+"/school_sites/" + school);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
function replace_input(ele){
|
function replace_input(ele){
|
||||||
|
@ -281,9 +286,9 @@
|
||||||
type = (type == "School" ? "school_sites" : "orbit_sites" );
|
type = (type == "School" ? "school_sites" : "orbit_sites" );
|
||||||
var school = $("#school_name").val();
|
var school = $("#school_name").val();
|
||||||
if(school != ""){
|
if(school != ""){
|
||||||
$("#path").val("/home/rulingcom/" + type + "/" + school);
|
$("#path").val("/home/"+active_user_name+"/" + type + "/" + school);
|
||||||
}else{
|
}else{
|
||||||
$("#path").val("/home/rulingcom/" + type);
|
$("#path").val("/home/"+active_user_name+"/" + type);
|
||||||
}
|
}
|
||||||
$('#site_construct_domain_name').val(unique(
|
$('#site_construct_domain_name').val(unique(
|
||||||
$.map($('.domain_name'),function(v,i){
|
$.map($('.domain_name'),function(v,i){
|
||||||
|
|
Loading…
Reference in New Issue