Description:
[web] added compiler message and submission links to main/list
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@147 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r70:d6fd1806794c - - 4 files changed: 25 inserted, 3 deleted
@@ -0,0 +1,6 | |||||
|
|
1 | + %h2= "Compiler message for submission \##{@submission.number}, task: #{@submission.problem.name}" | ||
|
|
2 | + %p | ||
|
|
3 | + - if @submission.compiler_message.chomp == '' | ||
|
|
4 | + no message | ||
|
|
5 | + - else | ||
|
|
6 | + = simple_format(@submission.compiler_message) |
@@ -36,25 +36,35 | |||||
|
36 | prepare_list_information |
|
36 | prepare_list_information |
|
37 | render :action => 'list' and return |
|
37 | render :action => 'list' and return |
|
38 | end |
|
38 | end |
|
39 | redirect_to :action => 'list' |
|
39 | redirect_to :action => 'list' |
|
40 | end |
|
40 | end |
|
41 |
|
41 | ||
|
42 |
- def |
|
42 | + def source |
|
43 | submission = Submission.find(params[:id]) |
|
43 | submission = Submission.find(params[:id]) |
|
44 | if submission.user_id == session[:user_id] |
|
44 | if submission.user_id == session[:user_id] |
|
45 | fname = submission.problem.name + '.' + submission.language.ext |
|
45 | fname = submission.problem.name + '.' + submission.language.ext |
|
46 | send_data(submission.source, |
|
46 | send_data(submission.source, |
|
47 | {:filename => fname, |
|
47 | {:filename => fname, |
|
48 | :type => 'text/plain'}) |
|
48 | :type => 'text/plain'}) |
|
49 | else |
|
49 | else |
|
50 | flash[:notice] = 'Error viewing source' |
|
50 | flash[:notice] = 'Error viewing source' |
|
51 | redirect_to :action => 'list' |
|
51 | redirect_to :action => 'list' |
|
52 | end |
|
52 | end |
|
53 | end |
|
53 | end |
|
54 |
|
54 | ||
|
|
55 | + def compiler_msg | ||
|
|
56 | + @submission = Submission.find(params[:id]) | ||
|
|
57 | + if @submission.user_id == session[:user_id] | ||
|
|
58 | + render :action => 'compiler_msg', :layout => 'empty' | ||
|
|
59 | + else | ||
|
|
60 | + flash[:notice] = 'Error viewing source' | ||
|
|
61 | + redirect_to :action => 'list' | ||
|
|
62 | + end | ||
|
|
63 | + end | ||
|
|
64 | + | ||
|
55 | def submission |
|
65 | def submission |
|
56 | @user = User.find(session[:user_id]) |
|
66 | @user = User.find(session[:user_id]) |
|
57 | @problems = Problem.find_available_problems |
|
67 | @problems = Problem.find_available_problems |
|
58 | if params[:id]==nil |
|
68 | if params[:id]==nil |
|
59 | @problem = nil |
|
69 | @problem = nil |
|
60 | @submissions = nil |
|
70 | @submissions = nil |
@@ -8,9 +8,11 | |||||
|
8 | </td> |
|
8 | </td> |
|
9 | <td align="center"> |
|
9 | <td align="center"> |
|
10 | <%= @prob_submissions[problem_counter][:count] %> |
|
10 | <%= @prob_submissions[problem_counter][:count] %> |
|
11 | </td> |
|
11 | </td> |
|
12 | <td> |
|
12 | <td> |
|
13 | <%= render :partial => 'submission_short', |
|
13 | <%= render :partial => 'submission_short', |
|
14 | - :locals => { :submission => @prob_submissions[problem_counter][:submission]} %> |
|
14 | + :locals => { |
|
|
15 | + :submission => @prob_submissions[problem_counter][:submission], | ||
|
|
16 | + :problem_name => problem.name }%> | ||
|
15 | </td> |
|
17 | </td> |
|
16 | </tr> |
|
18 | </tr> |
@@ -7,7 +7,11 | |||||
|
7 | = format_short_time(submission.submitted_at) |
|
7 | = format_short_time(submission.submitted_at) |
|
8 | - else |
|
8 | - else |
|
9 | = "Graded at #{format_short_time(submission.graded_at)}, " |
|
9 | = "Graded at #{format_short_time(submission.graded_at)}, " |
|
10 | = "score: #{submission.points} " |
|
10 | = "score: #{submission.points} " |
|
11 | = " [" + submission.grader_comment + "]" |
|
11 | = " [" + submission.grader_comment + "]" |
|
12 | = " | " |
|
12 | = " | " |
|
13 |
- = link_to('[ |
|
13 | + = link_to('[msg]', {:action => 'compiler_msg', :id => submission.id}, {:popup => true}) |
|
|
14 | + = " | " | ||
|
|
15 | + = link_to('[source]',{:action => 'source', :id => submission.id}) | ||
|
|
16 | + = " | " | ||
|
|
17 | + = link_to '[submissions]', :action => 'submission', :id => problem_name |
You need to be logged in to leave comments.
Login now