Fix bug.
This commit is contained in:
parent
563716fc43
commit
f40b9bd3f3
|
@ -67,13 +67,13 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :site_name ,"Site Name", :class => "control-label muted" %>
|
<%= f.label :site_name ,"Site Name", :class => "control-label muted" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :site_name, :id => "site_name", :placeholder => "xxx_xxx", :oninput=> "replace_domain_input(this)" %>
|
<%= f.text_field :site_name, :id => "site_name", :placeholder => "xxx_xxx", :oninput=> "replace_input(this)" %>
|
||||||
<div class="hint">schoolname_deptname eg: nctu_eed</div>
|
<div class="hint">schoolname_deptname eg: nctu_eed</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :domain_name ,"Domain Name", :class => "control-label muted", :oninput=> "replace_domain_input(this)" %>
|
<%= f.label :domain_name ,"Domain Name", :class => "control-label muted", :oninput=> "replace_input(this)" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="domain_group">
|
<div class="domain_group">
|
||||||
<input type="text" onchange="change_domain_input(this)" oninput="replace_domain_input(this)">
|
<input type="text" onchange="change_domain_input(this)" oninput="replace_domain_input(this)">
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
var current_root_domain_text = $('.root_domain_group').eq(index).find('select').val()
|
var current_root_domain_text = $('.root_domain_group').eq(index).find('select').val()
|
||||||
if ($input.val()==pre_site_name){
|
if ($input.val()==pre_site_name){
|
||||||
if($("#site_name").val() != ""){
|
if($("#site_name").val() != ""){
|
||||||
$input.val($("#site_name").val().replace("_","-") + ".");
|
$input.val($("#site_name").val().replaceAll("_","-") + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$('.domain_group').eq(index).find('input[type="hidden"]').val($('.domain_group').eq(index).find('input[type="text"]').val()+current_root_domain_text)
|
$('.domain_group').eq(index).find('input[type="hidden"]').val($('.domain_group').eq(index).find('input[type="text"]').val()+current_root_domain_text)
|
||||||
|
@ -204,7 +204,7 @@
|
||||||
|
|
||||||
//$('#domain_name').siblings('.hint').html('schoolname-deptname.'+domain_name+' eg: nctu-eed.'+domain_name);
|
//$('#domain_name').siblings('.hint').html('schoolname-deptname.'+domain_name+' eg: nctu-eed.'+domain_name);
|
||||||
change_domain_name('all');
|
change_domain_name('all');
|
||||||
pre_site_name = val.replace("_","-")+'.';
|
pre_site_name = val.replaceAll("_","-")+'.';
|
||||||
$("#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 != ""){
|
||||||
|
@ -214,16 +214,22 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$("#school_name").on("input",function(){
|
$("#school_name").on("input",function(){
|
||||||
|
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/rulingcom/school_sites/" + school);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
function replace_input(ele){
|
||||||
|
var correct_val = $(ele).val().match(/([0-9]||[a-z]||[-_])*/gi).join("");
|
||||||
|
$(ele).val(correct_val);
|
||||||
|
}
|
||||||
function replace_domain_input(ele){
|
function replace_domain_input(ele){
|
||||||
var correct_val = $(ele).val().match(/([0-9]||[a-z]||[-_.])*/gi).join("");
|
var correct_val = $(ele).val().match(/([0-9]||[a-z]||[-_.])*/gi).join("");
|
||||||
$(ele).val(correct_val.replace("_","-"));
|
$(ele).val(correct_val.replaceAll("_","-"));
|
||||||
}
|
}
|
||||||
function change_domain_input(ele){
|
function change_domain_input(ele){
|
||||||
|
replace_domain_input(ele);
|
||||||
change_domain_name($(ele).parents('.domain_group').index('.domain_group'))
|
change_domain_name($(ele).parents('.domain_group').index('.domain_group'))
|
||||||
}
|
}
|
||||||
$("#site_construct_site_type").val("School");
|
$("#site_construct_site_type").val("School");
|
||||||
|
|
Loading…
Reference in New Issue