Merge branch 'cxt_course' of https://git.trustie.net/jacknudt/trustieforge into cxt_course

This commit is contained in:
Tim 2016-05-20 15:15:56 +08:00
commit c3f63709ed
5 changed files with 23 additions and 12 deletions

View File

@ -3238,6 +3238,7 @@ def strip_html(text,len=0,endss="...")
ss = ""
if text.length>0
ss=text.gsub(/<\/?.*?>/, '').strip
ss = ss.gsub(/&nbsp;/, ' ')
if len > 0 && ss.length > len
ss = ss[0, len] + endss

View File

@ -239,8 +239,10 @@ class Journal < ActiveRecord::Base
#缺陷回复微信模板消息
def issue_wechat_message
ws = WechatService.new
content = strip_html self.notes.html_safe, 200
ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
if !self.notes.nil? && self.notes.gsub(' ','') != ''
ws = WechatService.new
content = strip_html self.notes.html_safe, 200
ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
end
end

View File

@ -259,19 +259,26 @@ class JournalsForMessage < ActiveRecord::Base
if self.m_parent_id.nil?
if self.user_id != self.jour.user_id
self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if count == 0
ws = WechatService.new
#content = truncate(strip_tags(self.notes.to_s), length: 200)
content = strip_html self.notes.html_safe, 200
ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
end
else
if self.user_id != self.parent.user_id
self.course_messages << CourseMessage.new(:user_id => self.parent.user_id,:course_id => self.jour.course.id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.parent.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if count == 0
ws = WechatService.new
#content = truncate(strip_tags(self.notes.to_s), length: 200)
content = strip_html self.notes.html_safe, 200
ws.comment_template self.parent.user_id, "homework", self.jour_id, "#{l(:label_new_second_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
end
end
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if count == 0
ws = WechatService.new
#content = truncate(strip_tags(self.notes.to_s), length: 200)
content = strip_html self.notes.html_safe, 200
ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content
end
end
end

View File

@ -395,9 +395,9 @@
<li class="homepageNewsPubType fl"><%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<% if ma.course_message.m_parent_id.nil? %>
回复了您的作业:
回复了您的<span class="fontBlue2" title="作业:<%=ma.course_message.jour.name %>">作业</span>
<% else %>
回复了您:
在<span class="fontBlue2" title="作业:<%=ma.course_message.jour.name %>">作业</span>中回复了您:
<% end %>
</span>
</li>

View File

@ -2137,6 +2137,7 @@ zh:
label_notice_comment_template: 您的课程通知有新回复了
label_news_comment_template: 您的项目新闻有新回复了
label_homework_comment_template: 您的作业有新回复了
label_new_second_comment_template: 您有新回复了
label_new_journals_template: 您有新留言了
label_journals_comment_template: 您的留言有新回复了
label_blog_comment_template: 您的博客有新回复了