This commit is contained in:
suntao 2015-08-28 14:51:16 +08:00
commit e12bef1126
9 changed files with 40 additions and 33 deletions

View File

@ -170,6 +170,7 @@ class UsersController < ApplicationController
render_404
return
end
@message_alls = paginateHelper @message_alls,25
respond_to do |format|
format.html{render :layout=>'new_base_user'}
end

View File

@ -380,6 +380,22 @@ module IssuesHelper
value = content_tag("i", h(value)) if value
end
end
# 缺陷更新结果在消息中显示样式
if no_html == "message"
label = content_tag(:span, label, :class => "issue_update_message")
old_value = content_tag("span", h(old_value)) if detail.old_value
old_value = content_tag("del", old_value) if detail.old_value and detail.value.blank?
if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key)
# Link to the attachment if it has not been removed
if options[:token].nil?
value = atta.filename
else
value = atta.filename
end
else
value = content_tag(:span, h(value), :class => "issue_update_message_value") if value
end
end
if detail.property == 'attr' && detail.prop_key == 'description'
s = l(:text_journal_changed_no_detail, :label => label)

View File

@ -425,9 +425,13 @@ module UsersHelper
return str.html_safe
end
# journal.details 记录每个动作的新旧值
def get_issue_des_update(journal)
arr = details_to_strings(journal.details,true)
arr << journal.notes
no_html = "message"
arr = details_to_strings(journal.details, no_html)
unless journal.notes.empty?
arr << "留言内容:" + journal.notes
end
str = ''
arr.each { |item| str = str+item }
return str

View File

@ -174,7 +174,7 @@ class Journal < ActiveRecord::Base
if self.user_id != self.issue.author_id
self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, :project_id => self.issue.project_id, :viewed => false)
end
if self.user_id != self.issue.assigned_to_id # 指派人不是自己的话,则给指派人发送
if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送
self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false)
end
end

View File

@ -212,33 +212,11 @@ class JournalsForMessage < ActiveRecord::Base
if self.user_id != self.reply_id # 添加我回复的那个人
receivers << reply_to
end
if self.user_id != self.parent.jour_id # 给东家发信息
if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发
receivers << self.parent.jour
end
# if self.user_id != self.parent.user_id
# receivers << reply_to
# if self.reply_id != self.parent.user_id
# receivers << self.parent.user
# end
# else
# receivers << reply_to
# end
# 添加留言回复人
#reply_to = User.find(self.reply_id)
#if self.user_id != self.parent.user_id && self.user_id != self.parent.jour_id # 如果回帖人不是用户自己
# receivers << self.parent.user
# if self.reply_id != self.parent.user_id
# receivers << reply_to
# end
#else # 用户自己回复别人的,别人收到消息通知
# if self.user_id != self.reply_id # 过滤掉自己回复自己的
# receivers << reply_to
# end
#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)
end

View File

@ -263,6 +263,7 @@ class User < Principal
user_memo_count = MemoMessage.where("user_id =? and viewed =?", User.current.id, 0).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count
end
# 查询指派给我的缺陷记录
def issue_status_update
self.status_updates

View File

@ -327,6 +327,7 @@
</li>
<% end %>
<div class="cl"></div>
<!--新闻回复-->
<% @project_news_comments.each do |project_news_comment|%>
<li style="clear: both; list-style: none;">

View File

@ -86,14 +86,14 @@
<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="homepageNewsPublisher fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue" %></li>
<% if ma.course_message.parent_id.nil? %>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了帖子</li>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了课程帖子</li>
<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,
:topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
:title => "#{ma.course_message.subject.html_safe}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.course_message.created_on).html_safe %> </li>
<% else %>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复了帖子</li>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了课程帖子</li>
<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,
:topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
@ -153,9 +153,9 @@
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
更新了问题状态
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to get_issue_des_update(ma.forge_message),
<%= link_to get_issue_des_update(ma.forge_message).html_safe,
issue_path(:id => ma.forge_message.journalized_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:title => "#{get_issue_des_update(ma.forge_message)}" %></a>
:title => "#{get_issue_des_update(ma.forge_message).html_safe}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.forge_message.created_on).html_safe %> </li>
</ul>
@ -165,7 +165,7 @@
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %></a></li>
<li class="homepageNewsPublisher fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue" %></li>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了帖子" : "回复了帖子" %></li>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子" : "评论了项目帖子" %></li>
<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,
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
@ -193,7 +193,7 @@
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %></a></li>
<li class="homepageNewsPublisher fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue" %></li>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复了新闻</li>
<li class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了新闻</li>
<li class="homepageNewsContent fl">
<%= link_to "#{ma.forge_message.comments.html_safe}",
{:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.forge_message.comments.html_safe}"%></li>
@ -238,7 +238,11 @@
<% end %>
<% end %>
<% end %>
<ul class="wlist" style=" border:none; padding-top: 15px;">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% end %>
<!--项目消息-->
<% else %>
<div class="flash notice">您目前还没有相关消息!</div>

View File

@ -920,7 +920,9 @@ img.ui-datepicker-trigger {
.homepageNewsTypeNotRead {width:95px; font-size:12px; color:#888888; 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;}
/*缺陷更新动态在消息中显示样式*/
.issue_update_message{padding-left: 2px; margin-right: 3px;}
.issue_update_message_value{margin-right: 8px;}
#attachments_fields input.filename {
border: 0;
height: 1.8em;