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' %>
如果您一直收不到激活邮件,请按照以下步骤操作:
1.请确认是否填写了正确的邮箱地址
2.请注意查看邮箱中的“订阅邮件”、“垃圾邮件”,可能Trustie的邮件被误杀了
- 3.点击这里重新发送激活邮件
+ 3.请点击重新发送激活邮件按钮
4.如果您无法收到激活邮件,请直接给我们留言:
<% get_memo %>
From 7d226f9ce02a037faec2ef6c9af0565ab5468995 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Mon, 16 Jan 2017 10:18:59 +0800
Subject: [PATCH 03/16] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95/=E4=BB=96?=
=?UTF-8?q?=E4=BA=BA=E6=9F=A5=E7=9C=8B=E8=87=AA=E5=B7=B1=E5=8F=91=E5=B8=83?=
=?UTF-8?q?=E7=9A=84issue/=E4=BD=9C=E4=B8=9A,=E8=87=AA=E5=B7=B1=E6=94=B6?=
=?UTF-8?q?=E5=88=B0=E7=9A=84issue/=E4=BD=9C=E4=B8=9A=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=EF=BC=8C=E5=A4=B4=E9=83=A8=E4=B8=80=E6=A0=8F=E8=B0=83=E6=95=B4?=
=?UTF-8?q?=E4=B8=BA=E2=80=9CTA=E5=8F=91=E5=B8=83=E7=9A=84ISSUE/=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E2=80=9D=E7=AD=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/users/user_manage_homeworks.html.erb | 2 +-
app/views/users/user_manage_issues.html.erb | 4 +++-
app/views/users/user_receive_homeworks.html.erb | 2 +-
app/views/users/user_receive_issues.html.erb | 4 +++-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/views/users/user_manage_homeworks.html.erb b/app/views/users/user_manage_homeworks.html.erb
index 83bd70ab6..850f4a85e 100644
--- a/app/views/users/user_manage_homeworks.html.erb
+++ b/app/views/users/user_manage_homeworks.html.erb
@@ -5,7 +5,7 @@
- 我发布的的作业
+ <%= @user.id == User.current.id ? "我发布的的作业" : "TA发布的的作业" %>
diff --git a/app/views/users/user_manage_issues.html.erb b/app/views/users/user_manage_issues.html.erb
index 6a69800e1..7c116fabe 100644
--- a/app/views/users/user_manage_issues.html.erb
+++ b/app/views/users/user_manage_issues.html.erb
@@ -218,7 +218,9 @@
-
我发布的Issue
+
+ <%= @user.id == User.current.id ? "我发布的Issue" : "TA发布的Issue" %>
+
diff --git a/app/views/users/user_receive_homeworks.html.erb b/app/views/users/user_receive_homeworks.html.erb
index 58a79ba5c..2199039bb 100644
--- a/app/views/users/user_receive_homeworks.html.erb
+++ b/app/views/users/user_receive_homeworks.html.erb
@@ -5,7 +5,7 @@
- 我收到的的作业
+ <%= @user.id == User.current.id ? "我收到的的作业" : "TA收到的的作业" %>
diff --git a/app/views/users/user_receive_issues.html.erb b/app/views/users/user_receive_issues.html.erb
index 883b77688..29f5315ca 100644
--- a/app/views/users/user_receive_issues.html.erb
+++ b/app/views/users/user_receive_issues.html.erb
@@ -218,7 +218,9 @@
-
我收到的Issue
+
+ <%= @user.id == User.current.id ? "我收到的Issue" : "TA收到的Issue" %>
+
From e03d80de69e8db96489be19e9452cc4929c8f04d Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Mon, 16 Jan 2017 15:28:56 +0800
Subject: [PATCH 04/16] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E5=B8=96=E5=AD=90?=
=?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BA=BA=E5=88=A0=E9=99=A4=E5=B8=96=E5=AD=90?=
=?UTF-8?q?=E6=8A=A5=E2=80=9C=E9=A1=B5=E9=9D=A2=E4=B8=8D=E5=AD=98=E5=9C=A8?=
=?UTF-8?q?=E2=80=9D=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/memo.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/memo.rb b/app/models/memo.rb
index 3c36875d1..da84ffcda 100644
--- a/app/models/memo.rb
+++ b/app/models/memo.rb
@@ -203,7 +203,7 @@ class Memo < ActiveRecord::Base
end
def destroyable_by? user
- (user && self.author == user) || user.admin? || self.forum.creator == user
+ (user && self.author == user) || user.admin? || self.forum.creator == user || Memo.find(self.root_id).author == user
#self.author == user || user.admin?
end
From 1c32c47d4921e1e3315490fbe412b8c20efadf22 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 17 Jan 2017 14:46:44 +0800
Subject: [PATCH 05/16] =?UTF-8?q?=E6=88=91=E5=8F=91=E5=B8=83=E7=9A=84?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=92=8C=E6=88=91=E6=94=B6=E5=88=B0=E7=9A=84?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=A7=86=E8=A7=89=E6=95=88=E6=9E=9C=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/users/_manage_homework_list.html.erb | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/app/views/users/_manage_homework_list.html.erb b/app/views/users/_manage_homework_list.html.erb
index be2ef9fc0..bdef131c2 100644
--- a/app/views/users/_manage_homework_list.html.erb
+++ b/app/views/users/_manage_homework_list.html.erb
@@ -12,13 +12,14 @@
- <%= (cur_homework_end_time homework).html_safe %>
+ <%= (cur_homework_end_time homework).html_safe %>
未交:
- <%= homework.course.student.count - homework.student_works.has_committed.count %>
- 已评:
- <%= homework.student_works.where("work_status != 0 and (teacher_score is not null or teaching_asistant_score is not null)").count %>
- 未评:
- <%= homework.student_works.where("work_status != 0 and teacher_score is null and teaching_asistant_score is null").count %>
+ <%= homework.course.student.count - homework.student_works.has_committed.count %>
+ 已评:
+ <%= homework.student_works.where("work_status != 0 and (teacher_score is not null or teaching_asistant_score is not null)").count %>
+ <% not_evaluate_count = homework.student_works.where("work_status != 0 and teacher_score is null and teaching_asistant_score is null").count %>
+ 未评:
+ hw_w30 fl mr30"><%= not_evaluate_count %>
<% if homework.student_works.has_committed.count == 0 %>
From b1a71d12a9554b4ad596ccee3a80f5d7ef32331f Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 17 Jan 2017 16:12:01 +0800
Subject: [PATCH 06/16] =?UTF-8?q?=E6=96=B0=E6=B3=A8=E5=86=8C=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=EF=BC=88=E6=88=96=E8=B5=84=E6=96=99=E4=B8=8D=E5=85=A8?=
=?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=EF=BC=89=EF=BC=8C=E8=BF=9B=E5=85=A5?=
=?UTF-8?q?=E7=9A=84=E9=A6=96=E9=A1=B5=E2=80=9C=E5=9F=BA=E6=9C=AC=E8=B5=84?=
=?UTF-8?q?=E6=96=99=E2=80=9D=E7=BC=96=E8=BE=91=E9=A1=B5=EF=BC=8C=E5=AF=BC?=
=?UTF-8?q?=E8=88=AA=E6=A0=8F=E6=98=BE=E7=A4=BA=E6=96=B0=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/my_controller.rb | 5 -----
app/views/layouts/_logined_header.html.erb | 2 +-
app/views/layouts/_new_feedback.html.erb | 4 ++--
app/views/layouts/new_base_user.html.erb | 15 ++++++++++++++-
4 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index 12cbaacc9..ac5c7a67d 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -225,12 +225,7 @@ class MyController < ApplicationController
File.delete(diskfile1) if File.exist?(diskfile1)
end
- # 基本资料不完善,无法使用其他功能,完善着可继续使用
- if @force
- render :layout => 'new_base_user_show'
- else
render :layout => 'new_base_user'
- end
end
# Destroys user's account
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 096fc0407..4a1c23753 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -86,7 +86,7 @@
- <%= link_to "退出",logout_url_without_domain,:class => "menuGrey",:method => "post"%>
+ <%= link_to "退出",logout_url_without_domain,:class => "menuGrey",:method => "post", :id => "logout_trustie" %>
diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb
index d2c878698..e5b182fb5 100644
--- a/app/views/layouts/_new_feedback.html.erb
+++ b/app/views/layouts/_new_feedback.html.erb
@@ -16,8 +16,8 @@
<%= f.text_area :subject, :id=>"subject", :class => "opnionText mb5", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
还能输入50 个字符
-
- <%= l(:label_submit)%>
+
+ <%= l(:label_submit) %>
<% end %>
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index 3a0ecffae..acfdf4728 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -64,7 +64,6 @@
})
-
<% is_current_user = User.current.logged? && User.current == @user %>
@@ -291,6 +290,20 @@
$("#projectMenu").mouseleave(function(){
$("#topnav_project_menu").hide();
});
+ // 如果是强制修改资料页面,则除退出按钮外,其他按钮的连接都失效
+ <% if @force %>
+ // 禁用所有a标签
+ var t = document.getElementsByTagName("a");
+ len = t.length;
+ for(var i=0;i