From a77f7e6f753ec586f6991bb9e61e5a6084f3f738 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 13 Oct 2015 11:03:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA=E5=8C=BA?= =?UTF-8?q?=E5=8D=95=E4=B8=AA=E5=B8=96=E5=AD=90=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_course_show.html.erb | 53 +++---------------- app/views/messages/_reply_message.html.erb | 7 +-- app/views/messages/quote.js.erb | 12 +++-- .../javascripts/init_activity_KindEditor.js | 7 +-- public/stylesheets/courses.css | 2 +- 5 files changed, 23 insertions(+), 58 deletions(-) diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 14ef0afdb..1c603caf6 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -1,16 +1,5 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %> - +
@@ -107,15 +88,15 @@
回复(<%=@reply_count %>)
-
- <% if @reply_count > 2%> - 点击展开更多回复 - <% end %> -
+
<% @replies.each_with_index do |reply,i| %> -
+
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
@@ -169,23 +150,5 @@
- -
\ No newline at end of file diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb index 10fbee6e8..3e9550ee2 100644 --- a/app/views/messages/_reply_message.html.erb +++ b/app/views/messages/_reply_message.html.erb @@ -1,4 +1,3 @@ - - - -
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => reply.id,},:method => "post", :remote => true) do |f|%> + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index 965c458e9..78ba0c142 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -6,7 +6,11 @@ $('#quote_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>") showAndScrollTo("reply", "message_content"); $('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight; $("img").removeAttr("align");*/ -$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>"); -$(function(){ - init_activity_KindEditor_data(<%= @message.id%>,null,"87%"); -}); \ No newline at end of file +if($("#reply_message_<%= @message.id%>").length > 0) { + $("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>"); + $(function(){ + init_activity_KindEditor_data(<%= @message.id%>,null,"85%"); + }); +}else if($("#reply_to_message_<%= @message.id%>").length >0) { + $("#reply_to_message_<%= @message.id%>").replaceWith("

"); +} \ No newline at end of file diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index decbbb341..db871e723 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -5,7 +5,7 @@ function init_editor(params){ var paramsWidth = params.width == undefined ? "100%" : params.width; var editor = params.kindutil.create(params.textarea, { - resizeType : 1,minWidth:"1px",width:"95%", + resizeType : 1,minWidth:"1px",width:"94%", height:"33px",// == undefined ? "30px":paramsHeight+"px", minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", items:['emoticons'], @@ -25,7 +25,7 @@ function init_editor(params){ $('#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())){ params.submit_btn.hide(); - this.resize("95%", null); + this.resize("94%", null); }else if(edit.html().val().trim() != ""){ params.submit_btn.show(); } @@ -157,5 +157,6 @@ function init_activity_KindEditor_data(id){ }); }); - $(".ke-edit").css("height","33px"); + div_form = $("div[nhname='new_message_" + id + "']"); + $(".ke-edit", div_form).css("height","33px"); } \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 54416e7f4..2da36a991 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1074,4 +1074,4 @@ a.postRouteLink {font-weight:bold; color:#484848;} a.postRouteLink:hover {text-decoration:underline;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} -.ReplyToMessageInputContainer {width:282px; float:left;} \ No newline at end of file +.ReplyToMessageInputContainer {width:582px; float:left;} \ No newline at end of file