From ff3816e97d96134a0cf56c1ae5e9c38d227ea5f0 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 24 Aug 2015 10:38:41 +0800 Subject: [PATCH 01/47] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E7=95=99=E8=A8=80=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 52cb8e0d8..1ed21ff59 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -234,7 +234,7 @@ <%= image_tag(url_to_avatar(ufm.journals_for_message.user), :width => "30", :height => "30") %>
  • - <%= ufm.journals_for_message.user %> + <%=link_to ufm.journals_for_message.user, user_path(ufm.journals_for_message.user), :class => "newsBlue" %>
  • <%= ufm.journals_for_message.reply_id == 0 ? "给你留言了" : "回复了你的留言" %>
  • From e129404b4c4ef4616d91b17de4ea8fcc36ba5944 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 24 Aug 2015 11:11:45 +0800 Subject: [PATCH 02/47] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=82=B9=E4=B8=A4=E6=AC=A1=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/views/layouts/_base_header_new.html.erb | 4 ++-- config/routes.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_base_header_new.html.erb b/app/views/layouts/_base_header_new.html.erb index c224ee0ab..163f3a3ff 100644 --- a/app/views/layouts/_base_header_new.html.erb +++ b/app/views/layouts/_base_header_new.html.erb @@ -56,9 +56,9 @@
  • diff --git a/config/routes.rb b/config/routes.rb index cdc9eec14..eef171b45 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -360,7 +360,7 @@ RedmineApp::Application.routes.draw do end match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get - match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get + match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get, :as => "user_message" From ab37372dad5210463a77c8380c57e2207ab1f916 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 24 Aug 2015 11:13:41 +0800 Subject: [PATCH 03/47] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 1ed21ff59..fe38fc2b0 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -39,7 +39,7 @@ <% if ucm.course_message_type == "News" %> - <% if params[:type].nil? %> -
    - 有 8 封未读全部设为已读 -
    - <% end %>
    <% if @new_message_count >0 %> <%# 课程消息 %> @@ -175,7 +170,6 @@ :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", :title => "#{ma.forge_message.subject.html_safe}" %>
  • <%= time_tag(ma.forge_message.created_on).html_safe %>
  • - <% end %> <% if ma.forge_message_type == "News" %> From b1ed9deba1fae8e0a79600e3e96de903132ac962 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 25 Aug 2015 12:46:57 +0800 Subject: [PATCH 22/47] =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=A1=86=E5=AF=B9?= =?UTF-8?q?=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 3f5549273..f5ae4797f 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -1,4 +1,4 @@ -
    +
    消息
    @@ -244,7 +244,6 @@
    -
    From 4c974266b857a696ac32f5f3afab71e2f84de32b Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 25 Aug 2015 13:04:25 +0800 Subject: [PATCH 23/47] =?UTF-8?q?=E6=B2=A1=E6=B6=88=E6=81=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 12 ++++++------ app/views/users/user_messages.html.erb | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8fd36ee7f..50496fbf8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -113,12 +113,12 @@ class UsersController < ApplicationController 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 + 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 = @user.forge_messages.count + @user.memo_messages.count + @user.course_messages.count + @user.user_feedback_messages.count case params[:type] when nil diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index f5ae4797f..eacac3c5f 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -135,9 +135,9 @@
  • ">指派问题给我
  • - <%= link_to ma.forge_message.subject.html_safe, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.forge_message.subject.html_safe}" %> + <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.forge_message.subject}" %>
  • -
  • <%= time_tag(ma.forge_message.created_on).html_safe %>
  • +
  • <%= time_tag(ma.forge_message.updated_on).html_safe %>
  • <% end %> <% if ma.forge_message_type == "Journal" %> From d7de5fc48025df1124d8cc4d169013acbb7b84c7 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 25 Aug 2015 13:04:46 +0800 Subject: [PATCH 24/47] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 14 +++++++------- db/schema.rb | 10 ++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 16a1bdf4b..231403575 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -68,7 +68,7 @@
    From 1dce1a2a4c142064545bb618a6d460aa9a968300 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 26 Aug 2015 14:47:53 +0800 Subject: [PATCH 37/47] =?UTF-8?q?=E8=80=81=E5=B8=88=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E8=AF=84=E9=98=85=E6=B6=88=E6=81=AF=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=20=E5=8C=BA=E5=88=86=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E8=AF=84=E9=98=85=E5=92=8C=E5=90=8E=E9=9D=A2=E7=9A=84=E8=AF=84?= =?UTF-8?q?=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course_message.rb | 2 +- app/models/student_works_score.rb | 25 ++++++++++++++++--- app/views/users/user_messages.html.erb | 12 +++++---- ...826020407_add_content_to_course_message.rb | 5 ++++ ...0826061843_add_status_to_course_message.rb | 5 ++++ db/schema.rb | 14 +++-------- 6 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 db/migrate/20150826020407_add_content_to_course_message.rb create mode 100644 db/migrate/20150826061843_add_status_to_course_message.rb diff --git a/app/models/course_message.rb b/app/models/course_message.rb index c15c2fc65..95ce3a56b 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,5 +1,5 @@ class CourseMessage < ActiveRecord::Base - attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed + attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status # 多态 虚拟关联 belongs_to :course_message ,:polymorphic => true diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb index 639722389..aa38c5dcd 100644 --- a/app/models/student_works_score.rb +++ b/app/models/student_works_score.rb @@ -1,3 +1,4 @@ +#encoding=UTF-8 class StudentWorksScore < ActiveRecord::Base #reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评 attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role @@ -9,13 +10,31 @@ class StudentWorksScore < ActiveRecord::Base acts_as_attachable - after_create :act_as_course_message + after_save :act_as_course_message # 评阅作品消息提示 def act_as_course_message - if self.student_work + if self.student_work && self.student_work.user && self.student_work.homework_common.course receiver = self.student_work.user - self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, :viewed => false) + # 判断是第一次评阅还是更新 status:0 新建;1 更新 + if self.created_at == self.updated_at + if self.comment.nil? + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}", :status=> false) + else + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}    评语:#{self.comment}", :status=> false) + end + else # 更新 + if self.comment.nil? + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}", :status=> true) + else + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}    评语:#{self.comment}", :status=> true) + end + end end end + end diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index e48c5f4be..7b7060603 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -51,7 +51,7 @@