将课程留言加入消息队列
This commit is contained in:
parent
3edeb81ba5
commit
5155e8794f
|
@ -190,13 +190,20 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 课程作品留言消息通知
|
||||
# 课程留言消息通知
|
||||
def act_as_course_message
|
||||
if self.jour_type == 'StudentWorksScore'
|
||||
if self.user_id != self.jour.user_id
|
||||
self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.student_work.homework_common.course.id, :viewed => false)
|
||||
end
|
||||
end
|
||||
else if jour_type == 'Course'
|
||||
self.jour.members.each do |m|
|
||||
if m.user_id != self.user_id
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.jour.id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 用户留言消息通知
|
||||
|
|
|
@ -170,15 +170,36 @@
|
|||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if ma.course_message_type == "JournalsForMessage" %>
|
||||
<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>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.course_message.notes}" %></a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if ma.course_message_type == "JournalsForMessage" %>
|
||||
<% if ma.course_message.jour_type == 'Course' %>
|
||||
<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>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.notes, course_feedback_path(:id => ma.course_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.notes}" %></a>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
|
||||
<% else %>
|
||||
<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>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.notes}" %></a>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--项目消息-->
|
||||
<% if ma.class == ForgeMessage %>
|
||||
|
@ -340,7 +361,7 @@
|
|||
<% end %>
|
||||
<%# 系统消息 %>
|
||||
<% if ma.class == SystemMessage %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<ul class="homepageNewsList fl" id="list_<%= ma.id %>">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);">
|
||||
<div class="navHomepageLogo fl">
|
||||
|
@ -349,12 +370,29 @@
|
|||
</a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl"><span class="newsBlue homepageNewsPublisher" >Trustie平台</span><span class="homepageNewsType fl">发布新消息:</span></li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<li class="homepageNewsContent fl" id="content_<%= ma.id %>">
|
||||
<%= link_to ma.content.nil? ? ma.description.html_safe : ma.content.html_safe, user_message_path(User.current, :type => "system_messages"),
|
||||
:class => "#{params[:type]=="unviewed" ? "newsBlack" : "newsRed"}",
|
||||
:id => "content_link_#{ma.id}",
|
||||
:onmouseover =>"message_titile_show($(this),event);",
|
||||
:onmouseout => "message_titile_hide($(this));"
|
||||
%>
|
||||
<script>
|
||||
$(function () {
|
||||
function nh_show_btn() {
|
||||
if ($("#system_message_show_<%= ma.id %>").is(':hidden')) {
|
||||
if ($("#content_link_<%= ma.id %>").text().length > 60) {
|
||||
$("#system_message_show_<%= ma.id %>").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
nh_show_btn();
|
||||
});
|
||||
</script>
|
||||
|
||||
<p style="display: none;" id="system_message_show_<%= ma.id%>">
|
||||
<a id="expend_more_information<%= ma.id%>" style="color: #0781b4;" href="javascript:void(0)" onclick="show_more_system_messages('#list_<%= ma.id%>', '#content_<%=ma.id%>','#expend_more_information<%= ma.id%>');" value="show_more">[展开]</a>
|
||||
</p>
|
||||
</li>
|
||||
<div style="display:none;" class="message_title_red system_message_style">
|
||||
<%= ma.content.nil? ? ma.description.html_safe : ma.content.html_safe %>
|
||||
|
@ -386,6 +424,23 @@
|
|||
{
|
||||
obj.parent().next("div").hide();
|
||||
}
|
||||
|
||||
function show_more_system_messages(list,content, id2, id3) {
|
||||
$(list).toggleClass("show_more_li");
|
||||
$(content).toggleClass("show_more_system_message");
|
||||
var information = $(id2);
|
||||
var val = information.attr("value");
|
||||
if (val == "show_more") {
|
||||
$(id2).text("[收起]");
|
||||
information.attr("value", "hide_more");
|
||||
information.attr("style", "color:#3ca5c6");
|
||||
}
|
||||
else {
|
||||
$(id2).text("[展开]");
|
||||
information.attr("value", "show_more");
|
||||
information.attr("style", "color:#0781b4;");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue