首页的消息列表中加入“全部标为已读”
This commit is contained in:
parent
7467b9a74a
commit
0f4deef8f6
|
@ -566,12 +566,15 @@ end
|
|||
forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
|
||||
org_querys = OrgMessage.where("user_id=? and viewed=0", user)
|
||||
at_querys = AtMessage.where("user_id=? and viewed=0", user)
|
||||
contest_querys = ContestMessage.where(:user_id => user, :viewed => 0)
|
||||
course_querys.update_all(:viewed => true) unless course_querys.nil?
|
||||
forge_querys.update_all(:viewed => true) unless forge_querys.nil?
|
||||
user_querys.update_all(:viewed => true) unless user_querys.nil?
|
||||
forum_querys.update_all(:viewed => true) unless forum_querys.nil?
|
||||
org_querys.update_all(:viewed => true) unless org_querys.nil?
|
||||
at_querys.update_all(:viewed => true) unless at_querys.nil?
|
||||
contest_querys.update_all(:viewed => true) unless contest_querys.nil?
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1991,6 +1994,10 @@ end
|
|||
|
||||
def show
|
||||
if is_current_user
|
||||
# 全部设为已读
|
||||
if params[:viewed] == "all"
|
||||
update_message_viewed(@user)
|
||||
end
|
||||
# 自己的主页显示消息
|
||||
# 系统消息为管理员发送,我的消息中包含有系统消息
|
||||
@message_alls = []
|
||||
|
|
|
@ -307,7 +307,8 @@ module UsersHelper
|
|||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
at_count = user.at_messages.where(viewed: false).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count
|
||||
contest_count = ContestMessage.where(:user_id => user, :viewed => 0).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count + contest_count
|
||||
end
|
||||
|
||||
def user_mail_notification_options(user)
|
||||
|
|
|
@ -2,8 +2,12 @@
|
|||
<div class="NewsBannerName">
|
||||
消息动态
|
||||
</div>
|
||||
<span class="fr" style="margin-top:5px;">
|
||||
共 <span style="color: red;"><%= @message_count %></span> 个消息
|
||||
<% count = unviewed_message(@user) %>
|
||||
<span class="fr" style="margin-top:5px;">
|
||||
<% unless (count == 0 || User.current != @user) %>
|
||||
<%= link_to "全部设为已读", user_path(User.current, :viewed => 'all'), :class => "fl mr10" %>
|
||||
<% end %>
|
||||
共 <span style="color: red;" class="fl"><%= @message_count %></span> 个消息
|
||||
</span>
|
||||
</div>
|
||||
<div class="resources">
|
||||
|
@ -11,13 +15,13 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$(".messageInformationContents").each(function(){
|
||||
var parentWidth = $(this).parent().width();
|
||||
var eq0Width = $(this).parent().children().eq(0).width();
|
||||
var eq1Width = $(this).parent().children().eq(1).width();
|
||||
var classWidth = parentWidth - eq0Width - eq1Width - 20;
|
||||
$(this).css("max-width",classWidth + "px");
|
||||
});
|
||||
});
|
||||
$(function(){
|
||||
$(".messageInformationContents").each(function(){
|
||||
var parentWidth = $(this).parent().width();
|
||||
var eq0Width = $(this).parent().children().eq(0).width();
|
||||
var eq1Width = $(this).parent().children().eq(1).width();
|
||||
var classWidth = parentWidth - eq0Width - eq1Width - 20;
|
||||
$(this).css("max-width",classWidth + "px");
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue