Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
b0aee8c92f
|
@ -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 }
|
||||
|
|
|
@ -949,7 +949,7 @@ class UsersController < ApplicationController
|
|||
when "current_user"
|
||||
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+User.watched_by(@user.id).map{|u| u.blog.id}.join(',')+")"
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
|
@ -957,7 +957,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
else
|
||||
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
blog_ids = "("+@user.blog.id.to_s+","+User.watched_by(@user.id).map{|u| u.blog.id}.join(',')+")"
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
|
|
|
@ -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 %>
|
|
@ -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>
|
||||
|
|
|
@ -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 |
Loading…
Reference in New Issue