diff --git a/app/models/journal.rb b/app/models/journal.rb index 41d81de1..3f6e2563 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -72,10 +72,10 @@ class Journal < ActiveRecord::Base where("(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(user, :view_private_notes, *args)}))", false) } - def save(*args) - # Do not save an empty journal - (details.empty? && notes.blank?) ? false : super - end + # def save(*args) + # # Do not save an empty journal + # (details.empty? && notes.blank?) ? false : super + # end # Returns the new status if the journal contains a status change, otherwise nil def new_status diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index fdd493d8..0ac14179 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -36,7 +36,8 @@ function sd_create_editor(params){ } //params.toolbar_container.hide(); $('#reply_image_' + id).addClass('imageFuzzy'); - if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ + // /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())) + if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html()) && $(".upload_filename").length == 0 ){ params.submit_btn.hide(); params.toolbar_container.hide(); this.resize("100%", null); @@ -209,13 +210,17 @@ function sd_check_editor_form_field(params){ if(params.content.html()!=params.textarea.html() || params.issubmit==true){ params.textarea.html(params.content.html()); params.content.sync(); - if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){ - params.contentmsg.html('内容不能为空'); + if( + (params.content.isEmpty() && $(".upload_filename").length == 0) + || + (/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())&& $(".upload_filename").length == 0)){ + params.contentmsg.html('请填写评论内容或者上传附件!'); params.contentmsg.css({color:'#ff0000'}); - }else{ - params.contentmsg.html('填写正确'); - params.contentmsg.css({color:'#008000'}); } + // else{ + // params.contentmsg.html('填写正确'); + // params.contentmsg.css({color:'#008000'}); + // } params.contentmsg.show(); } } @@ -281,6 +286,7 @@ function sd_create_editor_from_data(id){ }); params.submit_btn.click(function () { var tContents = $("#comment_news_" + id).val(); + console.log("tcontrnet"+tContents); if(tContents != undefined){ var beforeImage = tContents.split("");