编程作业的测试集修改和样例输入输出,应该始终允许老师和助教进行修改

This commit is contained in:
cxt 2017-03-24 17:30:26 +08:00
parent 1e4ac42b04
commit 2f5ee19737
3 changed files with 26 additions and 15 deletions

View File

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

View File

@ -368,6 +368,7 @@
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
<% end %>
<p id="modify_inputs_notice" class="mt3 fr none c_red mr10"></p>
<div class="cl"></div>
</div>
</div>

View File

@ -8,15 +8,13 @@
<% homework.homework_samples.each_with_index do |sample, index| %>
<div class="mt10" style="margin-left:57px;">
<label class="fl fontGrey2 mr10 mt5 w20" name="sample_inputs_label"><%= index+1 %>&nbsp;&nbsp;</label>
<textarea class="InputBox w547 fl mr5" placeholder="样例输入" name="sample[input][]" <%= not_allow_select ? 'disabled' : '' %>><%= sample.input %></textarea>
<% unless not_allow_select %>
<a href="javascript:void(0);" class="fl icon_add sample_icon_add" title="增加样例组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class="fl icon_remove sample_icon_remove" title="删除样例组"></a>
<% end %>
<textarea class="InputBox w547 fl mr5" placeholder="样例输入" name="sample[input][]"><%= sample.input %></textarea>
<a href="javascript:void(0);" class="fl icon_add sample_icon_add" title="增加样例组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class="fl icon_remove sample_icon_remove" title="删除样例组"></a>
<% end %>
<div class="cl"></div>
<textarea class="InputBox w547 fl ml30 mt10" placeholder="样例输出" name="sample[output][]" <%= not_allow_select ? 'disabled' : '' %>><%= sample.output %></textarea>
<textarea class="InputBox w547 fl ml30 mt10" placeholder="样例输出" name="sample[output][]"><%= sample.output %></textarea>
<div class="cl"></div>
</div>
<% end %>
@ -40,17 +38,16 @@
<span class="f12 c_red mt5 fr">温馨提示:您可以在发布作业后,在作业"模拟答题"中进行标准代码的检测。</span>
<div class="cl"></div>
<div id="input_boxes_div">
<% if edit_mode && homework.is_program_homework? %>
<% homework.homework_tests.each_with_index do |test, index| %>
<div class="mt10" style="margin-left:57px;">
<label class="fl fontGrey2 mr10 mt5 w20" name="inputs_label"><%= index+1 %>&nbsp;&nbsp;</label>
<textarea class="InputBox w265 fl mr10" placeholder="测试输入" name="program[input][]" <%= not_allow_select ? 'disabled' : '' %>><%= test.input %></textarea>
<textarea class="InputBox w265 fl mr5" placeholder="测试输出" name="program[output][]" <%= not_allow_select ? 'disabled' : '' %>><%= test.output %></textarea>
<% unless not_allow_select %>
<a href="javascript:void(0);" class=" fl icon_add test_icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove test_icon_remove" title="删除测试组"></a>
<% end %>
<textarea class="InputBox w265 fl mr10" placeholder="测试输入" name="program[input][]"><%= test.input %></textarea>
<textarea class="InputBox w265 fl mr5" placeholder="测试输出" name="program[output][]"><%= test.output %></textarea>
<a href="javascript:void(0);" class=" fl icon_add test_icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove test_icon_remove" title="删除测试组"></a>
<% end %>
<div class="cl"></div>
</div>
@ -65,6 +62,7 @@
<div class="cl"></div>
</div>
<% end %>
</div>
</div>
</div>
@ -74,6 +72,10 @@
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
<% if not_allow_select %>
$("#input_boxes_div .InputBox").on('focus', modify_input_notice);
<% end %>
$("#programHomework").on('click', 'a.test_icon_add', function () {
var html = bt('t:test-answer-list', null);
$(this).parent('.mt10').after(html);
@ -90,6 +92,9 @@
}
}
$(inputs[inputs.length - 1]).focus();
<% if not_allow_select %>
$("#input_boxes_div .InputBox").on('focus', modify_input_notice);
<% end %>
});
$("#programHomework").on('click', 'a.test_icon_remove', function () {
$(this).parent('.mt10').remove();
@ -152,4 +157,9 @@
}
}
<% end %>
function modify_input_notice(){
$("#modify_inputs_notice").html("修改测试集后请通知学生重新提交作品");
$("#modify_inputs_notice").show();
}
</script>