班级的邀请码增加“停用”和“启用”功能,停用的邀请码不允许用户主动加入班级

This commit is contained in:
cxt 2016-12-08 13:40:11 +08:00
parent c24f9b8c3b
commit abdbfd87b0
13 changed files with 115 additions and 37 deletions

View File

@ -32,6 +32,13 @@ class CoursesController < ApplicationController
before_filter :require_login, :only => [:join, :unjoin] before_filter :require_login, :only => [:join, :unjoin]
#before_filter :allow_join, :only => [:join] #before_filter :allow_join, :only => [:join]
# 邀请码停用/启用
def set_invite_code_halt
if User.current.allowed_to?(:as_teacher, @course) || User.current.admin?
@course.update_attribute('invite_code_halt', @course.invite_code_halt == 0 ? 1 : 0)
end
end
#查找组织 #查找组织
def search_public_orgs_not_in_course def search_public_orgs_not_in_course
condition = '%%' condition = '%%'

View File

@ -584,6 +584,8 @@ class CoursesService
@state = 2 @state = 2
elsif course[:is_delete] == 1 elsif course[:is_delete] == 1
@state = 11 @state = 11
elsif course[:invite_code_halt] == 1
@state = 14
else else
if current_user.member_of_course?(course) #如果已经是成员 if current_user.member_of_course?(course) #如果已经是成员
@state = 3 @state = 3

View File

@ -10,7 +10,6 @@
<li> <li>
<label>班级邀请码:</label> <label>班级邀请码:</label>
<input class=" sy_input_txt fl" name="invite_code" placeholder="请输入五位班级邀请码"> <input class=" sy_input_txt fl" name="invite_code" placeholder="请输入五位班级邀请码">
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li> <li>
@ -18,14 +17,13 @@
<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="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="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> <input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5"/><span class="mr10">学生</span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li> <p id="none_checked_notice" class="c_red none f12" style="margin-left: 42px;">请至少选择一个身份</p>
<li class="mt10">
<label>&nbsp;</label> <label>&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#new-watcher-form').submit();hideModal()">确&nbsp;&nbsp;定</a> <a href="javascript:void(0);" class="sy_btn_blue fl" onclick="submit_join_course();">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a> <a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
</ul> </ul>
@ -33,6 +31,16 @@
</div> </div>
</div> </div>
<script> <script>
function submit_join_course(){
if ($("input[name='role[]']:checked").length >= 1){
$("#none_checked_notice").hide();
$('#new-watcher-form').submit();
hideModal();
}else{
$("#none_checked_notice").show();
}
}
$(function() { $(function() {
$("#join_course_role_7").on('click', function(){ $("#join_course_role_7").on('click', function(){
if($("#join_course_role_7").is(":checked")) { if($("#join_course_role_7").is(":checked")) {

View File

@ -5,77 +5,82 @@
<% if @state == 0 %> <% if @state == 0 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">加入成功</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">加入成功</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 1 %> <% elsif @state == 1 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">密码错误</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">密码错误</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 2 %> <% elsif @state == 2 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">班级已过期<br/>请联系班级管理员重启班级。(在配置班级处)</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">班级已过期<br/>请联系班级管理员重启班级。(在配置班级处)</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 3 %> <% elsif @state == 3 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经加入了班级</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您已经加入了班级</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 4 %> <% elsif @state == 4 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您输入的邀请码错误</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您输入的邀请码错误</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 5 %> <% elsif @state == 5 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您还未登录</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您还未登录</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 6 %> <% elsif @state == 6 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 7%> <% elsif @state == 7%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 8%> <% elsif @state == 8%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教师了</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您已经是该班级的教师了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 9%> <% elsif @state == 9%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教辅了</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您已经是该班级的教辅了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 10%> <% elsif @state == 10%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的管理员了</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您已经是该班级的管理员了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 11%> <% elsif @state == 11%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">该班级已被删除</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">该班级已归档,请联系老师</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 12 %> <% elsif @state == 12 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 13 %> <% elsif @state == 13 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 14 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">此二维码已停用,请与老师联系</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% else %> <% else %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">未知错误,请稍后再试</p><div class="cl"></div>'+ '<div class="clear mt15"><p class="text_c f14">未知错误,请稍后再试</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
<% end %> <% end %>
<% end %> <% end %>

View File

@ -0,0 +1,2 @@
$("#project_info_<%=@course.id %>").html("<%= escape_javascript(render :partial => 'layouts/course_base_info') %>");
hideModal();

View File

@ -54,14 +54,23 @@
</div> </div>
</div> </div>
<div class="sy_class_id fl"> <div class="sy_class_id fl">
<p>邀 请 码<br /> <p style="margin: <%=is_teacher ? '8px auto' : '24px auto 0px' %>">邀 请 码<br />
<span class="sy_corange"> <span class="sy_corange">
<% if User.current.admin? || User.current.member_of_course?(@course) %> <% if @course.invite_code_halt == 0 %>
<%=@course.generate_invite_code %> <% if User.current.admin? || User.current.member_of_course?(@course) %>
<%=@course.generate_invite_code %>
<% else %>
<span class="f12">请询问老师</span>
<% end %>
<% else %> <% else %>
<span class="f12">请询问老师</span> 已停用
<% end %> <% end %>
</span> </span>
<% if is_teacher && @course.invite_code_halt == 0 %>
<a href="javascript:void(0);" class="btn_grey_mid" style="margin-bottom: 12px;" onclick="alert_halt_code();">停&nbsp;&nbsp;&nbsp;&nbsp;用</a>
<% elsif is_teacher && @course.invite_code_halt == 1 %>
<a href="<%=set_invite_code_halt_course_path(@course) %>" data-remote="true" class="btn_grey_mid" style="margin-bottom: 12px;">启&nbsp;&nbsp;&nbsp;&nbsp;用</a>
<% end %>
</p> </p>
</div> </div>
<div class="sy_class_info fl ml15"> <div class="sy_class_info fl ml15">
@ -102,10 +111,10 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if is_teacher %> <% if is_teacher %>
<div class="invite_code_tip_box fontGrey2"> <div class="invite_code_tip_box fontGrey2" id="invite_code_tip_box">
<em></em> <em></em>
<span></span> <span></span>
<p class="mt10 mb5">请将邀请码告诉学生和教辅</p> <p class="mt10 mb5"><%= @course.invite_code_halt == 0 ? "请将邀请码告诉学生和教辅" : "邀请码已停用,学生和教辅" %></p>
<p class="mb10">他们可以主动加入班级</p> <p class="mb10"><%= @course.invite_code_halt == 0 ? "他们可以主动加入班级" : "不可以主动加入班级了" %></p>
</div> </div>
<% end %> <% end %>

View File

@ -279,10 +279,19 @@
function delete_confirm(){ function delete_confirm(){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div><a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确&nbsp;&nbsp;定</a>'+ '<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div>'+
'<a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确&nbsp;&nbsp;定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
} }
function alert_halt_code(){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">邀请码停用后,用户不能主动加入该班级了</p><p class="text_c mt10 f14">您是否确认停用</p><div class="cl"></div>'+
'<a href="<%=set_invite_code_halt_course_path(@course) %>" class="fr sy_btn_blue mr135 mt10" data-remote="true">确&nbsp;&nbsp;定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>';
pop_box_new(htmlvalue, 400, 180);
}
</script> </script>
</html> </html>

View File

@ -1253,6 +1253,7 @@ RedmineApp::Application.routes.draw do
post 'add_members' post 'add_members'
get 'delete_member' get 'delete_member'
get 'archive_course' get 'archive_course'
get 'set_invite_code_halt'
end end
collection do collection do
match 'join_private_courses', :via => [:get, :post] match 'join_private_courses', :via => [:get, :post]

View File

@ -0,0 +1,5 @@
class AddColumnToCourse < ActiveRecord::Migration
def change
add_column :courses, :invite_code_halt, :integer, :limit => 1, :default => 0
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161128072528) do ActiveRecord::Schema.define(:version => 20161208015939) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -629,6 +629,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.string "invite_code" t.string "invite_code"
t.string "qrcode" t.string "qrcode"
t.integer "qrcode_expiretime", :default => 0 t.integer "qrcode_expiretime", :default => 0
t.integer "invite_code_halt", :limit => 1, :default => 0
end end
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
@ -820,11 +821,13 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.integer "exercise_status" t.integer "exercise_status"
t.integer "user_id" t.integer "user_id"
t.integer "time" t.integer "time"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.datetime "publish_time" t.datetime "publish_time"
t.datetime "end_time" t.datetime "end_time"
t.integer "show_result" t.integer "show_result"
t.integer "question_random", :default => 0
t.integer "choice_random", :default => 0
end end
create_table "first_pages", :force => true do |t| create_table "first_pages", :force => true do |t|
@ -864,6 +867,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "secret_key" t.string "secret_key"
t.integer "status" t.integer "status"
t.integer "operate_user_id"
end end
add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
@ -939,6 +943,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.integer "quotes", :default => 0 t.integer "quotes", :default => 0
t.integer "is_open", :default => 0 t.integer "is_open", :default => 0
t.datetime "simi_time" t.datetime "simi_time"
t.integer "score_open", :default => 1
end end
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
@ -964,6 +969,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.integer "homework_common_id" t.integer "homework_common_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "no_anon_penalty", :default => 1
end end
create_table "homework_detail_programings", :force => true do |t| create_table "homework_detail_programings", :force => true do |t|
@ -1538,6 +1544,12 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "professional_levels", :force => true do |t|
t.string "level"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "project_infos", :force => true do |t| create_table "project_infos", :force => true do |t|
t.integer "project_id" t.integer "project_id"
t.integer "user_id" t.integer "user_id"
@ -1628,8 +1640,11 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.integer "pull_request_id" t.integer "pull_request_id"
t.integer "gpid" t.integer "gpid"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "status", :default => 0
t.integer "project_id"
t.string "title"
end end
create_table "quality_analyses", :force => true do |t| create_table "quality_analyses", :force => true do |t|

View File

@ -1715,7 +1715,7 @@ function expand_course_list(id, target, btnid, count) {
//点击删除时的确认弹框 //点击删除时的确认弹框
function delete_confirm_box(url, str){ function delete_confirm_box(url, str){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f16">' + str + '</p><div class="cl"></div><a href="'+ url +'" class="fr sy_btn_blue mr10 mt10" data-remote="true">确定</a>'+ '<div class="clear mt15"><p class="text_c f16">' + str + '</p><div class="cl"></div><a href="'+ url +'" class="fr sy_btn_blue mt10" style="margin-right: 92px;" data-remote="true">确定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>'; '<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
} }

View File

@ -174,6 +174,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.mr100 {margin-right:100px !important;} .mr100 {margin-right:100px !important;}
.mr118 {margin-right:118px !important;} .mr118 {margin-right:118px !important;}
.mr130 {margin-right:130px;} .mr130 {margin-right:130px;}
.mr135 {margin-right:135px;}
.mr150 {margin-right:150px;} .mr150 {margin-right:150px;}
.mw15{margin:0 15px;} .mw15{margin:0 15px;}
.mr90 {margin-right:90px;} .mr90 {margin-right:90px;}
@ -673,6 +674,21 @@ a.sy_btn_grey_mini{
border-radius:3px; border-radius:3px;
} }
a:hover.sy_btn_grey_mini{ background: #c3c3c3;} a:hover.sy_btn_grey_mini{ background: #c3c3c3;}
a.btn_grey_mid{
display:inline-block;
color: #565656;
background: #eaeaea;
text-align: center;
font-size: 12px;
padding:0 10px;
height: 26px;
line-height: 26px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.btn_grey_mid{ background: #c8c8c8;}
a.sy_btn_green{ a.sy_btn_green{
display:inline-block; display:inline-block;
color: #fff; color: #fff;

View File

@ -289,11 +289,10 @@ a.sy_class_option:hover {
} }
.sy_class_id{ .sy_class_id{
width:94px; width:94px;
height:70px; height:94px;
border:1px solid #f1f1f1; border:1px solid #f1f1f1;
background:#fff; background:#fff;
text-align:center; text-align:center;
padding-top:24px;
} }
.sy_class_id p{ .sy_class_id p{
font-size:16px; font-size:16px;