Merge branch 'dev_tieba' of https://git.trustie.net/jacknudt/trustieforge into dev_tieba
This commit is contained in:
commit
cc7f6b7d55
|
@ -6,7 +6,7 @@
|
|||
</div>
|
||||
<div class="muban_popup_con mt15" >
|
||||
<%= labelled_form_for @forum, :html => {:id => "forum_new"} do |f| %>
|
||||
<%= render :partial => "forums/form" %>
|
||||
<%= render :partial => "forums/form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
<%#= form_tag({:controller => 'forums', :action => 'create'}, :method => 'post', :id => "forum_new") do |f| %>
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
<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="输入贴吧名称" >-->
|
||||
<input type="text" name="forum[name]" value="<%= @forum.name %>" id="forum_name" onfocus="$('#forum_name_error_tips').hide();" placeholder="请输入贴吧名称,最多50个字符" class="issues_calendar_input fl" style="width:320px;height:28px;">
|
||||
<%= f.text_field :name, :label => "", :name => "forum[name]", :id => "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>
|
||||
<textarea type="text" name="forum[description]" id="forum_desc" maxlength="5000" class="mr15 mb10 fl newupload_textarea" style="width:320px; height:100px;" placeholder="请输入新建贴吧描述,最多5000个字符" onfocus="$('#forum_description_error_tips').hide();"><%= @forum.description.html_safe %></textarea>
|
||||
<!--<textarea class="mr15 mb10 fl newupload_textarea " placeholder=" 请输入新建贴吧描述,最多250个字符" style="width:320px; height:100px;"></textarea>-->
|
||||
<%= 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>
|
||||
|
@ -20,6 +20,7 @@
|
|||
<a href="javascript:void(0);" class="btn btn-blue fr mr5" onclick="forums_commit();">确定</a>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function forums_commit(){
|
||||
$("#forum_name_error_tips").hide();
|
||||
|
@ -42,12 +43,10 @@
|
|||
},
|
||||
success:function(data){
|
||||
if(data.result == true){
|
||||
alert("提交成功");
|
||||
$("#forum_new").submit();
|
||||
hideModal();
|
||||
return true;
|
||||
}else{
|
||||
alert("提交失败");
|
||||
$("#forum_name_error_tips").html("贴吧名称已存在").show();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -5,68 +5,8 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con mt15" >
|
||||
<%= form_tag({:controller => 'forums', :action => 'create'}, :method => 'post', :id => "forum_new") do |f| %>
|
||||
<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="输入贴吧名称" >-->
|
||||
<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>
|
||||
<textarea type="text" name="forum[description]" id="forum_desc" maxlength="5000" class="mr15 mb10 fl newupload_textarea" style="width:320px; height:100px;" placeholder="请输入新建贴吧描述,最多5000个字符" onfocus="$('#forum_description_error_tips').hide();"></textarea>
|
||||
<!--<textarea class="mr15 mb10 fl newupload_textarea " placeholder=" 请输入新建贴吧描述,最多250个字符" style="width:320px; height:100px;"></textarea>-->
|
||||
<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>
|
||||
<%= labelled_form_for @forum, :html => {:id => "forum_new", :remote => false} do |f| %>
|
||||
<%= render :partial => "form", :locals => {:f => 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>
|
Loading…
Reference in New Issue