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