鼠标经过消息通知时弹窗显示最新的5条未读消息
This commit is contained in:
parent
a1e49d9a81
commit
24f5e245df
|
@ -49,6 +49,11 @@ class ExerciseController < ApplicationController
|
|||
return
|
||||
end
|
||||
@exercise = Exercise.find params[:id]
|
||||
@exercise.course_messages.each do |message|
|
||||
if User.current.id == message.user_id && message.viewed == 0
|
||||
message.update_attributes(:viewed => true) if message.viewed == 0
|
||||
end
|
||||
end
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
exercise_end = @exercise.end_time > Time.now
|
||||
if @exercise.time == -1
|
||||
|
|
|
@ -84,9 +84,9 @@
|
|||
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div>
|
||||
<% end %>
|
||||
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
|
||||
<!--<div class="shadowbox_news undis" id="user_messages_list">
|
||||
<%#=render :partial => 'layouts/message_loading' %>
|
||||
</div>-->
|
||||
<div class="shadowbox_news undis" id="user_messages_list">
|
||||
<%=render :partial => 'layouts/message_loading' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -98,15 +98,15 @@
|
|||
$("#navHomepageSearchType").hide();
|
||||
});
|
||||
|
||||
/*$("#user_messages").mouseenter(function(){
|
||||
$("#user_messages").mouseenter(function(){
|
||||
$("#user_messages_list").show();
|
||||
$.get('<%#=user_messages_unviewed_users_path %>');
|
||||
$.get('<%=user_messages_unviewed_users_path %>');
|
||||
$("#ajax-indicator").hide();
|
||||
}).mouseleave(function(){
|
||||
$("#user_messages_list").hide();
|
||||
$("#user_messages_list").html("<%#=escape_javascript(render :partial => 'layouts/message_loading') %>");
|
||||
$("#user_messages_list").html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
|
||||
|
||||
});*/
|
||||
});
|
||||
|
||||
$("#navHomepageProfile").mouseenter(function(){
|
||||
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<font></font>
|
||||
<h4 class="shadowbox_news_title">未读消息</h4>
|
||||
<ul class="shadowbox_news_list">
|
||||
<%# user_messages = User.current.user_messages_unviewed %>
|
||||
<% messages.each do |ma| %>
|
||||
<% if ma.class == SystemMessage %>
|
||||
<li><a href="<%=user_system_messages_path(User.current) %>" target="_blank" title="Trustie平台 发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%>"><span class="shadowbox_news_user">Trustie平台 </span>发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%></a></li>
|
||||
|
@ -60,15 +59,77 @@
|
|||
<% else %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= ma.course_message.notes%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> </span>回复了作品评论:<%= ma.course_message.notes%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id) %>" target="_blank" title="<%=ma.course_message.homework_common.user.show_name %>老师 发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评"><span class="shadowbox_news_user"><%=ma.course_message.homework_common.user.show_name %>老师 </span>发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评</a></li>
|
||||
<% elsif ma.course_message_type == "StudentWork" && ma.status == 1 %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id, :show_work_id => ma.course_message_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>同学 重新提交了作品:<%=ma.course_message.name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>同学 </span>重新提交了作品:<%=ma.course_message.name %></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWork" && ma.status == 2 %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id, :show_work_id => ma.course_message_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>同学 追加新附件了:作业标题:<%=ma.course_message.homework_common.name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>同学 </span>追加新附件了:作业标题:<%=ma.course_message.homework_common.name %></a></li>
|
||||
<% elsif ma.course_message_type == "Course" %>
|
||||
<li><a href="<%=course_path(ma.course_message) %>" target="_blank" title="系统提示 您成功创建了课程:课程名称:<%=ma.course_message.name %>"><span class="shadowbox_news_user">系统提示 </span>您成功创建了课程:课程名称:<%=ma.course_message.name %></a></li>
|
||||
<% elsif ma.course_message_type == "JoinCourseRequest" %>
|
||||
<% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}" %>
|
||||
<li><a href="<%=user_path(User.find(ma.course_message_id), :course_id => ma.course_id) %>" target="_blank" title="系统提示 您有了新的课程成员申请:<%=content %>"><span class="shadowbox_news_user">系统提示 </span>您有了新的课程成员申请:<%=content %></a></li>
|
||||
<% elsif ma.course_message_type == "CourseRequestDealResult" %>
|
||||
<% content = ma.status == 1 ? '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过' : '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝' %>
|
||||
<li><a href="<%=course_path(Course.find(ma.course_id)) %>" target="_blank" title="系统提示 课程申请进度反馈:<%=content %>"><span class="shadowbox_news_user">系统提示 </span>课程申请进度反馈:<%=content %></a></li>
|
||||
<% elsif ma.course_message_type == "JoinCourse" and ma.status == 0 %>
|
||||
<li><a href="<%=course_member_path(ma.course) %>" target="_blank" title="<%=User.find(ma.course_message_id).show_name %> 将您加入了课程:<%=ma.course.name %>"><span class="shadowbox_news_user"><%=User.find(ma.course_message_id).show_name %> </span>将您加入了课程:<%=ma.course.name %></a></li>
|
||||
<% elsif ma.course_message_type == "JoinCourse" and ma.status == 1 %>
|
||||
<li><a href="<%=user_path(ma.course_message_id) %>" target="_blank" title="系统提示 您增加了新的课程成员:<%=User.find(ma.course_message_id).login+"("+User.find(ma.course_message_id).show_name+")" %>"><span class="shadowbox_news_user">系统提示 </span>您增加了新的课程成员:<%=User.find(ma.course_message_id).login+"("+User.find(ma.course_message_id).show_name+")" %></a></li>
|
||||
<% elsif ma.course_message_type == "RemoveFromCourse" %>
|
||||
<li><a href="<%=member_course_path(ma.course) %>" target="_blank" title="<%=User.find(ma.course_message_id).show_name %> 将您移出了课程:<%=ma.course.name %>"><span class="shadowbox_news_user"><%=User.find(ma.course_message_id).show_name %> </span>将您移出了课程:<%=ma.course.name %></a></li>
|
||||
<% elsif ma.course_message_type == "Exercise" && ma.status == 2 %>
|
||||
<li><a href="<%=exercise_path(:id => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布了课程测验:测验题目:<%=ma.course_message.exercise_name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布了课程测验:测验题目:<%=ma.course_message.exercise_name %></a></li>
|
||||
<% elsif ma.course_message_type == "Exercise" && ma.status == 3 %>
|
||||
<li><a href="<%=exercise_path(:id => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布的测验:<%=ma.course_message.exercise_name %> 截止时间快到了"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布的测验:<%=ma.course_message.exercise_name %> 截止时间快到了</a></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif ma.class == ForgeMessage %>
|
||||
<% if ma.forge_message_type == "AppliedProject" %>
|
||||
<li><a href="<%=settings_project_path(:id => ma.project, :tab => "members") %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 申请加入项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>申请加入项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "JoinProject" %>
|
||||
<li><a href="<%=project_member_path(ma.project) %>" target="_blank" title="<%=User.find(ma.forge_message_id).show_name %> 将您加入了项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=User.find(ma.forge_message_id).show_name %> </span>将您加入了项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "RemoveFromProject" %>
|
||||
<li><a href="<%=member_project_path(ma.project) %>" target="_blank" title="<%=User.find(ma.forge_message_id).show_name %> 将您移出了项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=User.find(ma.forge_message_id).show_name %> </span>将您移出了项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "RemoveFromProject" %>
|
||||
<li><a href="<%=project_path(ma.project) %>" target="_blank" title="<%=User.find(ma.forge_message_id).show_name %> 邀请你加入项目:<%= ma.project.name%>"><span class="shadowbox_news_user"><%=User.find(ma.forge_message_id).show_name %> </span>邀请你加入项目:<%= ma.project.name%></a></li>
|
||||
<% elsif ma.forge_message_type == "Issue" && ma.status == 1 %>
|
||||
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!</a></li>
|
||||
<% elsif ma.forge_message_type == "Issue" && ma.status != 1 %>
|
||||
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%></a></li>
|
||||
<% elsif ma.forge_message_type == "Journal" %>
|
||||
<li><a href="<%=issue_path(:id => ma.forge_message.journalized_id) %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>更新了问题状态:<%= ma.forge_message.journalized.subject%></a></li>
|
||||
<% elsif ma.forge_message_type == "Message" %>
|
||||
<li><a href="<%=project_boards_path(ma.forge_message.project,:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,:topic_id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%></a></li>
|
||||
<% elsif ma.forge_message_type == "News" %>
|
||||
<li><a href="<%=news_path(ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>发布了新闻:<%= ma.forge_message.title.html_safe%></a></li>
|
||||
<% elsif ma.forge_message_type == "Comment" %>
|
||||
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == MemoMessage %>
|
||||
<% if ma.memo_type == "Memo" %>
|
||||
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == UserFeedbackMessage %>
|
||||
<% if ma.journals_for_message_type == "JournalsForMessage" %>
|
||||
<li><a href="<%=feedback_path(ma.journals_for_message.jour_id) %>" target="_blank" title="<%=ma.journals_for_message.user.show_name %> <%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe%>"><span class="shadowbox_news_user"><%=ma.journals_for_message.user.show_name %> </span><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == OrgMessage %>
|
||||
<% if ma.message_type == 'ApplySubdomain' %>
|
||||
<li><a href="<%=feedback_path(ma.journals_for_message.jour_id) %>" target="_blank" title="<%=ma.organization.name %> 申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>"><span class="shadowbox_news_user"><%=ma.organization.name %> </span>申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%></a></li>
|
||||
<% elsif ma.message_type == 'AgreeApplySubdomain' %>
|
||||
<li><a href="javascript:void(0)" target="_blank" title="系统提示 管理员同意了您的子域名申请:<%= ma.content%>"><span class="shadowbox_news_user">系统提示 </span>管理员同意了您的子域名申请:<%= ma.content%></a></li>
|
||||
<% end %>
|
||||
<% elsif AtMessage === ma && ma.at_valid? %>
|
||||
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
|
||||
<% href = course_boards_path(ma.at_message.course,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
|
||||
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
|
||||
<% href = project_boards_path(ma.at_message.project,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
|
||||
<% else %>
|
||||
<% href = ma.url %>
|
||||
<% end %>
|
||||
<li><a href="<%=href %>" target="_blank" title="<%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>"><span class="shadowbox_news_user"><%=ma.author.show_name %> </span>提到了你:<%= ma.subject.html_safe%></a></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--<li><span class="shadowbox_news_user">教辅测试老师</span><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试辅测试老辅测试老老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank"><span class="c_red">【课程通知】</span>发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
<li><a href="#" target="_blank" class="shadowbox_news_user">教辅测试老师</a><a href="#" target="_blank">发布的作业:作业标题:0525发布布的作业:作业标题:0525发布布的作业:作业标题:0525发布普...</a></li>
|
||||
-->
|
||||
</ul>
|
||||
<%= link_to '查看全部', user_message_path(User.current), :class => "shadowbox_news_all", :target =>"_Blank" %>
|
Loading…
Reference in New Issue