From e2af9e26f88ecc50da0c35e74c6d11dcd402f285 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 25 Aug 2015 15:35:45 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E6=8A=A5?=
=?UTF-8?q?=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_logined_header.html.erb | 2 +-
app/views/users/_course_news.html.erb | 2 +-
app/views/users/show.html.erb | 26 +++++++++-------------
3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 10d71993d..16e5be059 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -54,7 +54,7 @@
<%= link_to "
#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:alt=>"头像", :id => "nh_user_logo")}
".html_safe,user_activities_path(User.current.id)%>
回复(<%=activity.comments_count %>)
-
<%=format_date(activity.updated_on)%>
+
<%#=format_date(activity.updated_on)%>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 85f415d1d..b30a51c4b 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -27,31 +27,27 @@
<% @user_activities.each do |user_activity|
unless @user_activities.nil? %>
+ <% act= user_activity.act %>
<% case user_activity.act_type.to_s %>
<% when 'CourseActivity' %>
- <% @course_act= CourseActivity.where("id=#{user_activity.act_id}").first %>
- <% unless @course_act.nil? %>
- <% case @course_act.course_act_type.to_s %>
+ <% if act %>
+ <% activity= act.course_act %>
+ <% case act.course_act_type.to_s %>
<% when 'HomeworkCommon' %>
- <% @activity=HomeworkCommon.where("id=#{@course_act.course_act_id}").first %>
- <%= render :partial => 'course_homework', :locals => {:activity => @activity,:user_activity =>user_activity} %>
+ <%= render :partial => 'course_homework', :locals => {:activity => activity,:user_activity =>user_activity} %>
<% when 'News' %>
- <% @activity=News.where("id=#{@course_act.course_act_id}").first %>
- <%= render :partial => 'course_news', :locals => {:activity => @activity,:user_activity =>user_activity} %>
+ <%= render :partial => 'course_news', :locals => {:activity => activity,:user_activity =>user_activity} %>
<% when 'Message'%>
- <% @activity=Message.where("id=#{@course_act.course_act_id}").first %>
- <%= render :partial => 'course_message', :locals => {:activity => @activity,:user_activity =>user_activity} %>
+ <%= render :partial => 'course_message', :locals => {:activity => activity,:user_activity =>user_activity} %>
<% end %>
<% end %>
<% when 'ForgeActivity' %>
- <% @project_act= ForgeActivity.where("id=#{user_activity.act_id}").first %>
- <% case @project_act.forge_act_type.to_s %>
+ <% activity= act.forge_act unless act.forge_act_type == "ProjectCreateInfo" %>
+ <% case act.forge_act_type.to_s %>
<% when 'Issue' %>
- <% @activity=Issue.where("id=#{@project_act.forge_act_id}").first %>
- <%= render :partial => 'project_issue', :locals => {:activity => @activity,:user_activity =>user_activity} %>
+ <%= render :partial => 'project_issue', :locals => {:activity => activity,:user_activity =>user_activity} %>
<% when 'Message' %>
- <% @activity=Message.where("id=#{@project_act.forge_act_id}").first %>
- <%= render :partial => 'project_message', :locals => {:activity => @activity,:user_activity =>user_activity} %>
+ <%= render :partial => 'project_message', :locals => {:activity => activity,:user_activity =>user_activity} %>
<% end %>
<% end %>
<% end %>