socialforge/app/views/memos/edit.html.erb

47 lines
2.2 KiB
Plaintext

<%= javascript_include_tag 'new_user'%>
<script>
$(function(){
limitStrsize('memo_subject',50);
limitStrsize('memo_content',5000);
});
function check_and_submit(){
if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() != "" ){
$("#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="display: none">
</div>
<div>
<textarea type="text" id="memo_subject" name="memo[subject]" 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]" 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>