From ef45e41a40a1ed2b5e6f5e62514cc66b7cbb5e15 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 21 Aug 2015 09:41:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92?= =?UTF-8?q?=E3=80=82=E8=A1=A8=E6=83=85=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 6 +- app/views/users/user_messages.html.erb | 381 ++++++++++++------------- 2 files changed, 189 insertions(+), 198 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 3a57d6217..99604c798 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -256,7 +256,11 @@ class User < Principal # 新消息统计 def count_new_message - count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count + course_count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count + forge_count = ForgeMessage.where("user_id =? and viewed =?", User.current.id, 0).count + user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", User.current.id, 0).count + user_memo_count = MemoMessage.where("user_id =? and viewed =?", User.current.id, 0).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count end # 查询指派给我的缺陷记录 def issue_status_update diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 7a8d98668..602e3c5c9 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -32,219 +32,206 @@
- <% if @new_message_count >0 %> - <%# 课程消息 %> - <% unless @user_course_messages.nil? %> - <% @user_course_messages.each do |ucm| %> - <% if ucm.course_message_type == "News" %> - - <% end %> - <% if ucm.course_message_type == "Comment" %> +<% if @new_message_count >0 %> + <%# 课程消息 %> + <% unless @user_course_messages.nil? %> + <% @user_course_messages.each do |ucm| %> + <% if ucm.course_message_type == "News" %> + + <% end %> + <% if ucm.course_message_type == "Comment" %> - <% end %> - <% if ucm.course_message_type == "HomeworkCommon" %> - - <% end %> - <% if ucm.course_message_type == "Poll" %> - - <% end %> - <% if ucm.course_message_type == "Message" %> - - <% end %> - <% if ucm.course_message_type == "StudentWorksScore" %> - - <% end %> - <% if ucm.course_message_type == "JournalsForMessage" %> - - <% end %> -
- <% end %> - <% end %> - - <% unless @user_forge_messages.nil? %> - <% @user_forge_messages.each do |ufm| %> - <% if ufm.forge_message_type == "Issue" %> - - <% end %> - <% if ufm.forge_message_type == "Journal" %> - - <% end %> - <% if ufm.forge_message_type == "Message" %> - - <% end %> - <% if ufm.forge_message_type == "News" %> - - <% end %> + <% end %> + <% if ucm.course_message_type == "HomeworkCommon" %> + + <% end %> + <% if ucm.course_message_type == "Poll" %> + + <% end %> + <% if ucm.course_message_type == "Message" %> + + <% end %> + <% if ucm.course_message_type == "StudentWorksScore" %> + + <% end %> + <% if ucm.course_message_type == "JournalsForMessage" %> + + <% end %> +
+ <% end %> + <% end %> + + <% unless @user_forge_messages.nil? %> + <% @user_forge_messages.each do |ufm| %> + <% if ufm.forge_message_type == "Issue" %> + + <% end %> + <% if ufm.forge_message_type == "Journal" %> + + <% end %> + <% if ufm.forge_message_type == "Message" %> + + <% end %> + <% if ufm.forge_message_type == "News" %> + + <% end %> <% if ufm.forge_message_type == "Comment" %> <% end %> - <% end %> - <% end %> - <%# 公共贴吧 %> - <% unless @user_memo_messages.nil? %> - <% @user_memo_messages.each do |urm| %> - <% if urm.memo_type == "Memo" %> - - <% end %> - <% end %> - <% end %> - <%# 用户留言消息 %> - <% unless @user_feedback_messages.nil? %> - <% @user_feedback_messages.each do |ufm| %> - <% if ufm.journals_for_message_type == "Principal" %> - - <% end %> - <% end %> - <% end %> - <% else %> -
暂无消息!
- <% end %> + <% end %> + <% end %> + <%# 公共贴吧 %> + <% unless @user_memo_messages.nil? %> + <% @user_memo_messages.each do |urm| %> + <% if urm.memo_type == "Memo" %> + + <% end %> + <% end %> + <% end %> + <%# 用户留言消息 %> + <% unless @user_feedback_messages.nil? %> + <% @user_feedback_messages.each do |ufm| %> + <% if ufm.journals_for_message_type == "Principal" %> + + <% end %> + <% end %> + <% end %> +<% else %> +
暂无消息!
+<% end %>