This commit is contained in:
lizanle 2015-10-29 14:05:58 +08:00
commit a747983a51
6 changed files with 76 additions and 5 deletions

View File

@ -159,6 +159,14 @@ class MembersController < ApplicationController
if role && (role.name == "学生" || role.name == "Student")
StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id)
end
#给新成员和老师发送加入课程的消息发送者id放在CourseMessage的course_message_id字段中
#course_message_type设置为JoinCourse
#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.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)
members << member
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
if (params[:membership][:role_ids])
@ -305,7 +313,8 @@ class MembersController < ApplicationController
grade.destroy
end
end
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
#移出项目发送消息
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
end
respond_to do |format|
format.html { redirect_to_settings_in_projects }
@ -333,6 +342,8 @@ class MembersController < ApplicationController
end
@roles = Role.givable.all[3..5]
@members = @course.member_principals.includes(:roles, :principal).all.sort
#移出课程发送消息
CourseMessage.create(:user_id => @member.user_id, :course_id => @course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => User.current.id)
end
respond_to do |format|
format.html { redirect_to_settings_in_courses }

View File

@ -503,4 +503,64 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--被老师拉入课程-->
<% if ma.course_message_type == "JoinCourse" %>
<ul class="homepageNewsList 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>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :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.name, course_member_path(ma.course), :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>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
<p>课程描述:<%= ma.course.description.blank? ? '无':ma.course.description %></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 == "RemoveFromCourse" %>
<ul class="homepageNewsList 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>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :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.name, member_course_path(ma.course), :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?(ma.course) || User.current.admin? %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
<p>课程描述:<%= ma.course.description.blank? ? '无' : ma.course.description %></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 %>
<% end %>

View File

@ -2,7 +2,7 @@
<%# @user_system_messages.each do |usm| %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/logo.png", width: "30px", height: "30px", class: "mt3") %></div></a>
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">Trustie平台</span><span class="homepageNewsType fl">发布新消息:</span>

View File

@ -4,7 +4,7 @@
<div class="resources mt10">
<div class="homepagePostBrief break_word">
<div class="homepagePostPortrait">
<%= image_tag("/images/logo.png", :width => "50", :height => "50") %>
<%= image_tag("/images/trustie_logo1.png", :width => "50", :height => "50") %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
@ -18,7 +18,7 @@
</p>
</div>
<div class="cl"></div>
<p class="homepagePostDeadline">截止时间:<%= format_time(system_message.created_at) %></p>
<p class="homepagePostDeadline">发布时间:<%= format_time(system_message.created_at) %></p>
</div>
<div class="cl"></div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -12,7 +12,7 @@ textarea {resize: none;}
.pInline {margin:0px; padding:0px; display:inline-block;}
/*常用*/
select,input,textarea{ border:1px solid #269ac9; background:#fff; color:#000; padding-left:5px;padding-right: 5px; }
select,input,textarea{ border:1px solid #269ac9; background:#fff; color:#000; padding-left:5px}
.sub_btn{ cursor:pointer; -moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #707070; color:#000; border-radius:3px; padding:1px 10px; margin-bottom:10px; background:#dbdbdb;}
.sub_btn:hover{ background:#b5e2fa; color:#000; border:1px solid #3c7fb1;}
table{ background:#fff;}