Description:
merge
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r512:4a0989b96ef2 - - 8 files changed: 35 inserted, 4 deleted
@@ -80,6 +80,7 | |||
|
80 | 80 | when "ruby" then Rouge::Lexers::Ruby.new |
|
81 | 81 | when "python" then Rouge::Lexers::Python.new |
|
82 | 82 | when "java" then Rouge::Lexers::Java.new |
|
83 | + when "php" then Rouge::Lexers::PHP.new | |
|
83 | 84 | end |
|
84 | 85 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
85 | 86 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
@@ -89,8 +89,30 | |||
|
89 | 89 | render :action => 'edit' and return |
|
90 | 90 | end |
|
91 | 91 | end |
|
92 | + if params[:file] and params[:file].content_type != 'application/pdf' | |
|
93 | + flash[:notice] = 'Error: Uploaded file is not PDF' | |
|
94 | + render :action => 'edit' and return | |
|
95 | + end | |
|
92 | 96 | if @problem.update_attributes(params[:problem]) |
|
93 | 97 | flash[:notice] = 'Problem was successfully updated.' |
|
98 | + unless params[:file] == nil or params[:file] == '' | |
|
99 | + flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.' | |
|
100 | + out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}" | |
|
101 | + if not FileTest.exists? out_dirname | |
|
102 | + Dir.mkdir out_dirname | |
|
103 | + end | |
|
104 | + | |
|
105 | + out_filename = "#{out_dirname}/#{@problem.name}.pdf" | |
|
106 | + if FileTest.exists? out_filename | |
|
107 | + File.delete out_filename | |
|
108 | + end | |
|
109 | + | |
|
110 | + File.open(out_filename,"wb") do |file| | |
|
111 | + file.write(params[:file].read) | |
|
112 | + end | |
|
113 | + @problem.description_filename = "#{@problem.name}.pdf" | |
|
114 | + @problem.save | |
|
115 | + end | |
|
94 | 116 | redirect_to :action => 'show', :id => @problem |
|
95 | 117 | else |
|
96 | 118 | render :action => 'edit' |
@@ -2,6 +2,8 | |||
|
2 | 2 | %tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")} |
|
3 | 3 | %td.info{:align => "center"} |
|
4 | 4 | = submission_counter+1 |
|
5 | + %td.info{:align => "center"} | |
|
6 | + = link_to "##{submission.id}", controller: :graders, action: :submission, id: submission.id | |
|
5 | 7 | %td.info= format_short_time(submission.submitted_at) |
|
6 | 8 | %td.info{:align => "center"} |
|
7 | 9 | = link_to('[load]',{:action => 'source', :id => submission.id}) |
@@ -13,6 +13,7 | |||
|
13 | 13 | - if @submissions.length>0 |
|
14 | 14 | %table.info |
|
15 | 15 | %tr.info-head |
|
16 | + %th.info No. | |
|
16 | 17 | %th.info # |
|
17 | 18 | %th.info At |
|
18 | 19 | %th.info Source |
@@ -48,5 +48,7 | |||
|
48 | 48 | <p><label for="problem_url">URL</label><br/> |
|
49 | 49 | <%= text_field 'problem', 'url' %></p> |
|
50 | 50 | |
|
51 | + <p>Task PDF <%= file_field_tag 'file' %></p> | |
|
52 | + | |
|
51 | 53 | |
|
52 | 54 | <!--[eoform:problem]--> |
@@ -1,6 +1,6 | |||
|
1 | 1 | <h1>Editing problem</h1> |
|
2 | 2 | |
|
3 |
- <%= form_tag |
|
|
3 | + <%= form_tag({action: 'update', id: @problem},multipart: true) do %> | |
|
4 | 4 | <%= render :partial => 'form' %> |
|
5 | 5 | <%= submit_tag 'Edit' %> |
|
6 | 6 | <% end %> |
@@ -68,8 +68,9 | |||
|
68 | 68 | |
|
69 | 69 | <% for user in @users %> |
|
70 | 70 | <tr class="info-<%= cycle("odd","even") %>"> |
|
71 | + <td><%= link_to user.login, controller: :users, :action => 'profile', :id => user %></td> | |
|
71 | 72 | <% for column in User.content_columns %> |
|
72 | - <% if !@hidden_columns.index(column.name) %> | |
|
73 | + <% if !@hidden_columns.index(column.name) and column.name != 'login' %> | |
|
73 | 74 | <td><%=h user.send(column.name) %></td> |
|
74 | 75 | <% end %> |
|
75 | 76 | <% end %> |
@@ -3,7 +3,7 | |||
|
3 | 3 | |
|
4 | 4 | %script{:type=>"text/javascript"} |
|
5 | 5 | $(function () { |
|
6 |
- $('#submission_table').tablesorter({widgets: ['zebra' |
|
|
6 | + $('#submission_table').tablesorter({widgets: ['zebra']}); | |
|
7 | 7 | }); |
|
8 | 8 | |
|
9 | 9 | :css |
@@ -27,8 +27,9 | |||
|
27 | 27 | %tr |
|
28 | 28 | %th ID |
|
29 | 29 | %th Problem code |
|
30 | - %th Problem name | |
|
30 | + %th Problem full name | |
|
31 | 31 | %th Language |
|
32 | + %th Submitted at | |
|
32 | 33 | %th Result |
|
33 | 34 | %th Score |
|
34 | 35 | - if session[:admin] |
@@ -41,6 +42,7 | |||
|
41 | 42 | %td= s.problem.name |
|
42 | 43 | %td= s.problem.full_name |
|
43 | 44 | %td= s.language.pretty_name |
|
45 | + %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) | |
|
44 | 46 | %td.fix-width= s.grader_comment |
|
45 | 47 | %td= (s.points*100)/s.problem.full_score |
|
46 | 48 | - if session[:admin] |
You need to be logged in to leave comments.
Login now