58 lines
2.6 KiB
Plaintext
58 lines
2.6 KiB
Plaintext
<%= javascript_include_tag 'new_user'%>
|
|
<script>
|
|
|
|
function check_and_submit(){
|
|
if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() != "" ){
|
|
if($("textarea[name='memo[subject]']").val().trim().length > 50 ){
|
|
$("#error").html('主题不能超过50个字符').show();
|
|
return;
|
|
}
|
|
if($("textarea[name='memo[content]']").val().trim().length > 5000 ){
|
|
$("#error").html('内容不能超过5000个字符').show();
|
|
return;
|
|
}
|
|
$("#edit_memo").submit();
|
|
}else if($("textarea[name='memo[subject]']").val().trim() == "" && $("textarea[name='memo[content]']").val().trim() != "" ){
|
|
$("#error").html("主题不能为空").show();
|
|
}else if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() == ""){
|
|
$("#error").html("内容不能为空").show();
|
|
}
|
|
}
|
|
</script>
|
|
<div class="homepageRightBanner mt15">
|
|
<div class="NewsBannerName">编辑帖子</div>
|
|
</div>
|
|
<div class="postRightContainer" style="margin-top: 15px">
|
|
<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id=>'edit_memo'}) do |f| %>
|
|
<div id="error" style="color:red ;display: none">
|
|
|
|
</div>
|
|
<div>
|
|
<textarea type="text" id="memo_subject" name="memo[subject]" maxlength="50" class="postDetailInput" placeholder="对应帖子标题" ><%= @memo.subject%></textarea>
|
|
<script>
|
|
var ta = document.getElementById('memo_subject')
|
|
autoTextarea(ta)
|
|
</script>
|
|
</div>
|
|
<div class="mt15">
|
|
<textarea type="text" id="memo_content" name="memo[content]" maxlength="5000" class="postDetailInput" placeholder="对应帖子内容" ><%= @memo.content.html_safe%></textarea>
|
|
<script>
|
|
var ta1 = document.getElementById('memo_content')
|
|
autoTextarea(ta1)
|
|
</script>
|
|
</div>
|
|
<div class="mt10">
|
|
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">对应附件名称</a>-->
|
|
<%= render :partial => 'forums/file_form', :locals => {:container => @memo} %>
|
|
<div class="fr"><a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit();">确定</a></div>
|
|
<div class="fr"><a href="<%= forum_memo_path(@memo.forum,@memo)%>" class="linkGrey2 mr10">取消</a><span class="mr10 fontGrey">或</span></div>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<script>
|
|
$(function(){
|
|
limitStrsize('memo_subject',50);
|
|
limitStrsize('memo_content',5000);
|
|
});
|
|
</script> |