帖子的创建和编辑用编辑器
This commit is contained in:
parent
41a6b8ab06
commit
eacd37d986
|
@ -1,4 +1,4 @@
|
|||
<%= javascript_include_tag 'new_user' %>
|
||||
<%= javascript_include_tag 'new_user','/assets/kindeditor/pasteimg','/assets/kindeditor/kindeditor' %>
|
||||
<script>
|
||||
function add_class(id){
|
||||
if($("#"+id).hasClass("sortArrowActiveD")){
|
||||
|
@ -58,11 +58,15 @@
|
|||
if(!check_memo_name()){
|
||||
return;
|
||||
}
|
||||
if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() != "" ){
|
||||
if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.html().trim() != "" ){
|
||||
memo_content.sync();
|
||||
$("#new_memo").submit();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() == "" && $("textarea[name='memo[content]']").val().trim() != "" ){
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() == ""){
|
||||
$("#error").html("主题和内容不能为空").show();
|
||||
}
|
||||
else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() != "" ){
|
||||
$("#error").html("主题不能为空").show();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() == ""){
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.html().val().trim() == ""){
|
||||
$("#error").html("内容不能为空").show();
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +76,7 @@
|
|||
$("#error").html("主题 过长(最长为 50 个字符)").show();
|
||||
return false;
|
||||
}
|
||||
if($("#memo_content").val().trim().length > 5000){
|
||||
if(memo_content.html().trim().length > 5000){
|
||||
$("#error").html("内容 过长(最长为 5000 个字符)").show();
|
||||
return false;
|
||||
}
|
||||
|
@ -83,7 +87,7 @@
|
|||
$('#create_memo_div').slideToggle();
|
||||
$('#create_memo_btn').slideToggle();
|
||||
$('#memo_subject').val('');
|
||||
$('#memo_content').val('')
|
||||
memo_content.html('')
|
||||
$('#error').html('').hide();
|
||||
}
|
||||
</script>
|
||||
|
@ -99,11 +103,7 @@
|
|||
</script>
|
||||
</div>
|
||||
<div class="mt15">
|
||||
<textarea type="text" name="memo[content]" id="memo_content" maxlength="5000" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子内容" /></textarea>
|
||||
<script>
|
||||
var textarea = document.getElementById('memo_content');
|
||||
autoTextarea(textarea);
|
||||
</script>
|
||||
<%= kindeditor_tag 'memo[content]','',:height=>300,:editor_id=>'memo_content'%>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">上传附件</a>-->
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
<%= javascript_include_tag 'new_user'%>
|
||||
<%= javascript_include_tag 'new_user','/assets/kindeditor/pasteimg','/assets/kindeditor/kindeditor'%>
|
||||
<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() != "" && memo_content.html().trim() != "" ){
|
||||
if($("textarea[name='memo[subject]']").val().trim().length > 50 ){
|
||||
$("#error").html('主题不能超过50个字符').show();
|
||||
return;
|
||||
}
|
||||
if($("textarea[name='memo[content]']").val().trim().length > 5000 ){
|
||||
if(memo_content.html().trim().length > 5000 ){
|
||||
$("#error").html('内容不能超过5000个字符').show();
|
||||
return;
|
||||
}
|
||||
memo_content.sync();
|
||||
$("#edit_memo").submit();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() == "" && $("textarea[name='memo[content]']").val().trim() != "" ){
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() != "" ){
|
||||
$("#error").html("主题不能为空").show();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() == ""){
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.html().trim() == ""){
|
||||
$("#error").html("内容不能为空").show();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() == ""){
|
||||
$("#error").html("主题和内容不能为空").show();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -35,11 +38,7 @@
|
|||
</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>
|
||||
<%= kindeditor_tag 'memo[content]',@memo.content,:height=>300,:editor_id=>'memo_content'%>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">对应附件名称</a>-->
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<%= render :partial => "memos/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<div class="memo-content" style="word-break: break-all; word-wrap:break-word;white-space:pre-wrap;margin-bottom: 0px !important;" >
|
||||
<div class="memo-content" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @memo.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
Loading…
Reference in New Issue