message--viewed

This commit is contained in:
huang 2015-09-02 18:00:36 +08:00
parent 273e1ea6b1
commit 4c76292e5e
3 changed files with 19 additions and 11 deletions

View File

@ -43,6 +43,14 @@ class StudentWorkController < ApplicationController
end
def index
# 消息状态更新
@homework.course_messages.each do |homework_message|
if User.current.id == homework_message.user_id
homework_message.update_attributes(:viewed => true)
end
end
# 消息end
#设置作业对应的forge_messages表的viewed字段
query_student_work = @homework.course_messages
query_student_work.each do |query|

View File

@ -106,16 +106,16 @@ class UsersController < ApplicationController
return
end
# 当前用户查看消息,则设置消息为已读
course_querys = @user.course_messages
forge_querys = @user.forge_messages
user_querys = @user.user_feedback_messages
forum_querys = @user.memo_messages
if User.current.id == @user.id
course_querys.update_all(:viewed => true)
forge_querys.update_all(:viewed => true)
user_querys.update_all(:viewed => true)
forum_querys.update_all(:viewed => true)
end
# course_querys = @user.course_messages
# forge_querys = @user.forge_messages
# user_querys = @user.user_feedback_messages
# forum_querys = @user.memo_messages
# if User.current.id == @user.id
# course_querys.update_all(:viewed => true)
# forge_querys.update_all(:viewed => true)
# user_querys.update_all(:viewed => true)
# forum_querys.update_all(:viewed => true)
# end
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
case params[:type]
when nil

View File

@ -525,7 +525,7 @@ a.replyGrey1 {color:#888888;}
a.replyGrey1:hover {color:#4b4b4b;}
a.newsBlue {color:#269ac9;}
a.newsBlue:hover {color:#297fb8;}
a.newsBlack {color:#000000; font-size:13px; font-weight:bold}
a.newsBlack {color:#4b4b4b; font-size:13px; 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;}