Show More
Commit Description:
[web] better user_stat...
Commit Description:
[web] better user_stat
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@138 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
app/views/test/index.html.erb
| 73 lines
| 1.7 KiB
| text/plain
| TextLexer
|
|
r44 | <h2>Test Interface</h2> | ||
<% if @problems.length==0 %> | ||||
There is no submission | ||||
<% else %> | ||||
<script type="text/javascript"> | ||||
var submissionCount = { | ||||
<% @submissions.each do |submission| %> | ||||
<%= submission.problem_id %> : <%= submission.number %>, | ||||
<% end %> | ||||
}; | ||||
function updateSubmissionList() { | ||||
currentProb = document.getElementById("test_request_problem_id").value; | ||||
count = submissionCount[currentProb]; | ||||
submissionSelect = document.getElementById("test_request_submission_number"); | ||||
submissionSelect.options.length = 0; | ||||
for(i=0; i<count; i++) { | ||||
submissionSelect.options[i] = new Option(""+(i+1),""+(i+1),false,false); | ||||
} | ||||
} | ||||
</script> | ||||
<% form_for :test_request, nil, | ||||
:url => { :action => 'submit'}, | ||||
:html => { :multipart => true } do |f| %> | ||||
<table> | ||||
<tr> | ||||
<td>Task:</td> | ||||
<td> | ||||
<%= select(:test_request, | ||||
:problem_id, | ||||
@problems.collect {|p| [p.name, p.id]}, {}, | ||||
{ :onclick => "updateSubmissionList();" }) %> | ||||
</td> | ||||
</tr> | ||||
<tr> | ||||
<td>Submission:</td> | ||||
<td> | ||||
<%= select(:test_request, | ||||
:submission_number, | ||||
|
r51 | ((1..@submissions[0].number).collect {|n| [n,n]}).reverse) %> | ||
|
r44 | </td> | ||
</tr> | ||||
<tr> | ||||
<td>Input data:</td> | ||||
<td><%= f.file_field :input_file %></td> | ||||
<tr> | ||||
<td colspan="2"> | ||||
<%= submit_tag 'submit' %> | ||||
</td> | ||||
</tr> | ||||
</table> | ||||
<% end %> | ||||
<h3>Previous requests</h3> | ||||
|
r51 | <table class="info"> | ||
<tr class="info-head"> | ||||
|
r57 | <th></td> | ||
<th>problem</th> | ||||
<th>#</th> | ||||
<th>status</th> | ||||
<th>running stat</th> | ||||
<th>output (first 2kb)</th> | ||||
<th>grading comment</th> | ||||
<th>compiler message</th> | ||||
|
r44 | </tr> | ||
|
r51 | <%= render :partial => 'test_request', :collection => @user.test_requests %> | ||
|
r44 | </table> | ||
<% end %> | ||||