Show More
Commit Description:
add grader list...
Commit Description:
add grader list
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@57 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
app/helpers/main_helper.rb
| 45 lines
| 1.1 KiB
| text/x-ruby
| RubyLexer
|
|
r0 | module MainHelper | ||
def format_short_time(time) | ||||
now = Time.now | ||||
st = '' | ||||
if (time.yday != now.yday) or | ||||
(time.year != now.year) | ||||
|
r21 | st = time.strftime("%x ") | ||
|
r0 | end | ||
st + time.strftime("%X") | ||||
end | ||||
def format_compiler_msg(sub) | ||||
<<cmpmsg | ||||
<div> | ||||
<div><a href="#" onClick="n = this.parentNode.parentNode.lastChild; | ||||
if(n.style.display == 'none') { n.style.display = 'block'; } | ||||
else {n.style.display ='none'; } return false;"> | ||||
Compiler message</a> (click to see)</div> | ||||
<div style="display: none"> | ||||
<div class="compilermsgbody" style="border: thin solid grey; margin: 2px"> | ||||
#{h(sub.compiler_message).gsub(/\n/,'<br/>')} | ||||
</div> | ||||
</div></div> | ||||
cmpmsg | ||||
end | ||||
def format_submission(sub, count) | ||||
|
r21 | msg = "#{count} submission(s)." | ||
|
r0 | if count>0 | ||
msg = msg + "Last on " + | ||||
format_short_time(sub.submitted_at) + ' ' + | ||||
|
r21 | link_to('[source]',{:action => 'get_source', :id => sub.id}) | ||
|
r0 | end | ||
|
r21 | msg += "<br/>" | ||
|
r0 | if sub!=nil and sub.graded_at!=nil | ||
msg = msg + 'Graded at ' + format_short_time(sub.graded_at) + ', score: '+ | ||||
sub.points.to_s + | ||||
' [' + sub.grader_comment + "]<br />" + | ||||
format_compiler_msg(sub) | ||||
end | ||||
msg | ||||
end | ||||
end | ||||