parent
5fb1291bf8
commit
b0b1a27908
|
@ -37,6 +37,7 @@ class CoursesController < ApplicationController
|
|||
join = cs.join_course params,@user
|
||||
@state = join[:state]
|
||||
@course = join[:course]
|
||||
Mailer.run.join_course_request(@course, User.current, params[:role])
|
||||
# else
|
||||
# @course = Course.find_by_id params[:object_id]
|
||||
# CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest')
|
||||
|
|
|
@ -919,9 +919,11 @@ class UsersController < ApplicationController
|
|||
|
||||
def show
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and u ser_id =? and course_message_id =? and viewed =?",
|
||||
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
if params[:course_id] != nil
|
||||
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
|
||||
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
end
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
|
||||
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
||||
|
|
|
@ -1009,6 +1009,16 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
|
||||
def join_course_request(course, user, role)
|
||||
@receive = User.find(course.tea_id)
|
||||
@course = course
|
||||
@user = user
|
||||
@role = role
|
||||
@subject = "#{@user.show_name} #{l(:label_apply_join_course)} #{@course.name} "
|
||||
mail :to => @receive.mail,
|
||||
:subject => @subject
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
|
@ -1066,4 +1076,5 @@ class Mailer < ActionMailer::Base
|
|||
1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
|
||||
return newpass
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<p>
|
||||
<%= @user.show_name %>申请成为课程<%= @course.name %>的<%= @role.eql?('9') ? '老师': '教辅' %>
|
||||
<%=link_to user_message_url(@receive),user_message_url(@receive)%>
|
||||
</p>
|
|
@ -0,0 +1,4 @@
|
|||
<%= @user.show_name %>申请成为课程<%= @course.name %>的<%= @role.eql?('9') ? '老师': '教辅' %>
|
||||
<%=link_to user_message_url(@receive),user_message_url(@receive)%>
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ zh:
|
|||
# 资源库 (课程、项目按类型分)
|
||||
label_course_file: 资源库
|
||||
label_upload_files: 上传资源
|
||||
|
||||
label_apply_join_course: 申请加入课程
|
||||
#
|
||||
# 课程托管平台主页
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue