Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

This commit is contained in:
huang 2015-09-16 17:25:43 +08:00
commit d602e62119
4 changed files with 81 additions and 14 deletions

View File

@ -627,6 +627,11 @@ class CoursesController < ApplicationController
end
def feedback
@course.journals_for_messages.each do |messages|
query = messages.course_messages.where("user_id = ?", User.current.id)
query.update_all(:viewed => true);
end
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
page = params[:page]
# Find the page of the requested reply

View File

@ -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
# 用户留言消息通知

View File

@ -1,8 +1,8 @@
<h3><%=h @issue.tracker %> #<%= @issue.id %></h3>
<p>由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %></p>
<div class="text-diff">
<%= simple_format_without_paragraph @diff.to_html %>
<div class="text-diff" style="word-break:break-all; word-wrap:break-word;">
<%= @diff.to_html.gsub("&lt;","<").gsub("&gt;",">").gsub("&quot;","\"").gsub("&amp;gt;", ">").gsub("&amp;lt;", "<").gsub("&amp;quot;", "\"").html_safe %>
</div>
<p><%= link_to l(:button_back), issue_path(@issue), :onclick => 'history.back(); return false;' %></p>

View File

@ -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>