定义消息标题类型方法

This commit is contained in:
huang 2015-09-11 09:53:18 +08:00
parent cc3990de44
commit 4ea20b707c
2 changed files with 26 additions and 1 deletions

View File

@ -52,6 +52,31 @@ module UsersHelper
end
end
def title_for_message type
case type
when nil
'消息'
when 'unviewed'
'未读消息'
when 'apply'
'用户申请'
when 'system_message'
'系统消息'
when 'homework'
'作业消息'
when 'course_message'
'课程讨论'
when 'course_news'
'课程通知'
when 'issue'
'项目任务'
when 'forum'
'贴吧帖子'
when 'user_feedback'
'用户留言'
end
end
# 统计未读消息数
def unviewed_message(user)
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count

View File

@ -1,5 +1,5 @@
<div class="homepageRightBanner">
<div class="NewsBannerName">消息</div>
<div class="NewsBannerName"><%= title_for_message(params[:type]) %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="newsType">