加入班级的弹框
This commit is contained in:
parent
a1553c7a8f
commit
335b82c046
|
@ -23,7 +23,7 @@ class CoursesController < ApplicationController
|
|||
|
||||
before_filter :can_show_course, :except => []
|
||||
before_filter :logged_user_by_apptoken,:only => [:show,:feedback]
|
||||
before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses]
|
||||
before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses, :join_course_multi_role]
|
||||
before_filter :authorize_course, :only => [:show, :settings, :update, :course]
|
||||
before_filter :authorize_course_global, :only => [:new,:create]
|
||||
before_filter :toggleCourse, :only => [:finishcourse, :restartcourse]
|
||||
|
@ -81,6 +81,22 @@ class CoursesController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def join_course_multi_role
|
||||
if User.current.logged?
|
||||
cs = CoursesService.new
|
||||
@user = User.current
|
||||
join = cs.join_course_roles params,@user
|
||||
@state = join[:state]
|
||||
@course = join[:course]
|
||||
else
|
||||
@state = 5 #未登录
|
||||
end
|
||||
@object_id = @course.id if @course
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def unjoin
|
||||
if User.current.logged?
|
||||
cs = CoursesService.new
|
||||
|
|
|
@ -355,15 +355,21 @@ class UsersController < ApplicationController
|
|||
case params[:agree]
|
||||
when 'Y'
|
||||
apply_user = User.find(@msg.course_message_id)
|
||||
|
||||
ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色
|
||||
integer_ids = []
|
||||
ids.each do |role_id|
|
||||
integer_ids << role_id.to_i
|
||||
end
|
||||
if apply_user.member_of_course?(Course.find(@msg.course_id))
|
||||
#将角色改为老师或者教辅
|
||||
member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0]
|
||||
member.role_ids = [@msg.content] # msg content保存的是申请的职位角色
|
||||
#删除为学生的记录
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
member.role_ids = integer_ids
|
||||
#删除为学生的记录
|
||||
unless member.role_ids.include?(10)
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
end
|
||||
end
|
||||
|
||||
member.course_group_id = 0
|
||||
|
@ -372,7 +378,7 @@ class UsersController < ApplicationController
|
|||
@msg.update_attributes(:status=>1,:viewed=>1)
|
||||
else
|
||||
members = []
|
||||
members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id)
|
||||
members << Member.new(:role_ids => integer_ids, :user_id => @msg.course_message_id)
|
||||
Course.find(@msg.course_id).members << members
|
||||
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
|
||||
@msg.update_attributes(:status=>1,:viewed=>1)
|
||||
|
|
|
@ -794,7 +794,7 @@ module CoursesHelper
|
|||
if user.logged?
|
||||
joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id
|
||||
text = joined ? l(:label_course_exit_student) : l(:label_course_join_student)
|
||||
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
|
||||
url = joined ? join_path(:object_id => course.id) : join_private_courses_courses_path()
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
|
|
|
@ -389,6 +389,101 @@ class CoursesService
|
|||
{:state => @state,:course => course}
|
||||
end
|
||||
|
||||
#多个角色加入课程
|
||||
def join_course_roles params,current_user
|
||||
course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
|
||||
|
||||
@state = 10
|
||||
if course
|
||||
if course_endTime_timeout? course
|
||||
@state = 2
|
||||
else
|
||||
if current_user.member_of_course?(course) #如果已经是成员
|
||||
@state = 3
|
||||
# member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
||||
# role_ids = params[:role]
|
||||
# #roleName = member.roles[0].name if member
|
||||
# #roleName = member.roles.map{|role| role.name}.join(",") if member
|
||||
# if params[:invite_code].present?
|
||||
# #如果加入角色为学生 并且当前是学生
|
||||
# if role_ids == "10" && roleName.include?("Student") && !roleName.include?("Teacher") && !roleName.include?("TeachingAsistant")&& !roleName.include?("Manager")
|
||||
# @state = 3
|
||||
# #如果加入的角色为老师,并且当前已经是老师
|
||||
# elsif role_ids == "9" && roleName.include?("Teacher") && !roleName.include?("Student")
|
||||
# @state = 8
|
||||
# #如果加入的角色教辅并且当前为教辅
|
||||
# elsif role_ids == "7" && roleName.include?("TeachingAsistant") && !roleName.include?("Student")
|
||||
# @state = 9
|
||||
# elsif roleName.include?("Manager")
|
||||
# @state = 10
|
||||
# #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
|
||||
# elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
|
||||
# #如果已经发送过消息了,那么就要给个提示
|
||||
# if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
|
||||
# @state = 7
|
||||
# else
|
||||
# Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
# 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',:status=>0)
|
||||
# @state = 6
|
||||
# end
|
||||
# #如果加入角色是学生,但是是当前课程的教师或者教辅
|
||||
# elsif params[:role] == "10" && roleName != "Student"
|
||||
# member.role_ids = [params[:role]]
|
||||
# member.save
|
||||
# StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
# @state = 0
|
||||
# end
|
||||
# else
|
||||
# @state = 1
|
||||
# end
|
||||
else
|
||||
if params[:invite_code].present?
|
||||
role_ids = params[:role]
|
||||
role_str = role_ids.join(",")
|
||||
if role_ids.include?("10") && !role_ids.include?("7") && !role_ids.include?("9")
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
else
|
||||
is_stu = false
|
||||
if role_ids.include?("10")
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id)
|
||||
is_stu = true
|
||||
end
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = '#{role_str}' and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0
|
||||
if is_stu
|
||||
@state = 12
|
||||
else
|
||||
@state = 7
|
||||
end
|
||||
else
|
||||
Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
if is_stu
|
||||
@state = 13
|
||||
else
|
||||
@state = 6
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@state = 4
|
||||
end
|
||||
{:state => @state,:course => course}
|
||||
end
|
||||
|
||||
|
||||
#作业列表
|
||||
#已提交的作业数量获取 bid.homeworks.count
|
||||
#学生提问数量获取 bid.commit.nil? ? 0 : bid.commit
|
||||
|
|
|
@ -1,100 +1,52 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>快速进入班级通道</title>
|
||||
<style>
|
||||
#popbox{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
||||
#popbox div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
|
||||
#popbox div,img,tr,td{ border:0;}
|
||||
#popbox table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||
#popbox ul,li{ list-style-type:none}
|
||||
#popbox .cl{ clear:both; overflow:hidden; }
|
||||
#popbox a{ text-decoration:none; }
|
||||
#popbox a:hover{}
|
||||
<div id="sy_popup_box">
|
||||
<div class="sy_popup_top">
|
||||
<h3 class="fl">欢迎加入班级</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con">
|
||||
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
|
||||
<ul class="sy_popup_add ">
|
||||
<li>
|
||||
<label>班级邀请码:</label>
|
||||
<input class=" sy_input_txt fl" name="invite_code" placeholder="请输入五位班级邀请码">
|
||||
|
||||
.alert_box {width:488px;height:550px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; }
|
||||
#popbox{width:488px;height:368px;}
|
||||
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
|
||||
#popbox .C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
|
||||
#popbox .C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
|
||||
#popbox .C_top p{ color:#a9aaaa; line-height:22px;}
|
||||
#popbox .C_form{ margin:20px 0 0 60px;}
|
||||
#popbox .C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
|
||||
#popbox .C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
|
||||
#popbox .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:97px;}
|
||||
#popbox .width190{ width:190px; height:26px; border-color:#e1e1e1;}
|
||||
#popbox .C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
|
||||
#popbox .C_form a:hover{ text-decoration:underline;}
|
||||
#popbox .C_form a.btn_join{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#269ac9; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
|
||||
#popbox .C_form a.btn_join:hover{ background:#297fb8; text-decoration: none;}
|
||||
#popbox .C_form a.btn_cancel{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#c1c1c1; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
|
||||
#popbox .C_form a.btn_cancel:hover{ background:#717171; text-decoration: none;}
|
||||
#popbox .IDType {border:1px solid #e1e1e1; outline: none; width: 65px; height: 25px;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function submit_form(obj)
|
||||
{
|
||||
$("#new-watcher-form").submit();
|
||||
}
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label>身份:</label>
|
||||
<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml5 mr5 "/><span class="mr10">教师</span>
|
||||
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5"/><span class="mr10">助教</span>
|
||||
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5"/><span class="mr10">学生</span>
|
||||
|
||||
function hidden_join_course_form()
|
||||
{
|
||||
hideModal($("#popbox"));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#new-watcher-form').submit();hideModal()">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取 消</a>
|
||||
|
||||
<body>
|
||||
<div id="popbox">
|
||||
<div class="C" >
|
||||
<div class="C_top">
|
||||
<h2>快速加入班级通道</h2>
|
||||
<p>只要持有班级邀请码,就可以快速加入所在班级。班级页面搜索不到的私有班级只能从此通道进入哦!</p>
|
||||
</div>
|
||||
<div class="C_form">
|
||||
<%= form_tag({:controller => 'courses',
|
||||
:action => 'join'},
|
||||
:remote => true,
|
||||
:method => :post,
|
||||
:id => 'new-watcher-form') do %>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<span class="tips" style="width: 90px; display: inline-block;">班级邀请码:</span>
|
||||
<input class="width190" style="margin-left: 0px;" name="invite_code" id="object_id" type="text" value="" >
|
||||
<input type="text" style="display: none"/>
|
||||
</li>
|
||||
<li class="mB5">班级邀请码是所在班级页面中显示的邀请码</li>
|
||||
<li style="margin-top: 15px;">
|
||||
<span style="margin-right: 5px;"><span style="margin-right:43px;">身</span><span>份</span>:</span>
|
||||
<% if User.current.logged? && User.current.extensions && User.current.extensions.identity == 0%>
|
||||
<select name="role" class="IDType">
|
||||
<option value="9">教师</option>
|
||||
<option value="7">教辅</option>
|
||||
<option value="10">学生</option>
|
||||
</select>
|
||||
<%else%>
|
||||
<select name="role" class="IDType">
|
||||
<option value="10">学生</option>
|
||||
<option value="7">教辅</option>
|
||||
</select>
|
||||
<%end%>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:" class="btn_join" style="margin-left: 50px;" onclick="submit_form(this);">
|
||||
<%= l(:label_new_join) %>
|
||||
</a>
|
||||
<a href="javascript:" class="btn_cancel" style="margin-left: 20px;" onclick="hideModal(this);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% end%>
|
||||
</div>
|
||||
</div><!---- C end---->
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#join_course_role_7").on('click', function(){
|
||||
if($("#join_course_role_7").is(":checked")) {
|
||||
$("#join_course_role_9").attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#join_course_role_9").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
$("#join_course_role_9").on('click', function(){
|
||||
if($("#join_course_role_9").is(":checked")) {
|
||||
$("#join_course_role_7").attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#join_course_role_7").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -36,6 +36,10 @@ window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/co
|
|||
alert("您已经是该班级的管理员了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 11%>
|
||||
alert("该班级已被删除");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% else %>
|
||||
alert("未知错误,请稍后再试");
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<% if @object_id && @state != 6 && @state !=4 %>
|
||||
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>");
|
||||
<% end %>
|
||||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功");
|
||||
hideModal();
|
||||
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 1 %>
|
||||
alert("密码错误");
|
||||
<% elsif @state == 2 %>
|
||||
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
|
||||
<% elsif @state == 3 %>
|
||||
alert("您已经加入了班级");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 4 %>
|
||||
alert("您加入的班级不存在");
|
||||
<% elsif @state == 5 %>
|
||||
alert("您还未登录");
|
||||
<% elsif @state == 6 %>
|
||||
alert("申请成功,请等待审核");
|
||||
hidden_join_course_form();
|
||||
<% elsif @state == 7%>
|
||||
alert("您已经发送过申请了,请耐心等待");
|
||||
hidden_join_course_form();
|
||||
<% elsif @state == 8%>
|
||||
alert("您已经是该班级的教师了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 9%>
|
||||
alert("您已经是该班级的教辅了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 10%>
|
||||
alert("您已经是该班级的管理员了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 11%>
|
||||
alert("该班级已被删除");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 12 %>
|
||||
alert("您已经发送过申请了,请耐心等待");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 13 %>
|
||||
alert("申请成功,请等待审核");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% else %>
|
||||
alert("未知错误,请稍后再试");
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -1,11 +1,2 @@
|
|||
$('#topnav_course_menu').hide();
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
|
||||
showModal('ajax-modal', '540px');
|
||||
$('#ajax-modal').css('height','390px');
|
||||
//$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').siblings().hide();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
"<a href='javascript:' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'join_private_course') %>";
|
||||
pop_box_new(htmlvalue,460,40,50);
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
|
||||
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
|
||||
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
|
||||
<li><%= link_to "复制班级", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
|
||||
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -55,6 +54,9 @@
|
|||
<span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span>
|
||||
<span class=" mr15">单位:<span class="sy_cblack"><%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %></span></span>
|
||||
</p>
|
||||
<% if is_teacher %>
|
||||
<%= link_to "班级设置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_btn_grey mr10 fl" %>
|
||||
<% end %>
|
||||
<% is_TA = get_user_member_roles_course @course, User.current, 7 %>
|
||||
<% is_TE = get_user_member_roles_course @course, User.current, 9 %>
|
||||
<% is_ST = get_user_member_roles_course @course, User.current, 10 %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</li>
|
||||
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContent2' : 'homepageHomeworkContent' %> fl">
|
||||
<a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
|
||||
<%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content.include?('9') ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
|
||||
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
|
||||
<!--:onmouseover => "message_titile_show($(this),event)",-->
|
||||
<!--:onmouseout => "message_titile_hide($(this))" %>-->
|
||||
|
@ -18,7 +18,7 @@
|
|||
<p>真实姓名:<%= User.find(ma.course_message_id).realname %></p>
|
||||
<p>申请课程:<%= Course.find(ma.course_id).name%></p>
|
||||
<div class="fl">课程描述:</div>
|
||||
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %></div> <p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
|
||||
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %></div> <p>申请职位:<%= ma.content.include?('9') ? "教师" : "教辅"%></p>
|
||||
</div>
|
||||
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl">
|
||||
<span id="deal_info_<%=ma.id%>">
|
||||
|
|
|
@ -586,9 +586,9 @@
|
|||
</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.status == 1 ?
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过'
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'申请已通过'
|
||||
:
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)),
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)),
|
||||
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
|
||||
<!--:onmouseover => "message_titile_show($(this),event)",-->
|
||||
<!--:onmouseout => "message_titile_hide($(this))" %>-->
|
||||
|
|
|
@ -1160,6 +1160,8 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
collection do
|
||||
match 'join_private_courses', :via => [:get, :post]
|
||||
post "join_course_multi_role"
|
||||
|
||||
end
|
||||
|
||||
match '/member', :to => 'courses#member', :as => 'member', :via => :get
|
||||
|
|
20
db/schema.rb
20
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160727065357) do
|
||||
ActiveRecord::Schema.define(:version => 20160728075947) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -52,9 +52,20 @@ ActiveRecord::Schema.define(:version => 20160727065357) do
|
|||
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
|
||||
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
|
||||
|
||||
create_table "applied_messages", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "applied_id"
|
||||
t.string "applied_type"
|
||||
t.integer "viewed", :default => 0
|
||||
t.integer "status", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "applied_projects", :force => true do |t|
|
||||
t.integer "project_id", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
t.integer "project_id", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
t.integer "role", :default => 0
|
||||
end
|
||||
|
||||
create_table "apply_add_schools", :force => true do |t|
|
||||
|
@ -67,6 +78,7 @@ ActiveRecord::Schema.define(:version => 20160727065357) do
|
|||
t.integer "status", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "apply_homeworks", :force => true do |t|
|
||||
|
@ -1539,6 +1551,8 @@ ActiveRecord::Schema.define(:version => 20160727065357) do
|
|||
t.integer "boards_reply_count", :default => 0
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "hot", :default => 0
|
||||
t.string "invite_code"
|
||||
t.string "qrcode"
|
||||
end
|
||||
|
||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||
|
|
|
@ -545,6 +545,7 @@ a:hover.Blue-btn{ background:#3598db; color:#fff;}
|
|||
|
||||
/*20160725 项目申请按钮*/
|
||||
a.sy_btn_grey{
|
||||
display:inline-block;
|
||||
color: #333;
|
||||
background: #e1e1e1;
|
||||
text-align: center;
|
||||
|
@ -559,13 +560,13 @@ a.sy_btn_grey{
|
|||
}
|
||||
a:hover.sy_btn_grey{ background: #c3c3c3;}
|
||||
a.sy_btn_blue{
|
||||
display:block;
|
||||
width:80px;
|
||||
height: 30px;
|
||||
text-align:center;
|
||||
display:inline-block;
|
||||
color: #fff;
|
||||
background: #3b94d6;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
padding:0 15px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
-webkit-border-radius:3px;
|
||||
-moz-border-radius:3px;
|
||||
|
|
|
@ -103,8 +103,11 @@ div#menu ul ul ul li a{ width:185px; overflow:hidden; white-space: nowrap; text-
|
|||
.homepageNewsPubTypeHomework {width:270px; font-size:12px; color:#888888; display: block; white-space:nowrap;}
|
||||
.homepageNewsContent {width:355px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
.homepageSystenMessageContent {width:281px; max-width:291px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden;text-overflow:ellipsis;max-height: 49px; }
|
||||
|
||||
.homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
.homepageHomeworkContent {width:235px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
.homepageHomeworkContentWarn2 {width:60px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
.homepageHomeworkContent2 {width:285px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; }
|
||||
|
||||
.homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;}
|
||||
.loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;}
|
||||
|
|
|
@ -15,6 +15,7 @@ a.sy_cmore{ font-size:12px; color:#888; font-weight:normal;}
|
|||
a:hover.sy_cmore{color: #ee4a1f;}
|
||||
/* 按钮*/
|
||||
a.btn_orange_big{
|
||||
display:inline-block;
|
||||
border: 1px solid #ee4a1f;
|
||||
color: #ee4a1f;
|
||||
text-align: center;
|
||||
|
@ -32,6 +33,7 @@ a:hover.btn_orange_big{
|
|||
color: #fff;
|
||||
}
|
||||
a.btn_green_big{
|
||||
display:inline-block;
|
||||
border: 1px solid #60b25e;
|
||||
color: #60b25e;
|
||||
text-align: center;
|
||||
|
@ -49,6 +51,7 @@ a:hover.btn_green_big{
|
|||
color: #fff;
|
||||
}
|
||||
a.sy_btn_green{
|
||||
display:inline-block;
|
||||
color: #fff;
|
||||
background: #60b25e;
|
||||
text-align: center;
|
||||
|
@ -62,6 +65,7 @@ a.sy_btn_green{
|
|||
border-radius:3px;
|
||||
}
|
||||
a:hover.sy_btn_green{ background: #51a74f;}
|
||||
|
||||
/*a.sy_btn_grey{*/
|
||||
/*color: #333;*/
|
||||
/*background: #e1e1e1;*/
|
||||
|
|
Loading…
Reference in New Issue