diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 03d71e7f0..3ca11c719 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -419,7 +419,8 @@ class ProjectsController < ApplicationController # 发送邮件邀请新用户页面对应方法 def invite_members_by_mail if User.current.member_of?(@project) || User.current.admin? - @inviter_lists = InviteList.where(project_id:@project.id) + @inviter_lists = InviteList.where(project_id:@project.id).order("created_at desc") + # @inviters = [] # @waiters = [] # unless @inviter_lists.blank? diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6669a43d7..748967990 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -107,17 +107,18 @@ class UsersController < ApplicationController end # 记录当前点击按钮的时间 # 考虑到用户未退出刷新消息页面 - if OnclickTime.where("user_id =?", User.current).first.nil? + message_time = OnclickTime.where("user_id =?", User.current).first + if message_time.nil? message_new_time = OnclickTime.new message_new_time.user_id = User.current.id message_new_time.onclick_time = Time.now message_new_time.save else - message_new_time = OnclickTime.where("user_id =?", User.current).first - message_last_time = message_new_time.onclick_time - message_new_time.update_attributes(:onclick_time => Time.now) + # 24小时内显示 + contrast_time = Time.now - 86400 + message_time.update_attributes(:onclick_time => Time.now) end - @user_system_messages = SystemMessage.where("created_at >?", message_last_time).order("created_at desc") + @user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc") # 当前用户查看消息,则设置消息为已读 if params[:viewed] == "all" course_querys = @user.course_messages diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 05f28d286..376f7ab8e 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -32,7 +32,7 @@
-<% if @message_alls.count >0 %> +<% if @message_alls.count >0 || @user_system_messages.count >0 %> <% if params[:type].nil? || params[:type] == "unviewed" %>
有 <%= unviewed_message(@user) %> 条未读 @@ -46,21 +46,18 @@ <% @user_system_messages.each do |usm| %>
  • - - - +
  • Trustie平台发布新消息:
  • - <%= link_to usm.content.nil? ? usm.description.html_safe : usm.content.html_safe, user_message_path(User.current, :type => "system_messages"), - :class => "newsRed", - :onmouseover => "message_titile_show($(this),event);", - :onmouseout => "message_titile_hide($(this));" - %> + 【系统消息】
  • + <%= link_to usm.content.nil? ? usm.description.html_safe : usm.content.html_safe, user_message_path(User.current, :type => "system_messages"), + :id => "content_link_#{usm.id}", + :onmouseover =>"message_titile_show($(this),event);", + :onmouseout => "message_titile_hide($(this));" + %>