增加课程成员,给该老师也发送消息;

修改增加成员或删除成员消息的内容
This commit is contained in:
ouyangxuhua 2015-10-29 15:38:57 +08:00
parent eb24e1dbea
commit f26707e381
3 changed files with 49 additions and 9 deletions

View File

@ -163,9 +163,9 @@ class MembersController < ApplicationController
#给新成员和老师发送加入课程的消息发送者id放在CourseMessage的course_message_id字段中 #给新成员和老师发送加入课程的消息发送者id放在CourseMessage的course_message_id字段中
#course_message_type设置为JoinCourse #course_message_type设置为JoinCourse
#status = 0 表示给学生发status = 1表示给老师发 #status = 0 表示给学生发status = 1表示给老师发
course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :viewed => false, :status => 0) course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :content => role, :viewed => false, :status => 0)
course_join.save course_join.save
CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse", :viewed => false, status => 1) CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse",:content => role, :viewed => false, :status => 1)
members << member members << member
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id) #user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)

View File

@ -511,7 +511,7 @@
<% end %> <% end %>
<!--被老师拉入课程--> <!--被老师拉入课程-->
<% if ma.course_message_type == "JoinCourse" %> <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %></a> <a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %></a>
@ -527,8 +527,44 @@
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %> <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p> <% teacher = User.find(ma.course_message_id) %>
<p>课程描述:<%= ma.course.description.blank? ? '无':ma.course.description %></p> <p><%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:</p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p>
<% else %>
<p>
您已经被移出该私有课程,非课程成员没有权限访问私有课程
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--被老师拉入课程-->
<% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"></a>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您增加了新的课程成员:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to User.find(ma.course_message_id), user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<p>您增加了新的课程成员,详情如下:</p>
<p>成员:<%= User.find(ma.course_message_id) %></p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p> <p>课时总数:<%= ma.course.class_period %></p>
<% else %> <% else %>
<p> <p>
@ -557,8 +593,12 @@
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %> <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p> <p>您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:</p>
<p>课程描述:<%= ma.course.description.blank? ? '无' : ma.course.description %></p> <p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<% if !ma.content.nil? %>
<p>担任角色:<%= ma.content %></p>
<% end %>
<p>学时总数:<%= ma.course.class_period %></p> <p>学时总数:<%= ma.course.class_period %></p>
<% else %> <% else %>
<p> <p>

View File

@ -36,7 +36,7 @@
:onmouseout => "message_titile_hide($(this))" %></a> :onmouseout => "message_titile_hide($(this))" %></a>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) %> <% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p> <p>
项目名称:<%= ma.project.name %> 项目名称:<%= ma.project.name %>
</p> </p>
@ -69,7 +69,7 @@
:onmouseout => "message_titile_hide($(this))" %></a> :onmouseout => "message_titile_hide($(this))" %></a>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) %> <% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p> <p>
项目名称:<%= ma.project.name %> 项目名称:<%= ma.project.name %>
</p> </p>