编程测试集的输入输出添加序号
This commit is contained in:
parent
ed9841c207
commit
072300331b
|
@ -228,7 +228,9 @@
|
|||
|
||||
<script id="t:test-answer-list" type="text/html">
|
||||
<div class="mt10">
|
||||
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" name="program[input][]"></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" name="program[output][]"></textarea>
|
||||
<label class="fl mt5" name="inputs_label"> </label>
|
||||
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" name="program[input][]"></textarea>
|
||||
<textarea class="InputBox W320 fl mr5" placeholder="测试输出" name="program[output][]"></textarea>
|
||||
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
|
||||
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
<%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3, "Java"=>4}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
|
||||
</select>
|
||||
</div>
|
||||
<div style="height: 320px; overflow-y:auto; width:730px;">
|
||||
<div style="height: 320px; overflow-y:auto; width:756px;">
|
||||
<% if edit_mode && homework.is_program_homework? %>
|
||||
<% homework.homework_tests.each_with_index do |test, index| %>
|
||||
<div class="mt10">
|
||||
<label class="fl mt5" name="inputs_label"><%=index+1 %> </label>
|
||||
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"><%= test.input %></textarea>
|
||||
<textarea class="InputBox W320 fl mr5" placeholder="测试输出" id="textarea_output_test"><%= test.output %></textarea>
|
||||
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
|
||||
|
@ -22,6 +23,7 @@
|
|||
<% end %>
|
||||
<% else %>
|
||||
<div class="mt10">
|
||||
<label class="fl mt5" name="inputs_label">1 </label>
|
||||
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"></textarea>
|
||||
<textarea class="InputBox W320 fl mr5" placeholder="测试输出" id="textarea_output_test"></textarea>
|
||||
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
|
||||
|
|
|
@ -151,7 +151,7 @@ $(function(){
|
|||
modal: true,
|
||||
autoOpen: false,
|
||||
dialogClass: 'BluePopupBox',
|
||||
minWidth: 753
|
||||
minWidth: 771
|
||||
});
|
||||
$('#BluePopupBox').parent().resizable("disable");
|
||||
$('#BluePopupBox').parent().removeClass("ui-state-disabled");
|
||||
|
@ -243,6 +243,10 @@ $(function(){
|
|||
$(this).parent('.mt10').after(html);
|
||||
var inputs = document.getElementsByName("program[input][]");
|
||||
var outputs = document.getElementsByName("program[output][]");
|
||||
var inputs_labels = document.getElementsByName("inputs_label");
|
||||
for(var j= 0; j<inputs_labels.length; j++){
|
||||
$(inputs_labels[j]).html(j + 1 + " " );
|
||||
}
|
||||
if (inputs.length == outputs.length) {
|
||||
for (var i=0; i<inputs.length; i++) {
|
||||
autoTextarea2(inputs[i], outputs[i]);
|
||||
|
|
Loading…
Reference in New Issue