Merge branch 'dev_hjq' into szzh
This commit is contained in:
commit
5ec742faae
|
@ -68,7 +68,7 @@ class BoardsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
#更新对应的forge_messages表的viewed字段
|
# 讨论区消息状态更新(已读和未读)
|
||||||
if @project
|
if @project
|
||||||
query_forge_messages = @board.messages
|
query_forge_messages = @board.messages
|
||||||
query_forge_messages.each do |query_forge_message|
|
query_forge_messages.each do |query_forge_message|
|
||||||
|
|
|
@ -119,12 +119,14 @@ class IssuesController < ApplicationController
|
||||||
end
|
end
|
||||||
# 缺陷状态更新
|
# 缺陷状态更新
|
||||||
query_journals = @issue.journals
|
query_journals = @issue.journals
|
||||||
if User.current.id == @issue.author_id
|
|
||||||
query_journals.each do |query_journal|
|
query_journals.each do |query_journal|
|
||||||
query_journal.forge_messages.update_all(:viewed => true)
|
query_journal.forge_messages.each do |f|
|
||||||
|
if User.current.id == f.user_id
|
||||||
|
f.update_attributes(:viewed => true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#
|
end
|
||||||
|
# end
|
||||||
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
|
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
|
||||||
@journals.each_with_index {|j,i| j.indice = i+1}
|
@journals.each_with_index {|j,i| j.indice = i+1}
|
||||||
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
||||||
|
|
|
@ -116,9 +116,23 @@ class MemosController < ApplicationController
|
||||||
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
|
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
|
||||||
def show
|
def show
|
||||||
# 更新贴吧帖子留言对应的memo_messages的viewed字段
|
# 更新贴吧帖子留言对应的memo_messages的viewed字段
|
||||||
|
unless @memo.children.blank?
|
||||||
|
@memo.children.each do |child|
|
||||||
|
child.memo_messages.each do |memo_message|
|
||||||
|
if User.current.id == memo_message.user_id
|
||||||
|
memo_message.update_attributes(:viewed => true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
query_memo_messages = @memo.memo_messages
|
query_memo_messages = @memo.memo_messages
|
||||||
pre_count = REPLIES_PER_PAGE
|
query_memo_messages.each do |query_memo_message|
|
||||||
|
if User.current.id == query_memo_message.user_id
|
||||||
|
query_memo_message.update_attributes(:viewed => true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
pre_count = REPLIES_PER_PAGE
|
||||||
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
||||||
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
|
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
|
||||||
|
|
||||||
|
|
|
@ -99,30 +99,32 @@ class NewsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
#更新news对应的forge_messages的viewed字段
|
# 更新news对应的forge_messages的消息viewed字段
|
||||||
query_forge_news = @news.forge_messages
|
if @project
|
||||||
query_forge_news.each do |query|
|
query_message_news = @news.forge_messages
|
||||||
|
else
|
||||||
|
query_message_news = @news.course_messages
|
||||||
|
end
|
||||||
|
query_message_news.each do |query|
|
||||||
if User.current.id == query.user_id
|
if User.current.id == query.user_id
|
||||||
query.update_attributes(:viewed => true)
|
query.update_attributes(:viewed => true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#更新news对应的course_messages的viewed字段
|
# 更新项目新闻的评阅的消息viewed字段
|
||||||
query_course_news = @news.course_messages
|
current_message_comments = @news.comments
|
||||||
query_course_news.each do |query|
|
current_message_comments.each do |current_message_comment|
|
||||||
if User.current.id == query.user_id
|
if @project
|
||||||
query.update_attributes(:viewed => true)
|
query_message_comment = current_message_comment.forge_messages
|
||||||
|
else
|
||||||
|
query_message_comment = current_message_comment.course_messages
|
||||||
end
|
end
|
||||||
end
|
query_message_comment.each do |query|
|
||||||
#更新项目新闻的评阅的viewed字段
|
|
||||||
current_forge_comments = @news.comments
|
|
||||||
current_forge_comments.each do |current_forge_comment|
|
|
||||||
query_forge_comment = current_forge_comment.forge_messages
|
|
||||||
query_forge_comment.each do |query|
|
|
||||||
if User.current.id == query.user_id
|
if User.current.id == query.user_id
|
||||||
query.update_attributes(:viewed => true)
|
query.update_attributes(:viewed => true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# end
|
||||||
|
|
||||||
cs = CoursesService.new
|
cs = CoursesService.new
|
||||||
result = cs.show_course_news params,User.current
|
result = cs.show_course_news params,User.current
|
||||||
|
|
|
@ -28,6 +28,7 @@ class PollController < ApplicationController
|
||||||
render_403
|
render_403
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
# 问卷消息状态更新
|
||||||
query_course_poll = @poll.course_messages
|
query_course_poll = @poll.course_messages
|
||||||
query_course_poll.each do |query|
|
query_course_poll.each do |query|
|
||||||
if User.current.id == query.user_id
|
if User.current.id == query.user_id
|
||||||
|
|
|
@ -106,16 +106,16 @@ class UsersController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
# 当前用户查看消息,则设置消息为已读
|
# 当前用户查看消息,则设置消息为已读
|
||||||
course_querys = @user.course_messages
|
# course_querys = @user.course_messages
|
||||||
forge_querys = @user.forge_messages
|
# forge_querys = @user.forge_messages
|
||||||
user_querys = @user.user_feedback_messages
|
# user_querys = @user.user_feedback_messages
|
||||||
forum_querys = @user.memo_messages
|
# forum_querys = @user.memo_messages
|
||||||
if User.current.id == @user.id
|
# if User.current.id == @user.id
|
||||||
course_querys.update_all(:viewed => true)
|
# course_querys.update_all(:viewed => true)
|
||||||
forge_querys.update_all(:viewed => true)
|
# forge_querys.update_all(:viewed => true)
|
||||||
user_querys.update_all(:viewed => true)
|
# user_querys.update_all(:viewed => true)
|
||||||
forum_querys.update_all(:viewed => true)
|
# forum_querys.update_all(:viewed => true)
|
||||||
end
|
# end
|
||||||
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when nil
|
when nil
|
||||||
|
@ -126,46 +126,41 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
when 'homework'
|
when 'homework'
|
||||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
|
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
|
||||||
when 'course_message'
|
when 'course_message'
|
||||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
# when 'forge_message'
|
||||||
when 'forge_message'
|
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||||
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
# @message_alls_count = @message_alls.count
|
||||||
@message_alls_count = @message_alls.count
|
|
||||||
when 'course_news'
|
when 'course_news'
|
||||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc")
|
# 课程通知包含发布的通知和回复的通知
|
||||||
@message_alls_count = @message_alls.count
|
@message_alls = CourseMessage.where("course_message_type =? or course_message_type =?", "News", "Comment").where("user_id =?", @user).order("created_at desc")
|
||||||
#@user_course_messages_count = @user_course_messages.count
|
#@user_course_messages_count = @user_course_messages.count
|
||||||
when 'forge_news'
|
# when 'forge_news'
|
||||||
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc")
|
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
# @message_alls_count = @message_alls.count
|
||||||
when 'course_news_reply'
|
# when 'course_news_reply'
|
||||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
|
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
|
||||||
when 'forge_news_reply'
|
# when 'forge_news_reply'
|
||||||
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
|
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
# @message_alls_count = @message_alls.count
|
||||||
when 'poll'
|
# when 'poll'
|
||||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
|
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
# @message_alls_count = @message_alls.count
|
||||||
when 'works_reviewers'
|
# when 'works_reviewers'
|
||||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc")
|
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
# @message_alls_count = @message_alls.count
|
||||||
when 'works_reply'
|
# when 'works_reply'
|
||||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
|
# @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
# @message_alls_count = @message_alls.count
|
||||||
when 'issue'
|
when 'issue'
|
||||||
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
|
@message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
# when 'issue_update' # 缺陷状态更新、留言
|
||||||
when 'issue_update' # 缺陷状态更新、留言
|
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc")
|
||||||
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc")
|
# @message_alls_count = @message_alls.count
|
||||||
@message_alls_count = @message_alls.count
|
|
||||||
when 'forum'
|
when 'forum'
|
||||||
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
|
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
|
||||||
when 'user_feedback'
|
when 'user_feedback'
|
||||||
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
|
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
|
||||||
@message_alls_count = @message_alls.count
|
|
||||||
else
|
else
|
||||||
render_404
|
render_404
|
||||||
return
|
return
|
||||||
|
@ -542,6 +537,15 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# modified by fq
|
# modified by fq
|
||||||
def user_newfeedback
|
def user_newfeedback
|
||||||
|
# 更新用户留言消息状态
|
||||||
|
@user.journals_for_messages.each do |jour_message|
|
||||||
|
jour_message.user_feedback_messages.each do |userfeedback_message|
|
||||||
|
if User.current.id == userfeedback_message.user_id
|
||||||
|
userfeedback_message.update_attributes(:viewed => true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# end
|
||||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||||
if User.current == @user
|
if User.current == @user
|
||||||
jours.update_all(:is_readed => true, :status => false)
|
jours.update_all(:is_readed => true, :status => false)
|
||||||
|
|
|
@ -760,7 +760,8 @@ module ApplicationHelper
|
||||||
options = args.extract_options!
|
options = args.extract_options!
|
||||||
text = distance_of_time_in_words(Time.now, time)
|
text = distance_of_time_in_words(Time.now, time)
|
||||||
if @project
|
if @project
|
||||||
link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)},options.reverse_merge(:title => format_time(time)))
|
content_tag('acronym', text, options.reverse_merge(:title => format_time(time)))
|
||||||
|
# link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)},options.reverse_merge(:title => format_time(time)))
|
||||||
else
|
else
|
||||||
content_tag('acronym', text, options.reverse_merge(:title => format_time(time)))
|
content_tag('acronym', text, options.reverse_merge(:title => format_time(time)))
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,7 +73,7 @@ class Attachment < ActiveRecord::Base
|
||||||
cattr_accessor :thumbnails_storage_path
|
cattr_accessor :thumbnails_storage_path
|
||||||
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
||||||
|
|
||||||
before_save :files_to_final_location,:act_as_course_activity
|
before_save :files_to_final_location,:act_as_course_activity,:act_as_forge_activity
|
||||||
after_create :office_conver, :be_user_score,:act_as_forge_activity
|
after_create :office_conver, :be_user_score,:act_as_forge_activity
|
||||||
after_update :office_conver, :be_user_score
|
after_update :office_conver, :be_user_score
|
||||||
after_destroy :delete_from_disk,:down_user_score
|
after_destroy :delete_from_disk,:down_user_score
|
||||||
|
|
|
@ -202,6 +202,7 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
# 用户留言消息通知
|
# 用户留言消息通知
|
||||||
def act_as_user_feedback_message
|
def act_as_user_feedback_message
|
||||||
# 主留言
|
# 主留言
|
||||||
|
if self.jour_type == 'Principal'
|
||||||
receivers = []
|
receivers = []
|
||||||
if self.reply_id == 0
|
if self.reply_id == 0
|
||||||
if self.user_id != self.jour_id # 过滤自己给自己的留言消息
|
if self.user_id != self.jour_id # 过滤自己给自己的留言消息
|
||||||
|
@ -216,7 +217,6 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
receivers << self.parent.jour
|
receivers << self.parent.jour
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.jour_type == 'Principal'
|
|
||||||
receivers.each do |r|
|
receivers.each do |r|
|
||||||
self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false)
|
self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false)
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ class UserFeedbackMessage < ActiveRecord::Base
|
||||||
validates :user_id,presence: true
|
validates :user_id,presence: true
|
||||||
validates :journals_for_message_id,presence: true
|
validates :journals_for_message_id,presence: true
|
||||||
validates :journals_for_message_type, presence: true
|
validates :journals_for_message_type, presence: true
|
||||||
after_create :add_user_message
|
after_save :add_user_message
|
||||||
|
|
||||||
def add_user_message
|
def add_user_message
|
||||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
<!--<li><%#= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>-->
|
<!--<li><%#= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>-->
|
||||||
<!--<li><%#= link_to "新闻回复", user_message_path(User.current, :type => 'forge_news_reply'), :class => "resourcesGrey" %></li>-->
|
<!--<li><%#= link_to "新闻回复", user_message_path(User.current, :type => 'forge_news_reply'), :class => "resourcesGrey" %></li>-->
|
||||||
<%# 项目相关消息 %>
|
<%# 项目相关消息 %>
|
||||||
<!--<li><%#= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>-->
|
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>
|
||||||
<%# 系统贴吧 %>
|
<%# 系统贴吧 %>
|
||||||
<!--<li><%#= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>-->
|
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
||||||
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了作业:</span></li>
|
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了作业:</span></li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),:class => "newsGrey", :title => "#{ma.course_message.name}" %></a></li>
|
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %></a></li>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -81,8 +81,9 @@
|
||||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %></a></li>
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %></a></li>
|
||||||
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
|
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%=link_to ma.course_message.subject.html_safe, course_boards_path(ma.course_message.course,:parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id,
|
<%= link_to ma.course_message.parent_id.nil? ? ma.course_message.subject.html_safe : ma.course_message.content.html_safe,
|
||||||
:topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
|
course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
|
||||||
|
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
|
||||||
:title => "#{ma.course_message.subject.html_safe}" %></a></li>
|
:title => "#{ma.course_message.subject.html_safe}" %></a></li>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@
|
||||||
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.status == 0 ? "评阅了作品:" : "重新评阅了作品:" %></span></li>
|
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.status == 0 ? "评阅了作品:" : "重新评阅了作品:" %></span></li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<% unless ma.content.nil? %>
|
<% unless ma.content.nil? %>
|
||||||
<%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),:class=>"newsGrey",:title => "#{ma.content.html_safe}" %></a></li>
|
<%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.content.html_safe}" %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -104,7 +105,7 @@
|
||||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
||||||
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复了作品评论:</span></li>
|
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复了作品评论:</span></li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id),:class=>"newsGrey",:title => "#{ma.course_message.notes}" %></a></li>
|
<%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.course_message.notes}" %></a></li>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -150,7 +151,7 @@
|
||||||
<li class="homepageNewsPubType fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %>
|
<li class="homepageNewsPubType fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %>
|
||||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %></span></li>
|
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %></span></li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%=link_to ma.forge_message.subject.html_safe, project_boards_path(ma.forge_message.project,
|
<%=link_to ma.forge_message.parent_id.nil? ? ma.forge_message.subject.html_safe : ma.forge_message.content.html_safe, project_boards_path(ma.forge_message.project,
|
||||||
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
|
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
|
||||||
:topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
|
:topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
|
||||||
:title => "#{ma.forge_message.subject.html_safe}" %></a></li>
|
:title => "#{ma.forge_message.subject.html_safe}" %></a></li>
|
||||||
|
@ -167,7 +168,7 @@
|
||||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了新闻:</span>
|
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了新闻:</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%= link_to ("#{ma.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ma.forge_message.id}, :class => "newsGrey", :title => "#{ma.forge_message.title.html_safe}" %></a>
|
<%= link_to ("#{ma.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ma.forge_message.id}, :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.forge_message.title.html_safe}" %></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -196,7 +197,7 @@
|
||||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>" ><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %></span>
|
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>" ><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%= link_to ma.memo.subject, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id),:class => "newsGrey" , :title => "#{ma.memo.content.html_safe}" %></a>
|
<%= link_to ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content}" %></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.memo.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.memo.created_at).html_safe %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -214,9 +215,10 @@
|
||||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
|
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
<%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class => "newsGrey", :title => "#{ma.journals_for_message.notes}" %></a>
|
<%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.journals_for_message.notes}" %></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.journals_for_message.created_on).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.journals_for_message.created_on).html_safe %> </li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -244,4 +246,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
class AboutMemoMessage < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Memo.all.each do |memo|
|
||||||
|
transaction do
|
||||||
|
# 贴吧帖子
|
||||||
|
receivers = []
|
||||||
|
u = User.find(6)
|
||||||
|
receivers << u
|
||||||
|
# 主贴
|
||||||
|
if memo.parent_id.nil?
|
||||||
|
if memo.author_id != memo.forum.creator_id # 发帖人不是吧主
|
||||||
|
receivers << memo.forum.creator
|
||||||
|
end
|
||||||
|
else # 回帖
|
||||||
|
# 添加吧主
|
||||||
|
if memo.author_id != memo.forum.creator_id
|
||||||
|
receivers << memo.forum.creator
|
||||||
|
end
|
||||||
|
# 添加发帖人
|
||||||
|
unless memo.parent.nil?
|
||||||
|
if memo.author_id != memo.parent.author_id
|
||||||
|
receivers << memo.parent.author
|
||||||
|
puts memo.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
receivers.each do |r|
|
||||||
|
memo.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => memo.forum_id, :memo_id => memo.id, :memo_type => "Memo", :viewed => true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,36 @@
|
||||||
|
class AboutUserFeedbackMessage < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
JournalsForMessage.all.each do |jour_for_message|
|
||||||
|
transaction do
|
||||||
|
# 主留言
|
||||||
|
if jour_for_message.jour_type == 'Principal'
|
||||||
|
receivers = []
|
||||||
|
if jour_for_message.reply_id == 0
|
||||||
|
if jour_for_message.user_id != jour_for_message.jour_id # 过滤自己给自己的留言消息
|
||||||
|
receivers << jour_for_message.jour
|
||||||
|
end
|
||||||
|
else # 留言回复
|
||||||
|
reply_to = User.find(jour_for_message.reply_id)
|
||||||
|
if jour_for_message.user_id != jour_for_message.reply_id # 添加我回复的那个人
|
||||||
|
receivers << reply_to
|
||||||
|
end
|
||||||
|
unless jour_for_message.parent.nil?
|
||||||
|
if jour_for_message.user_id != jour_for_message.parent.jour_id && jour_for_message.reply_id != jour_for_message.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发
|
||||||
|
receivers << jour_for_message.parent.jour
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
unless receivers.blank?
|
||||||
|
receivers.each do |r|
|
||||||
|
puts jour_for_message.id
|
||||||
|
jour_for_message.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => jour_for_message.id, :journals_for_message_type => "Principal", :viewed => true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
class UpdateMemoMessageTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
memo_count = Memo.all.count / 30 + 1
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... memo_count do i
|
||||||
|
MemoMessage.page(i).per(30).each do |memo_message|
|
||||||
|
if memo_message.memo
|
||||||
|
if memo_message.memo.respond_to?("created_at")
|
||||||
|
memo_message.created_at = memo_message.memo.created_at
|
||||||
|
elsif memo_message.memo.respond_to?("created_on")
|
||||||
|
memo_message.created_at = memo_message.memo.created_on
|
||||||
|
end
|
||||||
|
memo_message.save
|
||||||
|
|
||||||
|
memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first
|
||||||
|
memo_messages.created_at = memo_message.created_at
|
||||||
|
memo_messages.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,27 @@
|
||||||
|
class UpdateUserfeebackMessageTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
user_feedback_count = UserFeedbackMessage.all.count / 30 + 1
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... user_feedback_count do i
|
||||||
|
UserFeedbackMessage.page(i).per(30).each do |ufm|
|
||||||
|
if ufm.journals_for_message
|
||||||
|
if ufm.journals_for_message.respond_to?("created_at")
|
||||||
|
ufm.created_at = ufm.journals_for_message.created_at
|
||||||
|
elsif ufm.journals_for_message.respond_to?("created_on")
|
||||||
|
ufm.created_at = ufm.journals_for_message.created_on
|
||||||
|
end
|
||||||
|
puts ufm.id
|
||||||
|
ufm.save
|
||||||
|
|
||||||
|
user_feedback_messages = MessageAll.where("message_type = '#{ufm.class.to_s}' and message_id = '#{ufm.id}'").first
|
||||||
|
user_feedback_messages.created_at = ufm.created_at
|
||||||
|
user_feedback_messages.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -248,6 +248,13 @@ function regexDescription() {
|
||||||
$("#description_notice_span").focus();
|
$("#description_notice_span").focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (name.length > 10000)
|
||||||
|
{
|
||||||
|
$("#description_notice_span").text("描述超过10000个字符");
|
||||||
|
$("#description_notice_span").css('color', '#ff0000');
|
||||||
|
$("#description_notice_span").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$("#description_notice_span").text("填写正确");
|
$("#description_notice_span").text("填写正确");
|
||||||
$("#description_notice_span").css('color', '#008000');
|
$("#description_notice_span").css('color', '#008000');
|
||||||
|
|
|
@ -525,6 +525,7 @@ a.replyGrey1 {color:#888888;}
|
||||||
a.replyGrey1:hover {color:#4b4b4b;}
|
a.replyGrey1:hover {color:#4b4b4b;}
|
||||||
a.newsBlue {color:#269ac9;}
|
a.newsBlue {color:#269ac9;}
|
||||||
a.newsBlue:hover {color:#297fb8;}
|
a.newsBlue:hover {color:#297fb8;}
|
||||||
|
a.newsBlack {color:#000000; font-size:13px; font-weight:bold}
|
||||||
a.menuGrey {color:#808080;}
|
a.menuGrey {color:#808080;}
|
||||||
a.menuGrey:hover {color:#fe7d68;}
|
a.menuGrey:hover {color:#fe7d68;}
|
||||||
.navSearchTypeBox {width:368px; height:35px; position:absolute; border:1px solid #e1e1e1; background-color:#ffffff; padding-left:10px; display:none; color:#3e3e3e; font-size:14px;}
|
.navSearchTypeBox {width:368px; height:35px; position:absolute; border:1px solid #e1e1e1; background-color:#ffffff; padding-left:10px; display:none; color:#3e3e3e; font-size:14px;}
|
||||||
|
@ -905,7 +906,7 @@ img.ui-datepicker-trigger {
|
||||||
margin: 7px;
|
margin: 7px;
|
||||||
}
|
}
|
||||||
/*消息*/
|
/*消息*/
|
||||||
.homepageNewsTypeNotRead {width:95px; font-size:12px; color:#888888; display:block;}
|
.homepageNewsTypeNotRead {width:100px; padding-left: 5px; font-size:12px; color:#4b4b4b; font-weight:bold; display:block;}
|
||||||
.calendar_input{border-left:none !important;border-bottom: none!important; border-top: none!important; border-right: 1px solid #d9d9d9;}
|
.calendar_input{border-left:none !important;border-bottom: none!important; border-top: none!important; border-right: 1px solid #d9d9d9;}
|
||||||
.calendar_div{border: 1px solid #d9d9d9;}
|
.calendar_div{border: 1px solid #d9d9d9;}
|
||||||
/*缺陷更新动态在消息中显示样式*/
|
/*缺陷更新动态在消息中显示样式*/
|
||||||
|
|
|
@ -507,7 +507,7 @@ img.ui-datepicker-trigger {
|
||||||
.wiki_new_ul input{ height:26px; margin-bottom:10px;}
|
.wiki_new_ul input{ height:26px; margin-bottom:10px;}
|
||||||
.wiki_con_tit{ font-size:14px; color:#09658c; font-weight:bold;width:630px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; margin-bottom:10px;}
|
.wiki_con_tit{ font-size:14px; color:#09658c; font-weight:bold;width:630px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; margin-bottom:10px;}
|
||||||
.wiki_con_box{ line-height:1.9; color:#2d2d2d;}
|
.wiki_con_box{ line-height:1.9; color:#2d2d2d;}
|
||||||
.wiki_page_con{ border-bottom:1px dashed #CCC; margin-bottom:10px; padding-bottom:10px;}
|
.wiki_page_con{ border-bottom:1px dashed #CCC; margin-bottom:10px; padding-bottom:10px; word-wrap:break-word; word-break:break-all}
|
||||||
.wiki_page p{word-break: break-all;word-wrap: break-word;}
|
.wiki_page p{word-break: break-all;word-wrap: break-word;}
|
||||||
#wiki_new_box{ display:none;}
|
#wiki_new_box{ display:none;}
|
||||||
/*wiki显示附加*/
|
/*wiki显示附加*/
|
||||||
|
|
Loading…
Reference in New Issue