已提交作品的分组作业可扩大分组范围

This commit is contained in:
cxt 2016-09-29 17:17:17 +08:00
parent fc78ba3c68
commit 17c82c5291
3 changed files with 29 additions and 7 deletions

View File

@ -47,7 +47,7 @@
<% elsif @homework.homework_type == 2 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。</p>
<% elsif @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置。</p>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。</p>
<% end %>
<% elsif stu_pro_count != 0 && @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。</p>

View File

@ -1,10 +1,10 @@
<div id="groupHomework">
<div> <span class="f14 mt5 fl fontGrey3 mr10">分组设置:</span>
<div class="mr50 fl"> <span class="f14 fontGrey3 mr5">每组最小人数:</span>
<input id="min_num" type="text" name="min_num" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.min_num : 2 %>" <%=not_allow_select ? 'disabled' : '' %>/>人
<input id="min_num" type="text" name="min_num" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.min_num : 2 %>" <%=not_allow_select ? "onchange = regex_scope(#{homework.homework_detail_group.min_num}, 1)" : '' %>/>人
</div>
<div class="fl"> <span class="f14 fontGrey3 mr5">每组最大人数:</span>
<input id="max_num" type="text" name="max_num" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.max_num : 10 %>" <%=not_allow_select ? 'disabled' : '' %>/>人
<input id="max_num" type="text" name="max_num" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.max_num : 10 %>" <%=not_allow_select ? "onchange = regex_scope(#{homework.homework_detail_group.max_num}, 2)" : '' %>/>人
</div>
<span class="c_red undis ml20 mt7 fl" id="min_max_num_notice"></span>
<div class="cl"></div>
@ -21,7 +21,29 @@
<div class="cl"></div>
<script>
if($.trim($("#base_on_project").val()) == 1) {
$("#base_on_project").attr('checked','checked');
}
$(function () {
if($.trim($("#base_on_project").val()) == 1) {
$("#base_on_project").attr('checked','checked');
}
<% if not_allow_select %>
$("#min_num").on('change', function() {
var min_num = <%=homework.homework_detail_group.min_num %>;
if(parseInt($(this).val()) > min_num) {
$(this).val(min_num);
$("#min_max_num_notice").html('分组范围不可缩小').show();
} else {
$("#min_max_num_notice").html('').hide();
}
});
$("#max_num").on('change', function() {
var max_num = <%=homework.homework_detail_group.max_num %>;
if(parseInt($(this).val()) < max_num) {
$(this).val(max_num);
$("#min_max_num_notice").html('分组范围不可缩小').show();
} else {
$("#min_max_num_notice").html('').hide();
}
});
<% end %>
});
</script>

View File

@ -7,7 +7,7 @@
var first_click = true;
$(function(){
$("#homework_type_option").on("change",function(){
var type = $(this).children('option:selected').val()
var type = $(this).children('option:selected').val();
if(type == "1"){
$("#homeworkSetting").addClass("undis");
$("#homeworkSetting").html("");