新消息提醒。表情插入

This commit is contained in:
huang 2015-08-21 09:41:59 +08:00
parent 893c1c753f
commit ef45e41a40
2 changed files with 189 additions and 198 deletions

View File

@ -256,7 +256,11 @@ class User < Principal
# 新消息统计
def count_new_message
count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count
course_count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count
forge_count = ForgeMessage.where("user_id =? and viewed =?", User.current.id, 0).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", User.current.id, 0).count
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

View File

@ -32,219 +32,206 @@
</div>
<div>
<% if @new_message_count >0 %>
<%# 课程消息 %>
<% unless @user_course_messages.nil? %>
<% @user_course_messages.each do |ucm| %>
<% if ucm.course_message_type == "News" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ucm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ucm.course_message.author %></a></li>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布通知</li>
<li class="homepageNewsContent fl">
<%= link_to "#{ucm.course_message.title}", {:controller => 'news', :action => 'show', :id => ucm.course_message.id },:class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Comment" %>
<% if @new_message_count >0 %>
<%# 课程消息 %>
<% unless @user_course_messages.nil? %>
<% @user_course_messages.each do |ucm| %>
<% if ucm.course_message_type == "News" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ucm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ucm.course_message.author %></a></li>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布通知</li>
<li class="homepageNewsContent fl">
<%= link_to "#{ucm.course_message.title.html_safe}", {:controller => 'news', :action => 'show', :id => ucm.course_message.id },:class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Comment" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复了通知</li>
<li class="homepageNewsContent fl">
<%= link_to "#{ucm.course_message.comments}", {:controller => 'news', :action => 'show', :id => ucm.course_message.commented.id },:class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></li>
<%= link_to "#{ucm.course_message.comments.html_safe}", {:controller => 'news', :action => 'show', :id => ucm.course_message.commented.id },:class =>"#{ucm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "HomeworkCommon" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">发布作业</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id),:class => "newsGrey" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Poll" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ucm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ucm.course_message.user %></a></li>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布问卷</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ucm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ucm.course_message.author %></a></li>
<% if ucm.course_message.parent_id.nil? %>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
<% else %>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %> </a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
<% end %>
</ul>
<% end %>
<% if ucm.course_message_type == "StudentWorksScore" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">评阅了作品</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ucm.course_message.comment, student_work_index_path(:homework => ucm.course_message.student_work.homework_common_id),:class=>"newsGrey" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "JournalsForMessage" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">回复了作品</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ucm.course_message.notes, student_work_index_path(:homework => ucm.course_message.jour.student_work.homework_common_id),:class=>"newsGrey" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul>
<% end %>
<div class="cl"></div>
<% end %>
<% end %>
<!--项目消息-->
<% unless @user_forge_messages.nil? %>
<% @user_forge_messages.each do |ufm| %>
<% if ufm.forge_message_type == "Issue" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.author %></a>
</li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">指派问题给我</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.subject}"), issue_path(:id => ufm.forge_message.id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ufm.forge_message_type == "Journal" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.user), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.user %></a>
</li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<%= ufm.forge_message.notes.empty? ? "更新了问题状态" : "在问题中留言了" %></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.notes.empty? ? ufm.forge_message.issue.subject : ufm.forge_message.notes }"), issue_path(:id => ufm.forge_message.journalized_id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ufm.forge_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ufm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ufm.forge_message.author %></a></li>
<% if ufm.forge_message.parent_id.nil? %>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ufm.forge_message.subject, project_boards_path(ufm.forge_message.project,:parent_id => ufm.forge_message.parent_id ? ufm.forge_message.parent_id : ufm.forge_message.id, :topic_id => ufm.forge_message.id),:class=>"#{ufm.viewed==0?"newsBlack":"newsGrey"}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
<% else %>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ufm.forge_message.subject, project_boards_path(ufm.forge_message.project,:parent_id => ufm.forge_message.parent_id ? ufm.forge_message.parent_id : ufm.forge_message.id, :topic_id => ufm.forge_message.id),:class=>"#{ufm.viewed==0?"newsBlack":"newsGrey"}" %> </a></li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
<% end %>
</ul>
<% end %>
<% if ufm.forge_message_type == "News" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="newsBlue"><%= ufm.forge_message.author %></a>
</li>
<li class="homepageNewsType fl">发布新闻</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.title}"), {:controller => 'news', :action => 'show', :id => ufm.forge_message.id}, :class => "newsGrey" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% if ucm.course_message_type == "HomeworkCommon" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">发布作业</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id),:class => "newsGrey" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Poll" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ucm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ucm.course_message.user %></a></li>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布问卷</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ucm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ucm.course_message.author %></a></li>
<% if ucm.course_message.parent_id.nil? %>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ucm.course_message.subject.html_safe, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
<% else %>
<li class="<%= ucm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ucm.course_message.subject.html_safe, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id),:class=>"#{ucm.viewed==0?"newsBlack":"newsGrey"}" %> </a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
<% end %>
</ul>
<% end %>
<% if ucm.course_message_type == "StudentWorksScore" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">评阅了作品</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ucm.course_message.comment.html_safe, student_work_index_path(:homework => ucm.course_message.student_work.homework_common_id),:class=>"newsGrey" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "JournalsForMessage" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">回复了作品</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ucm.course_message.notes.html_safe, student_work_index_path(:homework => ucm.course_message.jour.student_work.homework_common_id),:class=>"newsGrey" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul>
<% end %>
<div class="cl"></div>
<% end %>
<% end %>
<!--项目消息-->
<% unless @user_forge_messages.nil? %>
<% @user_forge_messages.each do |ufm| %>
<% if ufm.forge_message_type == "Issue" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.author %></a>
</li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">指派问题给我</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.subject.html_safe}"), issue_path(:id => ufm.forge_message.id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ufm.forge_message_type == "Journal" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.user), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.user %></a>
</li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<%= ufm.forge_message.notes.empty? ? "更新了问题状态" : "在问题中留言了" %></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.notes.empty? ? ufm.forge_message.issue.subject.html_safe : ufm.forge_message.notes.html_safe }"), issue_path(:id => ufm.forge_message.journalized_id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ufm.forge_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="<%=ufm.viewed == 0?"newsBlack":"newsBlue"%>"><%= ufm.forge_message.author %></a></li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ufm.forge_message.parent_id.nil? ? "发布帖子" : "回复帖子" %></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ufm.forge_message.subject.html_safe, project_boards_path(ufm.forge_message.project,:parent_id => ufm.forge_message.parent_id ? ufm.forge_message.parent_id : ufm.forge_message.id, :topic_id => ufm.forge_message.id),:class=>"#{ufm.viewed==0?"newsBlack":"newsGrey"}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ufm.forge_message_type == "News" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="newsBlue"><%= ufm.forge_message.author %></a>
</li>
<li class="homepageNewsType fl">发布新闻</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ufm.forge_message.id}, :class => "newsGrey" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ufm.forge_message_type == "Comment" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ufm.forge_message.author %></a></li>
<li class="homepageNewsType fl">回复了新闻</li>
<li class="homepageNewsContent fl">
<%= link_to "#{ufm.forge_message.comments}", {:controller => 'news', :action => 'show', :id => ufm.forge_message.commented.id },:class =>"#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></li>
<%= link_to "#{ufm.forge_message.comments.html_safe}", {:controller => 'news', :action => 'show', :id => ufm.forge_message.commented.id },:class =>"#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% end %>
<%# 公共贴吧 %>
<% unless @user_memo_messages.nil? %>
<% @user_memo_messages.each do |urm| %>
<% if urm.memo_type == "Memo" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(urm.memo.author), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="newsBlue"><%= urm.memo.author %></a>
</li>
<li class="homepageNewsType fl" >回复了贴吧帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to urm.memo.content, forum_memo_path(urm.memo.forum_id, urm.memo.parent_id ? urm.memo.parent_id: urm.memo.id),:class => "newsGrey" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(urm.memo.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% end %>
<%# 用户留言消息 %>
<% unless @user_feedback_messages.nil? %>
<% @user_feedback_messages.each do |ufm| %>
<% if ufm.journals_for_message_type == "Principal" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.journals_for_message.user), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="newsBlue"><%= ufm.journals_for_message.user %></a>
</li>
<% if ufm.journals_for_message.reply_id == 0 %>
<li class="homepageNewsType fl">给你留言了</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ufm.journals_for_message.notes, feedback_path(ufm.journals_for_message.jour_id), :class => "newsGrey" %></a>
</li>
<% else %>
<li class="homepageNewsType fl">回复了你的留言</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ufm.journals_for_message.notes, feedback_path(ufm.journals_for_message.parent.user_id),:class => "newsGrey" %></a>
</li>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ufm.journals_for_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% end %>
<% else %>
<div class="flash notice">暂无消息!</div>
<% end %>
<% end %>
<% end %>
<%# 公共贴吧 %>
<% unless @user_memo_messages.nil? %>
<% @user_memo_messages.each do |urm| %>
<% if urm.memo_type == "Memo" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(urm.memo.author), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="newsBlue"><%= urm.memo.author %></a>
</li>
<li class="homepageNewsType fl" >回复了贴吧帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to urm.memo.content.html_safe, forum_memo_path(urm.memo.forum_id, urm.memo.parent_id ? urm.memo.parent_id: urm.memo.id),:class => "newsGrey" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(urm.memo.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% end %>
<%# 用户留言消息 %>
<% unless @user_feedback_messages.nil? %>
<% @user_feedback_messages.each do |ufm| %>
<% if ufm.journals_for_message_type == "Principal" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.journals_for_message.user), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="newsBlue"><%= ufm.journals_for_message.user %></a>
</li>
<li class="homepageNewsType fl"><%= ufm.journals_for_message.reply_id == 0 ? "给你留言了" : "回复了你的留言" %></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ufm.journals_for_message.notes.html_safe, feedback_path(ufm.journals_for_message.jour_id), :class => "newsGrey" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.journals_for_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% end %>
<% else %>
<div class="flash notice">暂无消息!</div>
<% end %>
</div>
</div>
</div>