55 lines
2.0 KiB
Plaintext
55 lines
2.0 KiB
Plaintext
<div style="width:460px;">
|
|
<div class="sy_popup_top">
|
|
<h3 class="fl">新建贴吧</h3>
|
|
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<div class="muban_popup_con mt15" >
|
|
<%= labelled_form_for @forum, :html => {:id => "forum_new"} do |f| %>
|
|
<%= render :partial => "forums/form", :locals => {:f => f} %>
|
|
<% end %>
|
|
<%#= form_tag({:controller => 'forums', :action => 'create'}, :method => 'post', :id => "forum_new") do |f| %>
|
|
|
|
<%# end %>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
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_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 %>',
|
|
type:'get',
|
|
data:{
|
|
forum_name:$("#forum_name").val().trim()
|
|
},
|
|
success:function(data){
|
|
if(data.result == true){
|
|
alert("提交成功");
|
|
$("#forum_new").submit();
|
|
hideModal();
|
|
return true;
|
|
}else{
|
|
alert("提交失败");
|
|
$("#forum_name_error_tips").html("贴吧名称已存在").show();
|
|
return false;
|
|
}
|
|
},
|
|
error:function(){
|
|
alert('请检查当前网络连接')
|
|
}
|
|
});
|
|
}
|
|
}
|
|
</script> |