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ClPNoHAJ?bDaZ7kn6JD0rB+^L
z;8@H-hn=BcCC@A@>YNnIqPhNy^t-O=1Ehri;v`1EfI>v`eC}U6%JZ2$fjv62i=8p?
z@iHd9B`diBlVQf}D7RZWV(YAfoeUZ8$`(E&r=2KJ*Lq7Y^%$+Knk1DoBd%6&Fl;Y3
zb@WYmY|`*VANgg~*b-|(+Zi*$8TrB%J(`Xk)-if5yq7@NKW^&v*iU*)1WRyV4?lCP
z@cos7F406oE|l>7>!niixt#@7hVv*<>BX(XVe_>&pk{Z9s^ROL7Ch>P}Wz%D|Py(Mu=2oB^Ql!`khmw)+j+i*KX$xnIsZ%wE`1To_%(Cek&U?Jr
zKh@G!Exw+7I3S&-)^dtE5udhq3gBKn3@LtW#WaRzx4%eIY1OEAj~AiZ|8b`H!)2$$v>0X@;V$=u
zHk)^yR2Tml!Yo`3{ghA~N{dknfJqbuM&^);5NbMMgC<$s;v80qoSGZumCrkF*rh9^
zBMakYNoF(F3-Y)dJIX3>`FP9Ec-k19el2+Hq$9e
z;PZHZMEq~XdRex=m^tSG6ZW`A_?x>GdkdALelFIrK_&J&=&46f^D-W&_(i3@D2y;<
zta?OcnYcd+Gct9yR=Y4`{bQo}=VJVadj%1>!3$eZJhgIS&SDqiGX~7W@C2$*-zoI}
E00@K2XaE2J
literal 0
HcmV?d00001
diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css
index b86068a33..7ab2bf3f3 100644
--- a/public/stylesheets/css/structure.css
+++ b/public/stylesheets/css/structure.css
@@ -97,13 +97,13 @@ div#menu ul ul ul li a{ width:185px; overflow:hidden; white-space: nowrap; text-
.homepageNewsPublisher { max-width:100px; font-size:12px; color:#269ac9; display:block; padding-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; }
.homepageNewsType {padding-left: 5px; font-size:12px; color:#888888; display:block;}
.homepageNewsTypeHomework {width:160px; padding-left: 5px; font-size:12px; color:#888888; display:block; overflow:hidden; height:49px;word-break:break-all; word-wrap:break-word; text-overflow:ellipsis;}
-.homepageNewsPubType {width:230px; font-size:12px; color:#888888; display: block;}
+.homepageNewsPubType {auto-width:230px; font-size:12px; color:#888888; display: block;}
.homepageNewsPubTypeHomework {width:270px; font-size:12px; color:#888888; display: block; white-space:nowrap;}
-.homepageNewsContent {width:355px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
-.homepageSystenMessageContent {width:281px; max-width:291px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden;text-overflow:ellipsis;max-height: 49px; }
-
-.homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
-.homepageHomeworkContent {width:235px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
+.homepageNewsContent {width:355px; max-width:365px; margin-right:10px; font-size:14px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
+.homepageSystenMessageContent {width:281px; max-width:291px; margin-right:10px; font-size:14px; color:#4b4b4b; display:block; overflow:hidden;text-overflow:ellipsis;max-height: 49px; }
+.homepageSystenMessageContent a:link{color:#1b1818;}
+.homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:14px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
+.homepageHomeworkContent {width:235px; max-width:365px; margin-right:10px; font-size:14px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
.homepageHomeworkContentWarn2 {width:60px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
.homepageHomeworkContent2 {width:285px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
@@ -355,7 +355,7 @@ a.replyGrey1 {color:#888888;}
a.replyGrey1:hover {color:#4b4b4b;}
a.newsBlue {color:#269ac9;}
a.newsBlue:hover {color:#297fb8;}
-a.newsBlack {color:#4b4b4b; font-size:13px; font-weight:bold}
+a.newsBlack {color:#4b4b4b; font-size:14px; font-weight:bold}
a.menuGrey {color:#808080;}
a.menuGrey:hover {color:#fe7d68;}
.navSearchTypeBox {width:368px; height:35px; position:absolute; border:1px solid #e1e1e1; background-color:#ffffff; padding-left:10px; display:none; color:#3e3e3e; font-size:14px;}
diff --git a/public/stylesheets/css/user.css b/public/stylesheets/css/user.css
index a46b46517..e718c88a5 100644
--- a/public/stylesheets/css/user.css
+++ b/public/stylesheets/css/user.css
@@ -21,7 +21,7 @@
.home-user-leftnav{ background:#fff; width: 238px; border:1px solid #ddd; margin-bottom: 10px;}
.home-user-leftnav h3{ height: 40px; line-height: 40px; border-bottom:1px solid #ddd; color: #333; padding-left: 10px; font-weight: normal; }
.h3-more{ font-size: 12px; color: #888;}
-.home-user-leftnav-li{ height: 40px; line-height: 40px; padding-left: 25px; color: #666;background:url(/images/user/home-user-left.png) 5px 5px no-repeat; font-size: 14px; position: relative; }
+.home-user-leftnav-li{ height: 45px; line-height: 40px; padding-left: 25px; color: #666;background:url(/images/user/home-user-left.png) 5px 5px no-repeat; font-size: 14px; position: relative; }
.home-user-leftnav-li:hover{ background:#f4f4f4 url(/images/user/home-user-left.png) 5px -35px no-repeat;}
.home-user-leftnav-li a:hover{color: #3b94d6;}
.icons-class{background:url(/images/user/home-user-left.png) 5px 5px no-repeat; }
From 69d922880842031eb210cd72276c68f10fd0367a Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 7 Dec 2016 15:13:51 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?=
=?UTF-8?q?=E7=9A=84=E6=B6=88=E6=81=AF=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 182 ++++++++++--------
app/helpers/users_helper.rb | 4 +
app/views/layouts/_user_watch_btn.html.erb | 14 +-
app/views/layouts/new_base_user.html.erb | 96 +++++----
.../_join_course_course_message.html.erb | 6 +-
app/views/users/_new_user_message.html.erb | 4 +-
app/views/users/_no_data.html.erb | 4 +
app/views/users/show.html.erb | 111 ++++++-----
public/stylesheets/css/structure.css | 4 +-
9 files changed, 245 insertions(+), 180 deletions(-)
create mode 100644 app/views/users/_no_data.html.erb
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 1da7355f4..39097c07d 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1807,96 +1807,110 @@ class UsersController < ApplicationController
end
def show
- #更新用户申请成为课程老师或教辅消息的状态
- if params[:course_id] != nil
- join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
- params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
- join_course_messages.update_all(:viewed => true)
- end
- shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
- shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
- @page = params[:page] ? params[:page].to_i + 1 : 0
- user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
- user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
- course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
- project_types = "('Message','Issue','Project')"
- principal_types = "JournalsForMessage"
- container_type = ''
- act_type = ''
-
- # 用户项目数
- @my_project_count = user_project_count
- # 用户的课程数
- @my_course_count = user_course_count
- # 用户发布的issue数
- @issues_author_is_self_count = issues_author_is_self_count
- # 用户收到的issue数
- @issues_assigned_is_self_count = issues_assigned_is_self_count
-
- if params[:type].present?
- case params[:type]
- when "course_homework"
- container_type = 'Course'
- act_type = 'HomeworkCommon'
- when "course_news"
- container_type = 'Course'
- act_type = 'News'
- when "course_message"
- container_type = 'Course'
- act_type = 'Message'
- when "course_poll"
- container_type = 'Course'
- act_type = 'Poll'
- when "course_journals"
- container_type = 'Course'
- act_type = 'JournalsForMessage'
- when "project_issue"
- container_type = 'Project'
- act_type = 'Issue'
- when "project_message"
- container_type = 'Project'
- act_type = 'Message'
- when "user_journals"
- container_type = 'Principal'
- act_type = 'JournalsForMessage'
- when "current_user"
- container_type = 'Principal'
- act_type = 'Principal'
- when "all"
- container_type = 'all'
- act_type = 'all'
+ if is_current_user
+ # 自己的主页显示消息
+ # 初始化/更新 点击按钮时间, 24小时内显示系统消息
+ update_onclick_time
+ # 全部设为已读
+ if params[:viewed] == "all"
+ update_message_viewed(@user)
end
- end
- if container_type != '' && container_type != 'all'
- if container_type == 'Course'
- sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
- elsif container_type == 'Project'
- sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
- elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
- sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
- elsif container_type == 'Principal' && act_type == 'Principal'
- sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
- end
- if User.current != @user
- sql += " and user_id = #{@user.id}"
+ # 系统消息为管理员发送,我的消息中包含有系统消息
+ @message_alls = []
+ messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
+ messages.each do |message_all|
+ mess = message_all.message
+ unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
+ @message_alls << mess
+ end
end
+ @message_count = @message_alls.count
+ @message_alls = paginateHelper @message_alls, 20
else
- if User.current != @user
- blog_ids = "("+@user.blog.id.to_s+")"
+ # 看别人的主页显示动态
+ #更新用户申请成为课程老师或教辅消息的状态
+ if params[:course_id] != nil
+ join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
+ params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
+ join_course_messages.update_all(:viewed => true)
+ end
+ shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
+ shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
+ @page = params[:page] ? params[:page].to_i + 1 : 0
+ user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
+ user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
+ course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
+ project_types = "('Message','Issue','Project')"
+ principal_types = "JournalsForMessage"
+ container_type = ''
+ act_type = ''
+ # 他的动态
+ sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
+ if params[:type].present?
+ case params[:type]
+ when "course_homework"
+ container_type = 'Course'
+ act_type = 'HomeworkCommon'
+ when "course_news"
+ container_type = 'Course'
+ act_type = 'News'
+ when "course_message"
+ container_type = 'Course'
+ act_type = 'Message'
+ when "course_poll"
+ container_type = 'Course'
+ act_type = 'Poll'
+ when "course_journals"
+ container_type = 'Course'
+ act_type = 'JournalsForMessage'
+ when "project_issue"
+ container_type = 'Project'
+ act_type = 'Issue'
+ when "project_message"
+ container_type = 'Project'
+ act_type = 'Message'
+ when "user_journals"
+ container_type = 'Principal'
+ act_type = 'JournalsForMessage'
+ when "current_user"
+ container_type = 'Principal'
+ act_type = 'Principal'
+ when "all"
+ container_type = 'all'
+ act_type = 'all'
+ end
+ end
+ if container_type != '' && container_type != 'all'
+ if container_type == 'Course'
+ sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
+ elsif container_type == 'Project'
+ sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
+ elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
+ sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
+ elsif container_type == 'Principal' && act_type == 'Principal'
+ sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
+ end
+ if User.current != @user
+ sql += " and user_id = #{@user.id}"
+ end
else
- blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
- end
- sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
- "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
- "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
- "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
- if container_type != 'all' && User.current != @user
- sql = "user_id = #{@user.id} and(" + sql + ")"
+ if User.current != @user
+ blog_ids = "("+@user.blog.id.to_s+")"
+ else
+ blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
+ end
+ sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
+ "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
+ "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
+ "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
+ if container_type != 'all' && User.current != @user
+ sql = "user_id = #{@user.id} and(" + sql + ")"
+ end
end
+ @user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
+ @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
+ @type = params[:type]
end
-
- @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
- @type = params[:type]
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index b0570bb24..42825c6ab 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -192,6 +192,10 @@ module UsersHelper
end
end
+ def is_current_user
+ is_current_user = (User.current == @user)
+ end
+
def applied_project_tip_header applied_message
case applied_message.status
when 4
diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb
index cf580f920..35436f83f 100644
--- a/app/views/layouts/_user_watch_btn.html.erb
+++ b/app/views/layouts/_user_watch_btn.html.erb
@@ -5,14 +5,14 @@
<%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %>
<% else%>
-
- <% if target.base_homepage.nil? %>
+
+
<%if(target.watched_by?(User.current))%>
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
<% else %>
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index af76ad8d6..8f47cecb7 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -158,14 +158,15 @@
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
-
-
-
课程社区
- <% if hidden_unproject_infos %>
-
-
- <%= link_to "课程#{user_course_count} ".html_safe, {:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list", :class => "fl" %>
-
-
- <% if @user == User.current %>
-
- <%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl" %>
-
- <% end %>
-
- <%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl" %>
-
-
- <%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank", :class => "fl" %>
-
-
-
- <% end %>
-
-
项目社区
-
-
- <%= link_to "项目#{user_project_count} ".html_safe, {:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "fl" %>
-
-
-
- <%= link_to "我发布的issue#{issues_author_is_self_count} ".html_safe, user_issues_user_path(@user), :class => "fl" %>
-
-
- <%= link_to "我收到的issue#{issues_assigned_is_self_count} ".html_safe, user_issues_user_path(@user), :class => "fl" %>
-
-
-
+
+
+ <%= link_to issues_author_is_self_count > 0 ? "我发布的issue#{issues_author_is_self_count} ".html_safe : "我发布的issue",
+ user_issues_user_path(@user), :class => "fl" %>
+
+
+ <%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue#{issues_assigned_is_self_count} ".html_safe : "我收到的issue",
+ user_issues_user_path(@user), :class => "fl" %>
+
+
+
+ <% else %>
+
+
Ta在确实
+ <%= time_tag(@user.created_on).html_safe %>
+
+
+
+ <%= link_to user_course_count > 0 ? "课程#{user_course_count} ".html_safe : "课程",
+ {:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list", :class => "fl" %>
+
+
+ <%= link_to user_project_count > 0 ? "项目#{user_project_count} ".html_safe : "项目",
+ {:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "fl" %>
+
+
+
+ <% end %>
-
+ <%= time_tag(ma.created_at).html_safe %>
+
<% if ma.status == 0 || ma.status.nil?%>
<%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%>
@@ -35,4 +36,3 @@
<%end %>
-<%= time_tag(ma.created_at).html_safe %>
\ No newline at end of file
diff --git a/app/views/users/_new_user_message.html.erb b/app/views/users/_new_user_message.html.erb
index 16f14733c..0eef0ef9b 100644
--- a/app/views/users/_new_user_message.html.erb
+++ b/app/views/users/_new_user_message.html.erb
@@ -22,6 +22,6 @@
<%= render :partial => 'users/user_message_applied', :locals => {:ma => ma} %>
<% end %>
-
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true %>
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
\ No newline at end of file
diff --git a/app/views/users/_no_data.html.erb b/app/views/users/_no_data.html.erb
new file mode 100644
index 000000000..91e8cf703
--- /dev/null
+++ b/app/views/users/_no_data.html.erb
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 66aafcf46..f299f1ef3 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -1,51 +1,74 @@
-
+<% if is_current_user %>
+
+
+
+ <%= render :partial => 'users/new_user_message', :locals => { :message_alls => @message_alls } %>
+
+
-
+<% else %>
+
+
+
<%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %>
<%# homepage = BlogComment.find(@user.blog.homepage_id) %>
<%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
<%# end %>
-<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %>
+ <% if @user_activities_count > 0 %>
+ <%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %>
+ <% else %>
+
+ <%= render :partial => 'users/no_data' %>
+
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css
index 7ab2bf3f3..0e18770ae 100644
--- a/public/stylesheets/css/structure.css
+++ b/public/stylesheets/css/structure.css
@@ -104,8 +104,8 @@ div#menu ul ul ul li a{ width:185px; overflow:hidden; white-space: nowrap; text-
.homepageSystenMessageContent a:link{color:#1b1818;}
.homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:14px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
.homepageHomeworkContent {width:235px; max-width:365px; margin-right:10px; font-size:14px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
-.homepageHomeworkContentWarn2 {width:60px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
-.homepageHomeworkContent2 {width:285px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
+.homepageHomeworkContentWarn2 {width:70px; max-width:365px; margin-right:10px; font-size:14px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
+.homepageHomeworkContent2 {width:285px; max-width:365px; margin-right:10px; font-size:14px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
.homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;}
.loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;}