From 10ed1748018df5fef776b140b0d6d4b7b7ba90e0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 13 Jan 2017 18:51:34 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E5=85=A8=E9=83=A8=E8=AE=BE=E4=B8=BA?= =?UTF-8?q?=E5=B7=B2=E8=AF=BB=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 50 +++++++++---------- .../_join_course_course_message.html.erb | 6 +-- app/views/users/_user_message_course.html.erb | 4 +- app/views/users/_user_message_list.html.erb | 2 +- config/routes.rb | 1 + 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5e8f3d5d6..6116a7b69 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -36,7 +36,7 @@ class UsersController < ApplicationController # before_filter :can_show_course, :only => [:user_courses,:user_homeworks] before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks, - :unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, + :unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :update_message_viewed, :anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks, :unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist, :user_manage_issues, :user_receive_issues, @@ -489,9 +489,9 @@ class UsersController < ApplicationController # 初始化/更新 点击按钮时间, 24小时内显示系统消息 update_onclick_time # 全部设为已读 - if params[:viewed] == "all" - update_message_viewed(@user) - end + # if params[:viewed] == "all" + # update_message_viewed(@user) + # end # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count courses = @user.courses.where("is_delete = 1") course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")" @@ -571,27 +571,28 @@ class UsersController < ApplicationController end # 消息设置为已读 - def update_message_viewed(user) + def update_message_viewed if User.current.id == @user.id - course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0) - forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0) - user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0) - 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) - blog_querys = BlogMessage.where(:user_id => user, :viewed => 0) - applied_querys = AppliedMessage.where("user_id=? and viewed =?", user, 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? - blog_querys.update_all(:viewed => true) unless blog_querys.nil? - applied_querys.update_all(:viewed => true) unless applied_querys.nil? + course_querys = CourseMessage.where("user_id =? and viewed =?", @user.id, 0) + forge_querys = ForgeMessage.where("user_id =? and viewed =?", @user.id, 0) + user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", @user.id, 0) + forum_querys = MemoMessage.where("user_id =? and viewed =?", @user.id, 0) + org_querys = OrgMessage.where("user_id=? and viewed=0", @user.id) + at_querys = AtMessage.where("user_id=? and viewed=0", @user.id) + contest_querys = ContestMessage.where(:user_id => @user.id, :viewed => 0) + blog_querys = BlogMessage.where(:user_id => @user.id, :viewed => 0) + applied_querys = AppliedMessage.where("user_id=? and viewed =?", @user.id, 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? + blog_querys.update_all(:viewed => true) unless blog_querys.nil? + applied_querys.update_all(:viewed => true) unless applied_querys.nil? end + redirect_to user_path(@user) end # 系统消息 @@ -2011,9 +2012,6 @@ class UsersController < ApplicationController def show if User.current == @user # 全部设为已读 - if params[:viewed] == "set_viewed" - update_message_viewed(@user) - end # 自己的主页显示消息 messages_all = MessageAll.where(:user_id => @user.id) @message_count = messages_all.count diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb index 9f3d21259..d84a2e744 100644 --- a/app/views/users/_join_course_course_message.html.erb +++ b/app/views/users/_join_course_course_message.html.erb @@ -39,10 +39,10 @@ | <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%> <% elsif ma.status == 1%> - 您已同意申请 + <%= Course.find(ma.course_id).teacher.show_name %>已同意 <% elsif ma.status == 2%> - 您已拒绝申请 - <%end %> + <%= Course.find(ma.course_id).teacher.show_name %>已拒绝 + <% end %>
  • <%= time_tag(ma.created_at).html_safe %>
  • diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 4453c2286..d9d9d756a 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -726,9 +726,9 @@
  • <% if ma.status == 1 %> - <%= User.find(ma.course_message_id).show_name %>已通过 + <%= User.find(ma.course_message_id).show_name %>已同意 <% else %> - <%= User.find(ma.course_message_id).show_name %>已拒绝 + <%= User.find(ma.course_message_id).show_name %>已拒绝 <% end %>
  • <%= time_tag(ma.created_at).html_safe %>
  • diff --git a/app/views/users/_user_message_list.html.erb b/app/views/users/_user_message_list.html.erb index d71672257..6bb7346e4 100644 --- a/app/views/users/_user_message_list.html.erb +++ b/app/views/users/_user_message_list.html.erb @@ -5,7 +5,7 @@ <% count = unviewed_message(@user) %> <% unless (count == 0 || User.current != @user) %> - <%= link_to "全部设为已读", user_path(User.current, :viewed => 'set_viewed'), :class => "fl mr10" %> + <%= link_to "全部设为已读", update_message_viewed_user_path(@user), :class => "fl mr10" %> <% end %> <%= @message_count %> 个消息 diff --git a/config/routes.rb b/config/routes.rb index e8f2c1c18..c3a41703f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -699,6 +699,7 @@ RedmineApp::Application.routes.draw do get 'choose_user_course' get 'user_import_resource' match 'watch_projects', :to => 'users#watch_projects', :via => :get + get 'update_message_viewed' # # added by bai match 'show_score', :to => 'users#show_score', :via => :get From 11c5c2783d3f4385e51334d2adee645f4cc10ac9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 14 Jan 2017 09:44:01 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=98=BE=E7=A4=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=9C=89=E8=AF=AF=EF=BC=8C=E6=8C=89=E7=85=A7=E8=A6=81=E6=B1=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/account/email_valid.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/account/email_valid.html.erb b/app/views/account/email_valid.html.erb index 423057da6..84da6d04d 100644 --- a/app/views/account/email_valid.html.erb +++ b/app/views/account/email_valid.html.erb @@ -5,18 +5,18 @@

    注册成功! 请在24小时内点击邮件中的链接来激活您的账号。

    -

    请登录邮箱(<%= @mail_type %>)收取账号激活邮件。
    点击邮件中的激活链接,方可使用该账号 +

    请登录邮箱(<%= @user.mail %>)收取账号激活邮件。
    点击邮件中的激活链接,方可使用该账号

    <%= l(:label_check_email)%> -     <%= link_to "".html_safe, { :controller => 'account', :action => 'resendmail', :user => @user}, :remote => true, :method => 'get' %> +     <%= link_to "".html_safe, { :controller => 'account', :action => 'resendmail', :user => @user}, :remote => true, :method => 'get' %>