Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq
This commit is contained in:
commit
22e2510482
|
@ -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
|
||||
|
|
|
@ -269,7 +269,8 @@ class User < Principal
|
|||
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
|
||||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
|
||||
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count
|
||||
system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
<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">
|
||||
<li><%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %></li>
|
||||
<%# 系统消息 %>
|
||||
<li><%= link_to "系统消息", user_message_path(User.current, :type => 'system_message'), :class => "resourcesGrey" %></li>
|
||||
<%# 课程相关消息 %>
|
||||
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
|
||||
|
@ -26,6 +24,8 @@
|
|||
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>
|
||||
<%# 系统贴吧 %>
|
||||
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
|
||||
<%# 系统消息 %>
|
||||
<li><%= link_to "系统消息", user_message_path(User.current, :type => 'system_message'), :class => "resourcesGrey" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -108,6 +108,23 @@
|
|||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
||||
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
|
||||
<% if ma.viewed == 0 %>
|
||||
<li class="homepageHomeworkContent fl">
|
||||
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %>
|
||||
</li>
|
||||
<li class="homepageHomeworkContentWarn fl"> 截止时间快到了!</li>
|
||||
<% else %>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if ma.course_message_type == "Poll" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
||||
|
|
|
@ -4,11 +4,13 @@ namespace :homework_endtime do
|
|||
desc "send a message for Job deadline"
|
||||
task :message => :environment do
|
||||
current_day = Date.today.day
|
||||
homework_commons = HomeworkCommon.where("end_time >?",Date.today)
|
||||
homework_commons = HomeworkCommon.where("end_time >=?",Date.today)
|
||||
homework_commons.each do |homework_common|
|
||||
if homework_common.end_time.day - Date.today.day < 2 && homework_common.end_time.year == Date.today.year
|
||||
homework_common.course.student.each do |s|
|
||||
homework_common.course_messages << CourseMessage.new(:user_id => s.student_id, :course_id => homework_common.course_id, :viewed => false, :status => true)
|
||||
if CourseMessage.where("course_message_type =? and course_message_id =? and status =?", "HomeworkCommon", homework_common.id, 1).first.nil?
|
||||
if homework_common.end_time.day - Date.today.day < 2 && homework_common.end_time.year == Date.today.year
|
||||
homework_common.course.student.each do |s|
|
||||
homework_common.course_messages << CourseMessage.new(:user_id => s.student_id, :course_id => homework_common.course_id, :viewed => false, :status => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -514,6 +514,9 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;}
|
|||
.homepageNewsType {width:110px; padding-left: 5px; font-size:12px; color:#888888; display:block;}
|
||||
.homepageNewsPubType {width:220px; font-size:12px; color:#888888; display: block;}
|
||||
.homepageNewsContent {width:365px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
.homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
.homepageHomeworkContent {width:245px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
|
||||
.homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;}
|
||||
a.homepageWhite {color:#ffffff;}
|
||||
a.homepageWhite:hover {color:#a1ebff}
|
||||
|
|
Loading…
Reference in New Issue