diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 72301754d..53fb21b8c 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -68,7 +68,7 @@ class BoardsController < ApplicationController end def show - #更新对应的forge_messages表的viewed字段 + # 璁ㄨ鍖烘秷鎭姸鎬佹洿鏂帮紙宸茶鍜屾湭璇伙級 if @project query_forge_messages = @board.messages query_forge_messages.each do |query_forge_message| diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index c73e6bc93..b3624b14d 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -119,12 +119,14 @@ class IssuesController < ApplicationController end # 缂洪櫡鐘舵佹洿鏂 query_journals = @issue.journals - if User.current.id == @issue.author_id 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 @journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all @journals.each_with_index {|j,i| j.indice = i+1} @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 11d1d6e18..27e0d472f 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -115,10 +115,24 @@ class MemosController < ApplicationController REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE) def show - #鏇存柊璐村惂甯栧瓙鐣欒█瀵瑰簲鐨刴emo_messages鐨剉iewed瀛楁 + # 鏇存柊璐村惂甯栧瓙鐣欒█瀵瑰簲鐨刴emo_messages鐨剉iewed瀛楁 + 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 - 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 # 鍙栧嚭妤间富锛岄槻姝㈣緭鍏ュ笘瀛恑d璁╁洖澶嶄綔涓轰富璐存樉绀 @memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1)) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d445fc77c..d5c248f77 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -99,30 +99,32 @@ class NewsController < ApplicationController end def show - #鏇存柊news瀵瑰簲鐨刦orge_messages鐨剉iewed瀛楁 - query_forge_news = @news.forge_messages - query_forge_news.each do |query| - if User.current.id == query.user_id - query.update_attributes(:viewed => true) - end + # 鏇存柊news瀵瑰簲鐨刦orge_messages鐨勬秷鎭痸iewed瀛楁 + if @project + query_message_news = @news.forge_messages + else + query_message_news = @news.course_messages end - #鏇存柊news瀵瑰簲鐨刢ourse_messages鐨剉iewed瀛楁 - query_course_news = @news.course_messages - query_course_news.each do |query| - if User.current.id == query.user_id - query.update_attributes(:viewed => true) - end + query_message_news.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end end - #鏇存柊椤圭洰鏂伴椈鐨勮瘎闃呯殑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| + # 鏇存柊椤圭洰鏂伴椈鐨勮瘎闃呯殑娑堟伅viewed瀛楁 + current_message_comments = @news.comments + current_message_comments.each do |current_message_comment| + if @project + query_message_comment = current_message_comment.forge_messages + else + query_message_comment = current_message_comment.course_messages + end + query_message_comment.each do |query| if User.current.id == query.user_id query.update_attributes(:viewed => true) end end end + # end cs = CoursesService.new result = cs.show_course_news params,User.current diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 1bbcf9bb4..a8f2a11f1 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -28,6 +28,7 @@ class PollController < ApplicationController render_403 return end + # 闂嵎娑堟伅鐘舵佹洿鏂 query_course_poll = @poll.course_messages query_course_poll.each do |query| if User.current.id == query.user_id diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ea4dc25a3..1fac6737b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -106,16 +106,16 @@ class UsersController < ApplicationController return end # 褰撳墠鐢ㄦ埛鏌ョ湅娑堟伅锛屽垯璁剧疆娑堟伅涓哄凡璇 - course_querys = @user.course_messages - 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 + # course_querys = @user.course_messages + # 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 # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count case params[:type] when nil @@ -126,46 +126,41 @@ class UsersController < ApplicationController end when 'homework' @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' @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' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") - @message_alls_count = @message_alls.count + # when 'forge_message' + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") + # @message_alls_count = @message_alls.count 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 - when 'forge_news' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'course_news_reply' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - when 'forge_news_reply' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'poll' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'works_reviewers' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'works_reply' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") - @message_alls_count = @message_alls.count + # when 'forge_news' + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'course_news_reply' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") + # when 'forge_news_reply' + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'poll' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'works_reviewers' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'works_reply' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + # @message_alls_count = @message_alls.count when 'issue' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'issue_update' # 缂洪櫡鐘舵佹洿鏂般佺暀瑷 - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") - @message_alls_count = @message_alls.count + @message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc") + # when 'issue_update' # 缂洪櫡鐘舵佹洿鏂般佺暀瑷 + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") + # @message_alls_count = @message_alls.count when 'forum' @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") - @message_alls_count = @message_alls.count when 'user_feedback' @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") - @message_alls_count = @message_alls.count else render_404 return @@ -542,6 +537,15 @@ class UsersController < ApplicationController # modified by fq 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') if User.current == @user jours.update_all(:is_readed => true, :status => false) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fcf28506a..ad9322cbc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -760,7 +760,8 @@ module ApplicationHelper options = args.extract_options! text = distance_of_time_in_words(Time.now, time) 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 content_tag('acronym', text, options.reverse_merge(:title => format_time(time))) end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index f7fb9b1aa..47ab30cb1 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -73,7 +73,7 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@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_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 6f775e7a2..c44b1aeee 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -202,24 +202,24 @@ class JournalsForMessage < ActiveRecord::Base # 鐢ㄦ埛鐣欒█娑堟伅閫氱煡 def act_as_user_feedback_message # 涓荤暀瑷 - receivers = [] - if self.reply_id == 0 - if self.user_id != self.jour_id # 杩囨护鑷繁缁欒嚜宸辩殑鐣欒█娑堟伅 - receivers << self.jour - end - else # 鐣欒█鍥炲 - reply_to = User.find(self.reply_id) - if self.user_id != self.reply_id # 娣诲姞鎴戝洖澶嶇殑閭d釜浜 - receivers << reply_to - end - if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 缁欎笢瀹跺彂淇℃伅锛屽鏋滃洖澶嶇殑瀵硅薄鏄笢瀹跺垯涓嶅彂 - receivers << self.parent.jour - end - end if self.jour_type == 'Principal' - 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) + receivers = [] + if self.reply_id == 0 + if self.user_id != self.jour_id # 杩囨护鑷繁缁欒嚜宸辩殑鐣欒█娑堟伅 + receivers << self.jour end + else # 鐣欒█鍥炲 + reply_to = User.find(self.reply_id) + if self.user_id != self.reply_id # 娣诲姞鎴戝洖澶嶇殑閭d釜浜 + receivers << reply_to + end + if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 缁欎笢瀹跺彂淇℃伅锛屽鏋滃洖澶嶇殑瀵硅薄鏄笢瀹跺垯涓嶅彂 + receivers << self.parent.jour + end + end + 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) + end end end diff --git a/app/models/user_feedback_message.rb b/app/models/user_feedback_message.rb index 1dda157d6..02335b8e2 100644 --- a/app/models/user_feedback_message.rb +++ b/app/models/user_feedback_message.rb @@ -8,7 +8,7 @@ class UserFeedbackMessage < ActiveRecord::Base validates :user_id,presence: true validates :journals_for_message_id,presence: true validates :journals_for_message_type, presence: true - after_create :add_user_message + after_save :add_user_message def add_user_message self.message_alls << MessageAll.new(:user_id => self.user_id) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index d330857c3..d965c92e7 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -19,9 +19,9 @@ <%# 椤圭洰鐩稿叧娑堟伅 %> - +
  • <%= link_to "璐村惂甯栧瓙", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
  • <%# 绯荤粺璐村惂 %> - +
  • <%= link_to "鐢ㄦ埛鐣欒█",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
  • @@ -61,7 +61,7 @@
  • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
  • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">鍙戝竷浜嗕綔涓氾細
  • - <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),:class => "newsGrey", :title => "#{ma.course_message.name}" %>
  • + <%= 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}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -81,8 +81,9 @@
  • <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
  • <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>"><%= ma.course_message.parent_id.nil? ? "鍙戝竷浜嗚绋嬪笘瀛愶細" : "璇勮浜嗚绋嬪笘瀛愶細" %>
  • - <%=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, - :topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", + <%= link_to ma.course_message.parent_id.nil? ? ma.course_message.subject.html_safe : ma.course_message.content.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, :topic_id => ma.course_message.id), + :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.subject.html_safe}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -94,7 +95,7 @@
  • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>"><%= ma.status == 0 ? "璇勯槄浜嗕綔鍝侊細" : "閲嶆柊璇勯槄浜嗕綔鍝:" %>
  • <% 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}" %>
  • + <%= 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}" %> <% end %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -104,7 +105,7 @@
  • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
  • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">鍥炲浜嗕綔鍝佽瘎璁猴細
  • - <%= 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}" %>
  • + <%= 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}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -150,7 +151,7 @@
  • <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %> "><%= ma.forge_message.parent_id.nil? ? "鍙戝竷浜嗛」鐩笘瀛愶細" : "璇勮浜嗛」鐩笘瀛愶細" %>
  • - <%=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, :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", :title => "#{ma.forge_message.subject.html_safe}" %>
  • @@ -167,7 +168,7 @@ ">鍙戝竷浜嗘柊闂伙細
  • - <%= 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}" %> + <%= 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}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -196,7 +197,7 @@ " ><%= ma.memo.parent_id.nil? ? "鍦ㄨ创鍚у彂甯冨笘瀛愶細" : "鍥炲浜嗚创鍚у笘瀛愶細" %>
  • - <%= 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}" %> + <%= 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}" %>
  • <%= time_tag(ma.memo.created_at).html_safe %>
  • @@ -214,9 +215,10 @@ "><%= ma.journals_for_message.reply_id == 0 ? "缁欎綘鐣欒█浜嗭細" : "鍥炲浜嗕綘鐨勭暀瑷锛" %>
  • - <%= 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}" %> + <%= 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}" %>
  • <%= time_tag(ma.journals_for_message.created_on).html_safe %>
  • + <% end %> <% end %> @@ -244,4 +246,3 @@ - diff --git a/db/migrate/20150831070611_about_memo_message.rb b/db/migrate/20150831070611_about_memo_message.rb new file mode 100644 index 000000000..fde94d2f9 --- /dev/null +++ b/db/migrate/20150831070611_about_memo_message.rb @@ -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 diff --git a/db/migrate/20150831093918_about_user_feedback_message.rb b/db/migrate/20150831093918_about_user_feedback_message.rb new file mode 100644 index 000000000..d021bc3ad --- /dev/null +++ b/db/migrate/20150831093918_about_user_feedback_message.rb @@ -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 # 娣诲姞鎴戝洖澶嶇殑閭d釜浜 + 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 diff --git a/db/migrate/20150901004812_update_memo_message_time.rb b/db/migrate/20150901004812_update_memo_message_time.rb new file mode 100644 index 000000000..e512282a0 --- /dev/null +++ b/db/migrate/20150901004812_update_memo_message_time.rb @@ -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 diff --git a/db/migrate/20150901004910_update_userfeeback_message_time.rb b/db/migrate/20150901004910_update_userfeeback_message_time.rb new file mode 100644 index 000000000..686bc496e --- /dev/null +++ b/db/migrate/20150901004910_update_userfeeback_message_time.rb @@ -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 diff --git a/public/javascripts/project.js b/public/javascripts/project.js index feb6b249d..7e9643bc7 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -248,6 +248,13 @@ function regexDescription() { $("#description_notice_span").focus(); 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 { $("#description_notice_span").text("濉啓姝g‘"); $("#description_notice_span").css('color', '#008000'); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 8f62820a5..0a6ed8d79 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -525,6 +525,7 @@ a.replyGrey1 {color:#888888;} a.replyGrey1:hover {color:#4b4b4b;} a.newsBlue {color:#269ac9;} a.newsBlue:hover {color:#297fb8;} +a.newsBlack {color:#000000; font-size:13px; font-weight:bold} a.menuGrey {color:#808080;} 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;} @@ -905,7 +906,7 @@ img.ui-datepicker-trigger { 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_div{border: 1px solid #d9d9d9;} /*缂洪櫡鏇存柊鍔ㄦ佸湪娑堟伅涓樉绀烘牱寮*/ diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 8d86a6873..a22831b2c 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -507,7 +507,7 @@ img.ui-datepicker-trigger { .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_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_new_box{ display:none;} /*wiki鏄剧ず闄勫姞*/