Merge branch 'develop' into 'develop'

消息列表代码优化

消息列表代码优化

See merge request !31
This commit is contained in:
黄井泉 2016-12-01 14:43:26 +08:00
commit 97e9da652b
2 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to ma.course_message.author.try(:show_name), user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了通知:</span>
</li>
<li class="homepageNewsContent fl">
@ -275,7 +275,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.show_name,
<%= link_to ma.course_message.user.try(:show_name),
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? 'homepageNewsTypeNotRead fl':'homepageNewsType fl' %>"><%= ma.apply_result == 1 ? '同意' : '拒绝'%>引用作业:</span>
</li>
@ -304,7 +304,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to ma.course_message.user.try(:show_name), user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了问卷:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -327,7 +327,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message.author).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to ma.course_message.author.try(:show_name), user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %></span></li>
<% if ma.course_message.parent_id.nil? %>
@ -423,7 +423,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%= link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%= link_to ma.course_message.user.try(:show_name), user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">在班级中留言了:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -447,7 +447,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%= link_to User.find(ma.course_message.user).show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%= link_to ma.course_message.user.try(:show_name), user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<% if ma.course_message.m_parent_id.nil? %>
回复了您的<span class="fontBlue2" title="作业:<%=ma.course_message.jour.name %>">作业</span>

View File

@ -162,7 +162,7 @@
<% if ma.forge_message_type == "Message" %>
<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), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<li class="homepageNewsPubType fl"><%=link_to ma.forge_message.author.try(:show_name), user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<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">
<%= link_to ma.forge_message.subject, board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
@ -181,7 +181,7 @@
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author),
<%=link_to ma.forge_message.author.try(:show_name), user_path(ma.forge_message.author),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了新闻:</span>
</li>