Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
c2924e06e6
|
@ -33,12 +33,18 @@ class HomeworkCommonController < ApplicationController
|
||||||
|
|
||||||
@homeworks = paginateHelper @homework_commons,10
|
@homeworks = paginateHelper @homework_commons,10
|
||||||
#设置at已读
|
#设置at已读
|
||||||
@homeworks.each do |homework|
|
ids = @homeworks.inject([]) do |ids, homework|
|
||||||
# homework.journals_for_messages.each do |j|
|
jids = homework.journals_for_messages.map(&:id)
|
||||||
# User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
|
jids ? ids + jids : ids
|
||||||
# end
|
|
||||||
homework.delay.set_jour_viewed
|
# homework.delay.set_jour_viewed
|
||||||
end
|
end
|
||||||
|
unless ids.empty?
|
||||||
|
User.current.at_messages.where(viewed: false,
|
||||||
|
at_message_type: 'JournalsForMessage',
|
||||||
|
at_message_id: ids).update_all(viewed: true)
|
||||||
|
end
|
||||||
|
|
||||||
@left_nav_type = 3
|
@left_nav_type = 3
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -328,17 +328,28 @@ class Message < ActiveRecord::Base
|
||||||
def delay_message_send
|
def delay_message_send
|
||||||
if self.course
|
if self.course
|
||||||
if self.parent_id.nil? # 发帖
|
if self.parent_id.nil? # 发帖
|
||||||
self.delay.contain_messages_message
|
dm = []
|
||||||
|
self.course.members.includes(:user).each do |m|
|
||||||
|
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
||||||
|
dm << {course_message_type:'Message',course_message_id:self.id, :user_id => m.user_id,
|
||||||
|
:course_id => self.board.course_id, :viewed => false}
|
||||||
|
if dm.size >= 30
|
||||||
|
self.delay.contain_messages_message(dm)
|
||||||
|
dm.clear
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless dm.empty?
|
||||||
|
self.delay.contain_messages_message(dm)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def contain_messages_message
|
def contain_messages_message vs
|
||||||
self.course.members.includes(:user).each do |m|
|
CourseMessage.create(vs)
|
||||||
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
|
||||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#更新用户分数 -by zjc
|
#更新用户分数 -by zjc
|
||||||
|
|
|
@ -208,16 +208,29 @@ class News < ActiveRecord::Base
|
||||||
|
|
||||||
def delay_news_send
|
def delay_news_send
|
||||||
if self.course
|
if self.course
|
||||||
self.delay.contain_news_message
|
|
||||||
|
vs = []
|
||||||
|
self.course.members.each do | m|
|
||||||
|
if m.user_id != self.author_id
|
||||||
|
vs << {course_message_type:'News',course_message_id:self.id, :user_id => m.user_id,
|
||||||
|
:course_id => self.course_id, :viewed => false}
|
||||||
|
|
||||||
|
if vs.size >= 30
|
||||||
|
self.delay.contain_news_message(vs)
|
||||||
|
vs.clear
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless vs.empty?
|
||||||
|
self.delay.contain_news_message(vs)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def contain_news_message
|
def contain_news_message(vs)
|
||||||
self.course.members.each do |m|
|
CourseMessage.create(vs)
|
||||||
if m.user_id != self.author_id
|
|
||||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Time 2015-03-31 13:50:54
|
# Time 2015-03-31 13:50:54
|
||||||
|
|
|
@ -167,7 +167,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li class="home-user-leftnav-li icons-class clear">
|
<li class="home-user-leftnav-li icons-class clear">
|
||||||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_course_count}</span>".html_safe : "课程",
|
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_course_count}</span>".html_safe : "课程",
|
||||||
{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list", :target => "_blank" %>
|
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
|
||||||
<!-- <div class="user_navmore_box" >
|
<!-- <div class="user_navmore_box" >
|
||||||
<ul>
|
<ul>
|
||||||
<li class="user_navmore_icons">
|
<li class="user_navmore_icons">
|
||||||
|
@ -208,7 +208,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li class="home-user-leftnav-li icons-project clear">
|
<li class="home-user-leftnav-li icons-project clear">
|
||||||
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_project_count}</span>".html_safe : "项目",
|
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_project_count}</span>".html_safe : "项目",
|
||||||
{:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :target => "_blank" %>
|
user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %>
|
||||||
<!-- <div class="user_navmore_box" >
|
<!-- <div class="user_navmore_box" >
|
||||||
<ul>
|
<ul>
|
||||||
<li class="user_navmore_icons">
|
<li class="user_navmore_icons">
|
||||||
|
@ -246,11 +246,11 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li class="home-user-leftnav-li icons-class clear">
|
<li class="home-user-leftnav-li icons-class clear">
|
||||||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
|
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
|
||||||
{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list", :class => "fl", :target => "_blank" %>
|
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
|
||||||
</li>
|
</li>
|
||||||
<li class="home-user-leftnav-li icons-project clear">
|
<li class="home-user-leftnav-li icons-project clear">
|
||||||
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140'>#{user_project_count}</span>".html_safe : "项目",
|
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140'>#{user_project_count}</span>".html_safe : "项目",
|
||||||
{:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "fl", :target => "_blank" %>
|
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
hideModal();
|
hideModal();
|
||||||
<% if params[:status].to_i == 3 %>
|
<% if params[:status].to_i == 3 %>
|
||||||
|
var num = $("#work_num_<%= @work.id%>").html();
|
||||||
<% score_open = @is_teacher || @homework.score_open == 1 || @work.user == User.current %>
|
<% score_open = @is_teacher || @homework.score_open == 1 || @work.user == User.current %>
|
||||||
<% if @is_teacher %>
|
<% if @is_teacher %>
|
||||||
<% if @homework.homework_type == 3 %>
|
<% if @homework.homework_type == 3 %>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="c_grey">
|
<li class="c_grey">
|
||||||
<% if !activity.assigned_to_id.nil? && activity.assigned_to_id != 0 %>
|
<% if !activity.assigned_to_id.nil? && activity.assigned_to_id != 0 %>
|
||||||
<% if activity.try(:assigned_to).try(:realname).empty? %>
|
<% if activity.try(:assigned_to).try(:realname).blank? %>
|
||||||
<%= link_to activity.assigned_to, user_path(activity.assigned_to_id)%>
|
<%= link_to activity.assigned_to, user_path(activity.assigned_to_id)%>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id)%>
|
<%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id)%>
|
||||||
|
|
|
@ -213,7 +213,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if ma.forge_message_type == "PullRequest" %>
|
<% if ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0 %>
|
||||||
<ul class="homepageNewsList fl">
|
<ul class="homepageNewsList fl">
|
||||||
<div class="longMessageWidth">
|
<div class="longMessageWidth">
|
||||||
<li class="homepageNewsPortrait fl">
|
<li class="homepageNewsPortrait fl">
|
||||||
|
|
Loading…
Reference in New Issue