Merge branch 'dev_tieba' of https://git.trustie.net/jacknudt/trustieforge into dev_tieba

This commit is contained in:
huang 2016-12-29 17:19:27 +08:00
commit edee7adae3
2 changed files with 35 additions and 22 deletions

View File

@ -1,6 +1,6 @@
<div style="width:460px;">
<div class="sy_popup_top">
<h3 class="fl">欢迎加入项目</h3>
<h3 class="fl">新建贴吧</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
@ -8,17 +8,17 @@
<%= form_tag({:controller => 'forums', :action => 'create'}, :method => 'post', :id => "forum_new") do |f| %>
<ul class="newuploadbox">
<li class="mb10 clear">
<label class=" fl">贴吧名称&nbsp;&nbsp;:&nbsp;</label>
<label class="fl" style="width: 90px;text-align: right;">贴吧名称&nbsp;&nbsp;:&nbsp;</label>
<!--<input maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" >-->
<input type="text" name="forum[name]" id="forum_name" placeholder="请输入贴吧名称最多20个字符" class="issues_calendar_input fl " style="width:320px;">
<input type="text" name="forum[name]" id="forum_name" placeholder="请输入贴吧名称最多20个字符" class="issues_calendar_input fl " style="width:320px;height:28px;">
</li>
<li class=" clear">
<label class=" fl">贴吧描述&nbsp;&nbsp;:&nbsp;</label>
<label class="fl" style="width: 90px;text-align: right;">贴吧描述&nbsp;&nbsp;:&nbsp;</label>
<textarea type="text" name="forum[description]" id="forum_desc" maxlength="5000" class="mr15 mb10 fl newupload_textarea" style="width:320px; height:100px;" placeholder="请输入新建贴吧描述最多250个字符"></textarea>
<!--<textarea class="mr15 mb10 fl newupload_textarea " placeholder=" 请输入新建贴吧描述最多250个字符" style="width:320px; height:100px;"></textarea>-->
</li>
</ul>
<div class="clear mr45">
<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>

View File

@ -7,7 +7,8 @@
<div class="wenba-tiwen-con">
<ul >
<li class="mb10">
<input type="text" name="memo[subject]" id="memo_subject" maxlength="50" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="wenba-tiwen-input" placeholder="请输入标题">
<input type="text" name="memo[subject]" id="memo_subject" maxlength="50" style="width:708px" onblur="check_memo_name()" onfocus="$('#memo_name_error_tips').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="wenba-tiwen-input" placeholder="请输入标题">
<p class="c_red" style="display: none" id="memo_name_error_tips"></p>
<script>
var textarea1 = document.getElementById('memo_subject');
autoTextarea(textarea1);
@ -17,6 +18,7 @@
<%= kindeditor_tag 'memo[content]','', :height => 300, :editor_id => 'memo_content' %>
<!--<textarea placeholder="请输入描述详情" class="wenba-tiwen-textarea"></textarea>-->
</li>
<p class="c_red" style="display: none" id="memo_contents_error_tips"></p>
<li class="clear mb10">
<%= render :partial => 'forums/file_form', :locals => {:container => @memo} %>
<!--<button class="sub_btn fl" name="button" type="button">上传附件</button>-->
@ -24,7 +26,7 @@
</li>
</ul>
<ul class="wenba-tagbox clearfix">
<h3 class="mb5">请选择分类</h3>
<h3 class="mb5 c_red" id="memo_classify_tips">请选择分类</h3>
<% @forums.each do |forum| %>
<li><a href="javascript:void(0)" class="wenba-tiwen-tag" name="<%= forum.name %>" id="forums_question_<%= forum.id %>" onclick="add_forum('forums_question_<%= forum.id %>')" ><%= forum.name %></a></li>
<% end %>
@ -40,19 +42,23 @@
<script>
function add_forum(id){
$('a').removeClass("wenba-tiwen-tag-active");
$("#"+id).addClass("wenba-tiwen-tag-active");
$("#memo_classify_tips").attr('style','color: #333;');
$('a').removeClass("wenba-tiwen-tag-active");
$("#"+id).addClass("wenba-tiwen-tag-active");
}
function check_memo_name(){
if($("#memo_subject").val().trim().length > 50){
$("#error").html("主题 过长(最长为 50 个字符)").show();
$("#memo_name_error_tips").html("主题 过长(最长为 50 个字符)").show();
return false;
}
if(memo_content.html().length > 20000){
$("#error").html("内容 过长(最长为 20000 个字符)").show();
$("html,body").animate({scrollTop:$("#error").offset().top},1000)
$("#memo_contents_error_tips").html("内容 过长(最长为 20000 个字符)").show();
$("html,body").animate({scrollTop:$("#memo_contents_error_tips").offset().top},1000);
return false;
}
if($("#memo_subject").val().trim() == ""){
$("#memo_name_error_tips").html("标题不能为空").show();
}
return true;
}
@ -77,25 +83,32 @@
});
//$("#new_memo").submit();
}else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.isEmpty()){
$("#error").html("主题和内容不能为空").show();
$("#memo_error_tips").html("主题和内容不能为空").show();
}
else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){
$("#error").html("主题不能为空").show();
$("#memo_error_tips").html("主题不能为空").show();
}else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){
$("#error").html("内容不能为空").show();
$("#memo_error_tips").html("内容不能为空").show();
}
}
var first_click = true;
function memo_commit(){
$("#memo_name_error_tips").hide();
$("#memo_contents_error_tips").hide();
$("#memo_classify_tips").attr('style','color: #333;');
var f_name = $('.wenba-tiwen-tag-active').attr('name');
$("#forum_name").attr('name',f_name);
if ($("#forum_name").attr('name')== ""){
if($("#memo_subject").val().trim() != "" && !memo_content.isEmpty() && first_click && $("#forum_name").attr('name') != ""){
alert($("#forum_name").attr('name'));
// memo_content.sync();
// $("#new_memo").submit();
} else if($("#memo_subject").val().trim() == ""){
$("#memo_name_error_tips").html("标题不能为空").show();
}else if(memo_content.isEmpty()){
$("#memo_contents_error_tips").html("内容不能为空").show();
}else if ($("#forum_name").attr('name')== ""){
alert("请选择分类");
}
else{
alert($("#forum_name").attr('name'));
// memo_content.sync();
// $("#new_memo").submit();
$("#memo_classify_tips").attr('style','color: #F00;');
}
}
</script>