70 lines
3.6 KiB
Plaintext
70 lines
3.6 KiB
Plaintext
<ul class="newuploadbox">
|
||
<li class="mb10 clear">
|
||
<label class="fl" style="width: 90px;text-align: right;">贴吧名称 : </label>
|
||
<!--<input maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" >-->
|
||
<%= f.text_field :name, :label => "", :name => "forum[name]", :id => "forum_name", :onblur => "check_forum_name()", :class => "issues_calendar_input fl", :style => "width:320px;height:28px;", :placeholder => "请输入贴吧名称,最多50个字符", :onfocus => "$('#forum_name_error_tips').hide();" %>
|
||
<!--<input type="text" name="forum[name]" id="forum_name" onfocus="$('#forum_name_error_tips').hide();" placeholder="请输入贴吧名称,最多50个字符" class="issues_calendar_input fl" style="width:320px;height:28px;">-->
|
||
<div class="clear"></div>
|
||
<p class="c_red ml90" style="display: none" id="forum_name_error_tips"></p>
|
||
</li>
|
||
<li class=" clear">
|
||
<label class="fl" style="width: 90px;text-align: right;">贴吧描述 : </label>
|
||
<%= f.text_area :description, :label => "", :maxlength => "5000", :name => "forum[description]", :id => "forum_desc", :class => "mr15 mb10 fl newupload_textarea", :style => "width:320px;height:100px;", :placeholder => "请输入新建贴吧描述,最多5000个字符", :onfocus => "$('#forum_description_error_tips').hide();" %>
|
||
<div class="clear"></div>
|
||
<p class="c_red ml90" style="display: none" id="forum_description_error_tips"></p>
|
||
</li>
|
||
|
||
</ul>
|
||
<div class="clear mr45 mb10">
|
||
<a href="javascript:void(0);" class="btn fr" onclick="hideModal()" >取消</a>
|
||
<a href="javascript:void(0);" class="btn btn-blue fr mr5" onclick="forums_commit();">确定</a>
|
||
</div>
|
||
|
||
|
||
<script>
|
||
function check_forum_name(){
|
||
if ($("#forum_name").val().trim() == ""){
|
||
$("#forum_name_error_tips").html("贴吧名称不能为空").show();
|
||
}else if($("#forum_name").val().length > 50){
|
||
$("#forum_name_error_tips").html("贴吧名称不能超过50个字符").show();
|
||
}
|
||
}
|
||
function forums_commit(){
|
||
$("#forum_name_error_tips").hide();
|
||
$("#forum_description_error_tips").hide();
|
||
if ($("#forum_name").val().trim() == ""){
|
||
$("#forum_name_error_tips").html("贴吧名称不能为空").show();
|
||
}
|
||
else if($("#forum_name").val().length > 50){
|
||
$("#forum_name_error_tips").html("贴吧名称不能超过50个字符").show();
|
||
}
|
||
else if($("#forum_desc").val().trim() == ""){
|
||
$("#forum_description_error_tips").html("贴吧描述不能为空").show();
|
||
}
|
||
else if($("#forum_desc").val().length > 5000){
|
||
$("#forum_description_error_tips").html("贴吧描述不能超过5000个字符").show();
|
||
}
|
||
else{
|
||
$.ajax({
|
||
url:'<%= check_forum_name_forums_path(:forum_id => @forum.try(:id)) %>',
|
||
type:'get',
|
||
data:{
|
||
forum_name:$("#forum_name").val().trim()
|
||
},
|
||
success:function(data){
|
||
if(data.result == true){
|
||
$("#forum_new").submit();
|
||
hideModal();
|
||
return true;
|
||
}else{
|
||
$("#forum_name_error_tips").html("贴吧名称已存在").show();
|
||
return false;
|
||
}
|
||
},
|
||
error:function(){
|
||
alert('请检查当前网络连接')
|
||
}
|
||
});
|
||
}
|
||
}
|
||
</script> |