From a732efa6c6809596ee518120f4e738df3961b3a1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 7 Jul 2016 10:42:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81=E4=B8=AD?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AE=BE=E4=B8=BA=E9=A6=96=E9=A1=B5=E7=9A=84?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=8A=A8=E6=80=81=202.=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=8A=A8=E6=80=81=E4=B8=AD=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E8=AE=BE=E4=B8=BA=E9=A6=96=E9=A1=B5=E7=9A=84=E5=8D=9A=E5=AE=A2?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=B9=B6=E5=B0=86=20=E6=9C=80=E4=B8=8A?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=8D=9A=E5=AE=A2=E6=98=BE=E7=A4=BA=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=86=85=E5=AE=B9=E5=8F=8A=E5=8F=AF=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 3 ++ app/views/blog_comments/reply.js.erb | 5 +- app/views/blogs/_homepage.html.erb | 49 +++++++++++++++++++ .../organizations/_org_activities.html.erb | 2 +- app/views/users/_user_activities.html.erb | 4 +- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 0224a587d..4a8de5814 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -116,6 +116,9 @@ class BlogCommentsController < ApplicationController #回复 def reply + if params[:homepage] + @in_user_homepage = true + end if params[:in_user_center] @in_user_center = true end diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb index 915ab892d..baf4418e9 100644 --- a/app/views/blog_comments/reply.js.erb +++ b/app/views/blog_comments/reply.js.erb @@ -1,4 +1,7 @@ -<% if @in_user_center%> +<% if @in_user_homepage %> + <% homepage = BlogComment.find(@user.blog.homepage_id) %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id}) %>"); +<% elsif @in_user_center%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); // init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); <% else%> diff --git a/app/views/blogs/_homepage.html.erb b/app/views/blogs/_homepage.html.erb index 5dbee59d6..140f547cb 100644 --- a/app/views/blogs/_homepage.html.erb +++ b/app/views/blogs/_homepage.html.erb @@ -48,4 +48,53 @@
+ <% count=activity.children.count %> +
+ <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> + + <% comments = activity.children.reorder("created_on desc").limit(3) %> + <% if count > 0 %> +
+ <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> +
+ <% end %> + + <% if activity.locked == false && User.current.logged?%> +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+ <% if User.current.logged? %> +
+ <%= form_for('new_form',:url => {:controller => 'blog_comments', :action => 'reply', :user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:homepage=>1},:method => "post", :remote => true) do |f|%> + + + + + + +
+ + +
+

+ <% end%> +
+ <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
+
+
+
+ <% end %> +
+ \ No newline at end of file diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index cc1404eb5..bddba3eee 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -46,7 +46,7 @@ <% end %> - <% if act.org_act_type == 'OrgDocumentComment' %> + <% if act.org_act_type == 'OrgDocumentComment' && act.org_act.organization.home_id != act.org_act.id %> <%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %> <% end %> <% end %> diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 5d06a7001..5c6f07bb1 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -93,7 +93,9 @@ <%# cache (act) do %> <% case user_activity.act_type.to_s %> <% when 'BlogComment' %> - <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% if !(act.blog.homepage_id and act.id == act.blog.homepage_id) %> + <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% end %> <% end %> <%# end %> <% end %>