定义消息标题类型方法
This commit is contained in:
parent
cc3990de44
commit
4ea20b707c
|
@ -52,6 +52,31 @@ module UsersHelper
|
||||||
end
|
end
|
||||||
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)
|
def unviewed_message(user)
|
||||||
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="homepageRightBanner">
|
<div class="homepageRightBanner">
|
||||||
<div class="NewsBannerName">消息</div>
|
<div class="NewsBannerName"><%= title_for_message(params[:type]) %></div>
|
||||||
<ul class="resourcesSelect">
|
<ul class="resourcesSelect">
|
||||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||||
<ul class="newsType">
|
<ul class="newsType">
|
||||||
|
|
Loading…
Reference in New Issue