缺陷模板消息改为对项目所有人发送、可屏蔽微信模板消息
This commit is contained in:
parent
49a7e2ce1d
commit
0222038899
2
1234567
2
1234567
|
@ -1 +1 @@
|
||||||
{"access_token":"x7GUTe-MLoVPMzId82-3VSdCsO6sq5cOJZCmIN-yUjDcohfI00t2lzPkNKdRhETLUBptZRQ--v-IBQTG-o5iRZZv-EelOBX7K96DcPMFt9rdzwNu7XerNnZw_ncGYncSLHXeACAQMC","expires_in":7200,"got_token_at":1461133885}
|
{"access_token":"nwsA--Idg9Wk4Kyuybly8XuI8MWx-NrJbPTzZX2ynbGaVHBnXZgJ4DHkwlJK6dGfYOmeMNmRj6PSXEzs1GS6vAy0e_7_6S34-S44wtGK83dv6HCUQ8qh3vAw12QUi39fUMDhCIAFXO","expires_in":7200,"got_token_at":1461723935}
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Place all the styles related to the ShieldWechatMessages controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,36 @@
|
||||||
|
class ShieldWechatMessagesController < ApplicationController
|
||||||
|
def create
|
||||||
|
if params[:user_id]
|
||||||
|
@user = User.find params[:user_id]
|
||||||
|
if params[:project_id]
|
||||||
|
ShieldWechatMessage.create(:container_type => 'User', :container_id => params[:user_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||||
|
#@cp = 1
|
||||||
|
#@projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)
|
||||||
|
elsif params[:course_id]
|
||||||
|
ShieldWechatMessage.create(:container_type => 'User', :container_id => params[:user_id].to_i, :shield_type => 'Course', :shield_id => params[:course_id].to_i)
|
||||||
|
#@cp = 0
|
||||||
|
#@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_messages
|
||||||
|
if params[:user_id]
|
||||||
|
@user = User.find params[:user_id]
|
||||||
|
if params[:project_id]
|
||||||
|
ShieldWechatMessage.where("container_type='User' and container_id=#{params[:user_id].to_i} and shield_type='Project' and shield_id=#{params[:project_id]}").each do |act|
|
||||||
|
act.destroy
|
||||||
|
end
|
||||||
|
#@cp = 1
|
||||||
|
#@projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)
|
||||||
|
# ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||||
|
elsif params[:course_id]
|
||||||
|
ShieldWechatMessage.where("container_type='User' and container_id=#{params[:user_id].to_i} and shield_type='Course' and shield_id=#{params[:course_id]}").each do |act|
|
||||||
|
act.destroy
|
||||||
|
end
|
||||||
|
#@cp = 0
|
||||||
|
#@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ShieldWechatMessagesHelper
|
||||||
|
end
|
|
@ -45,8 +45,10 @@ class Comment < ActiveRecord::Base
|
||||||
if self.commented.course
|
if self.commented.course
|
||||||
if self.author_id != self.commented.author_id
|
if self.author_id != self.commented.author_id
|
||||||
self.course_messages << CourseMessage.new(:user_id => self.commented.author_id, :course_id => self.commented.course.id, :viewed => false)
|
self.course_messages << CourseMessage.new(:user_id => self.commented.author_id, :course_id => self.commented.course.id, :viewed => false)
|
||||||
content = strip_html self.comments.html_safe, 200
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count == 0
|
||||||
ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
content = strip_html self.comments.html_safe, 200
|
||||||
|
ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else # 项目相关
|
else # 项目相关
|
||||||
if self.author_id != self.commented.author_id
|
if self.author_id != self.commented.author_id
|
||||||
|
|
|
@ -59,8 +59,10 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
self.course.members.each do |m|
|
self.course.members.each do |m|
|
||||||
# if m.user_id != self.user_id
|
# if m.user_id != self.user_id
|
||||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||||
ws = WechatService.new
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count == 0
|
||||||
ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
|
ws = WechatService.new
|
||||||
|
ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
|
||||||
|
end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -106,8 +108,10 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
#修改作业后发送微信模板消息
|
#修改作业后发送微信模板消息
|
||||||
def wechat_message
|
def wechat_message
|
||||||
self.course.members.each do |member|
|
self.course.members.each do |member|
|
||||||
ws = WechatService.new
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count == 0
|
||||||
ws.homework_template(member.user_id, "homework", self.id, "#{l(:label_update_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
|
ws = WechatService.new
|
||||||
|
ws.homework_template(member.user_id, "homework", self.id, "#{l(:label_update_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -159,9 +159,14 @@ class Issue < ActiveRecord::Base
|
||||||
# 指派给自己的缺陷不提示消息
|
# 指派给自己的缺陷不提示消息
|
||||||
unless self.author_id == self.assigned_to_id
|
unless self.author_id == self.assigned_to_id
|
||||||
self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, :project_id => self.project_id, :viewed => false)
|
self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, :project_id => self.project_id, :viewed => false)
|
||||||
ws = WechatService.new
|
end
|
||||||
content = strip_html self.author.try(:realname) + " 给您指派了缺陷:" + self.subject.html_safe, 200
|
self.project.members.each do |m|
|
||||||
ws.message_update_template self.assigned_to_id, "issues", self.id, "#{l(:label_new_issue_template)}", content, format_time(self.created_on)
|
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count
|
||||||
|
if m.user_id != self.author_id && count != 0
|
||||||
|
ws = WechatService.new
|
||||||
|
content = strip_html self.project.name + " 有新缺陷了:" + self.subject.html_safe, 200
|
||||||
|
ws.message_update_template m.user_id, "issues", self.id, "#{l(:label_new_issue_template)}", content, format_time(self.created_on)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if self.tracker_id == 5
|
if self.tracker_id == 5
|
||||||
self.project.members.each do |m|
|
self.project.members.each do |m|
|
||||||
|
|
|
@ -255,7 +255,7 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
self.course_messages << CourseMessage.new(:user_id => r, :course_id => self.jour.id, :viewed => false)
|
self.course_messages << CourseMessage.new(:user_id => r, :course_id => self.jour.id, :viewed => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.jour_type == 'HomeworkCommon'
|
if self.jour_type == 'HomeworkCommon' && ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count == 0
|
||||||
ws = WechatService.new
|
ws = WechatService.new
|
||||||
#content = truncate(strip_tags(self.notes.to_s), length: 200)
|
#content = truncate(strip_tags(self.notes.to_s), length: 200)
|
||||||
content = strip_html self.notes.html_safe, 200
|
content = strip_html self.notes.html_safe, 200
|
||||||
|
|
|
@ -264,16 +264,19 @@ class Message < ActiveRecord::Base
|
||||||
self.course.members.each do |m|
|
self.course.members.each do |m|
|
||||||
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
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)
|
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
||||||
content = strip_html self.subject, 200
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course.id}").count == 0
|
||||||
ws.topic_publish_template m.user_id, "course_discussion", self.id, "#{l(:label_course_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
|
content = strip_html self.subject, 200
|
||||||
|
ws.topic_publish_template m.user_id, "course_discussion", self.id, "#{l(:label_course_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else # 回帖
|
else # 回帖
|
||||||
self.course.members.each do |m|
|
parent_author_id = Message.find(self.parent_id).author_id
|
||||||
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
if parent_author_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
||||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
self.course_messages << CourseMessage.new(:user_id => parent_author_id, :course_id => self.board.course_id, :viewed => false)
|
||||||
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Course' and shield_id=#{self.board.course_id}").count == 0
|
||||||
content = strip_html self.content.html_safe, 200
|
content = strip_html self.content.html_safe, 200
|
||||||
ws.comment_template m.user_id, "course_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
ws.comment_template parent_author_id, "course_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -282,16 +285,19 @@ class Message < ActiveRecord::Base
|
||||||
self.project.members.each do |m|
|
self.project.members.each do |m|
|
||||||
if m.user_id != self.author_id
|
if m.user_id != self.author_id
|
||||||
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
|
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
|
||||||
content = strip_html self.subject, 200
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Project' and shield_id=#{self.project.id}").count == 0
|
||||||
ws.topic_publish_template m.user_id, "project_discussion", self.id, "#{l(:label_project_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
|
content = strip_html self.subject, 200
|
||||||
|
ws.topic_publish_template m.user_id, "project_discussion", self.id, "#{l(:label_project_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else # 回帖
|
else # 回帖
|
||||||
self.project.members.each do |m|
|
parent_author_id = Message.find(self.parent_id).author_id
|
||||||
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
if parent_author_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
||||||
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
|
self.forge_messages << ForgeMessage.new(:user_id => parent_author_id, :project_id => self.board.project_id, :viewed => false)
|
||||||
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Project' and shield_id=#{self.board.project_id}").count == 0
|
||||||
content = strip_html self.content.html_safe, 200
|
content = strip_html self.content.html_safe, 200
|
||||||
ws.comment_template m.user_id, "project_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
ws.comment_template parent_author_id, "project_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -170,9 +170,11 @@ class News < ActiveRecord::Base
|
||||||
self.course.members.each do |m|
|
self.course.members.each do |m|
|
||||||
if m.user_id != self.author_id
|
if m.user_id != self.author_id
|
||||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||||
ws = WechatService.new
|
if ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count == 0
|
||||||
content = strip_html self.author.try(:realname) + " 发布了通知:" + self.title.html_safe, 200
|
ws = WechatService.new
|
||||||
ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.author.try(:realname) + " 发布了通知:" + content, format_time(self.created_on)
|
content = strip_html self.author.try(:realname) + " 发布了通知:" + self.title.html_safe, 200
|
||||||
|
ws.message_update_template m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.author.try(:realname) + " 发布了通知:" + content, format_time(self.created_on)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
class ShieldWechatMessage < ActiveRecord::Base
|
||||||
|
attr_accessible :container_id, :container_type, :shield_id, :shield_type
|
||||||
|
end
|
|
@ -3,8 +3,10 @@
|
||||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
||||||
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%>
|
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
<% wechat_count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||||||
|
|
||||||
|
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||||
<li>
|
<li>
|
||||||
<ul class="subNavMenu boxShadow">
|
<ul class="subNavMenu boxShadow">
|
||||||
<% if is_teacher %>
|
<% if is_teacher %>
|
||||||
|
@ -53,6 +55,13 @@
|
||||||
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete' %>
|
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="subNavRow">
|
||||||
|
<% if wechat_count == 0 %>
|
||||||
|
<%= link_to "屏蔽微信消息", shield_wechat_messages_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "接收微信消息", show_messages_shield_wechat_messages_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete' %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
<% if User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||||
<li class="subNavRow">
|
<li class="subNavRow">
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="subNavRow">
|
||||||
|
<% if ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
|
||||||
|
<%= link_to "屏蔽微信消息", shield_wechat_messages_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "接收微信消息", show_messages_shield_wechat_messages_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true %>
|
||||||
|
<% end %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if User.current.logged? && (User.current.admin? || is_project_manager?(User.current,project)) %>
|
<% if User.current.logged? && (User.current.admin? || is_project_manager?(User.current,project)) %>
|
||||||
<li class="subNavRow">
|
<li class="subNavRow">
|
||||||
|
|
|
@ -227,7 +227,7 @@
|
||||||
courses = []
|
courses = []
|
||||||
end %>
|
end %>
|
||||||
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
|
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
|
||||||
<ul>
|
<ul id="user_layout_courses">
|
||||||
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
|
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -257,7 +257,7 @@
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" id="homepageLeftMenuForge">
|
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" id="homepageLeftMenuForge">
|
||||||
<ul>
|
<ul id="user_layout_projects">
|
||||||
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
|
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
location.reload();
|
||||||
|
<%# if @cp == 1 %>
|
||||||
|
//$("#user_layout_projects").html(<%#=escape_javascript(render :partial => 'layouts/user_projects', :locals => {:projects => @projects,:user => @user, :page => 0}) %>);
|
||||||
|
<%# elsif @cp == 0 %>
|
||||||
|
//$("#user_layout_courses").html(<%#=escape_javascript(render :partial => 'layouts/user_courses', :locals => {:courses => @courses,:user => @user, :page => 0}) %>);
|
||||||
|
<%# end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
location.reload();
|
||||||
|
<%# if @cp == 1 %>
|
||||||
|
//$("#user_layout_projects").html(<%#=escape_javascript(render :partial => 'layouts/user_projects', :locals => {:projects => @projects,:user => @user, :page => 0}) %>);
|
||||||
|
<%# elsif @cp == 0 %>
|
||||||
|
//$("#user_layout_courses").html(<%#=escape_javascript(render :partial => 'layouts/user_courses', :locals => {:courses => @courses,:user => @user, :page => 0}) %>);
|
||||||
|
<%# end %>
|
|
@ -39,7 +39,11 @@ RedmineApp::Application.routes.draw do
|
||||||
get '/:sub_dir_name', to: 'fake#fake'
|
get '/:sub_dir_name', to: 'fake#fake'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :shield_wechat_messages do
|
||||||
|
collection do
|
||||||
|
delete 'show_messages'
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :shield_activities do
|
resources :shield_activities do
|
||||||
collection do
|
collection do
|
||||||
delete 'show_acts'
|
delete 'show_acts'
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateShieldWechatMessages < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :shield_wechat_messages do |t|
|
||||||
|
t.integer :container_id
|
||||||
|
t.string :container_type
|
||||||
|
t.integer :shield_id
|
||||||
|
t.string :shield_type
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
25
db/schema.rb
25
db/schema.rb
|
@ -11,11 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
|
ActiveRecord::Schema.define(:version => 20160426084709) do
|
||||||
|
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20160405021915) do
|
|
||||||
ActiveRecord::Schema.define(:version => 20160419074016) do
|
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -1655,6 +1651,24 @@ ActiveRecord::Schema.define(:version => 20160419074016) do
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "shield_wechat_messages", :force => true do |t|
|
||||||
|
t.integer "container_id"
|
||||||
|
t.string "container_type"
|
||||||
|
t.integer "shield_id"
|
||||||
|
t.string "shield_type"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "shield_wechats", :force => true do |t|
|
||||||
|
t.string "container_type"
|
||||||
|
t.integer "container_id"
|
||||||
|
t.string "shield_type"
|
||||||
|
t.integer "shield_id"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "softapplications", :force => true do |t|
|
create_table "softapplications", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
@ -1695,7 +1709,6 @@ ActiveRecord::Schema.define(:version => 20160419074016) do
|
||||||
t.integer "status", :default => 9
|
t.integer "status", :default => 9
|
||||||
t.text "results"
|
t.text "results"
|
||||||
t.text "src"
|
t.text "src"
|
||||||
t.integer "uwait_time", :default => 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "student_works", :force => true do |t|
|
create_table "student_works", :force => true do |t|
|
||||||
|
|
|
@ -436,7 +436,7 @@ app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProv
|
||||||
.otherwise({
|
.otherwise({
|
||||||
redirectTo: '/activities'
|
redirectTo: '/activities'
|
||||||
});
|
});
|
||||||
$httpProvider.interceptors.push('timestampMarker');
|
//$httpProvider.interceptors.push('timestampMarker');
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
//loading
|
//loading
|
||||||
|
|
|
@ -29,7 +29,7 @@ ul.shild:hover li ul {display:block;}
|
||||||
.subNavArrow {background:url(../images/hwork_icon.png) -82px -399px no-repeat; display:inline-block; width:20px; height:20px; position:absolute; top:10px; right:0px;}
|
.subNavArrow {background:url(../images/hwork_icon.png) -82px -399px no-repeat; display:inline-block; width:20px; height:20px; position:absolute; top:10px; right:0px;}
|
||||||
ul.subNavArrow:hover li ul {display:block;}
|
ul.subNavArrow:hover li ul {display:block;}
|
||||||
.subNavMenu {line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:20px; top:-10px; padding:5px 0px; display:none; z-index:999;}
|
.subNavMenu {line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:20px; top:-10px; padding:5px 0px; display:none; z-index:999;}
|
||||||
.subNavRow {padding:0px 15px; width:70px;}
|
.subNavRow {padding:0px 15px; width:75px;}
|
||||||
.w48 {width:48px;}
|
.w48 {width:48px;}
|
||||||
|
|
||||||
a.mesIcon {background:url(../images/mes_icon.png) -5px -73px no-repeat; padding-left:23px;}
|
a.mesIcon {background:url(../images/mes_icon.png) -5px -73px no-repeat; padding-left:23px;}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ShieldWechatMessagesController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :shield_wechat_message do
|
||||||
|
container_id 1
|
||||||
|
container_type "MyString"
|
||||||
|
shield_id 1
|
||||||
|
shield_type "MyString"
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ShieldWechatMessage, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in New Issue