From 9be7e633ae4c83912e059c3e3e5f1bb0c6cdfc26 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 21 Sep 2015 16:20:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=9B=9E=E5=A4=8D=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_message.html.erb | 2 +- app/views/users/_course_news.html.erb | 2 +- app/views/users/_project_issue.html.erb | 2 +- app/views/users/_project_message.html.erb | 2 +- app/views/users/_user_activities.html.erb | 2 +- .../javascripts/init_activity_KindEditor.js | 33 +++++++++++-------- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 703882bd1..702e2d6b4 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -99,7 +99,7 @@
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
+
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index ef01022ce..64080136f 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -70,7 +70,7 @@
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
+
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 29bed1499..ce7b6a884 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -115,7 +115,7 @@
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
+
<%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 2cce8f83a..2b64ceb9d 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -84,7 +84,7 @@
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
+
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 225304185..ea9c572d9 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -36,7 +36,7 @@ } $(function() { - init_activity_KindEditor_data(<%= user_activity.id%>,"","87%"); + init_activity_KindEditor_data(<%= user_activity.id%>,null,"87%"); }); <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index 1e51067ef..bea7dc1e7 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -6,42 +6,49 @@ function init_editor(params){ var editor = params.kindutil.create(params.textarea, { resizeType : 1,minWidth:"1px",width:"95%", - height:"30px",// == undefined ? "30px":paramsHeight+"px", - minHeight:"30px",// == undefined ? "30px":paramsHeight+"px", + height:"33px",// == undefined ? "30px":paramsHeight+"px", + minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", items:['emoticons'], afterChange:function(){//按键事件 var edit = this.edit; var body = edit.doc.body; edit.iframe.height(paramsHeight); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (paramsHeight == undefined ? 30:paramsHeight), paramsHeight)); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + paramsHeight , paramsHeight)); }, afterBlur:function(){ nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); if(this.edit.html()=="") { - this.edit.html('我要回复'); + this.edit.html('我要回复'); } //params.toolbar_container.hide(); $('#reply_image_' + id).addClass('imageFuzzy'); - //this.resize("95%", null); + if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ + params.submit_btn.hide(); + this.resize("95%", null); + }else if(edit.html().val().trim() != ""){ + params.submit_btn.show(); + } + //params.submit_btn.css("display","none"); }, afterFocus: function(){ var edit = this.edit; var body = edit.doc.body; - if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\#\d*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){ + if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){ edit.html(''); } + params.submit_btn.show(); params.contentmsg.hide(); // params.toolbar_container.show(); $('#reply_image_' + id).removeClass('imageFuzzy'); //edit.iframe.width(paramsWidth); this.resize(paramsWidth, null); - params.submit_btn.show(); + //params.submit_btn.show(); }, afterCreate:function(){ - params.submit_btn.css("display","none"); + params.submit_btn.hide(); var toolbar = $("div[class='ke-toolbar']",params.div_form); toolbar.css('width',24); $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); @@ -52,12 +59,10 @@ function init_editor(params){ edit.iframe[0].scroll = 'no'; body.style.overflowY = 'hidden'; //reset height - var edit = this.edit; - var body = edit.doc.body; paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; edit.iframe.height(paramsHeight); - edit.html('我要回复'); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (paramsHeight == undefined ? 30:paramsHeight) , paramsHeight)); + edit.html('我要回复'); + this.resize(null,Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight));// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight) // params.toolbar_container.hide(); } @@ -74,7 +79,7 @@ function nh_check_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() || /^\&\w*\;\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\#\d*\;\"\&\w*\;[\u4e00-\u9fa5]*\&\w*\;\/\w*\&\w*\;$/.test(params.textarea.html())){ + 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('内容不能为空'); params.contentmsg.css({color:'#ff0000'}); }else{ @@ -152,5 +157,5 @@ function init_activity_KindEditor_data(id){ }); }); - $(".ke-edit").css("height","25px"); + $(".ke-edit").css("height","33px"); } \ No newline at end of file