Description:
[web] fixed test page crashes when problem is deleted
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@193 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
r101:4a05c0a30468 - - 5 files changed: 28 inserted, 8 deleted
@@ -97,6 +97,15 | |||||
|
97 | redirect_to :action => 'list' |
|
97 | redirect_to :action => 'list' |
|
98 | end |
|
98 | end |
|
99 |
|
99 | ||
|
|
100 | + def turn_all_on | ||
|
|
101 | + Problem.find(:all, | ||
|
|
102 | + :conditions => "available = 0").each do |problem| | ||
|
|
103 | + problem.available = true | ||
|
|
104 | + problem.save | ||
|
|
105 | + end | ||
|
|
106 | + redirect_to :action => 'list' | ||
|
|
107 | + end | ||
|
|
108 | + | ||
|
100 | def stat |
|
109 | def stat |
|
101 | @problem = Problem.find(params[:id]) |
|
110 | @problem = Problem.find(params[:id]) |
|
102 | if !@problem.available |
|
111 | if !@problem.available |
@@ -6,8 +6,11 | |||||
|
6 |
|
6 | ||
|
7 | <h1>Listing problems</h1> |
|
7 | <h1>Listing problems</h1> |
|
8 |
|
8 | ||
|
|
9 | + <p> | ||
|
9 | <%= link_to 'New problem', :action => 'new' %> |
|
10 | <%= link_to 'New problem', :action => 'new' %> |
|
10 |
- <%= link_to 'Turn off all problems', :action => 'turn_all_off' %> |
|
11 | + <%= link_to 'Turn off all problems', :action => 'turn_all_off' %> |
|
|
12 | + <%= link_to 'Turn on all problems', :action => 'turn_all_on' %> | ||
|
|
13 | + </p> | ||
|
11 |
|
14 | ||
|
12 | <table> |
|
15 | <table> |
|
13 | <tr> |
|
16 | <tr> |
@@ -1,7 +1,11 | |||||
|
1 | %tr{:class => (test_request_counter%2==0) ? "info-even" : "info-odd"} |
|
1 | %tr{:class => (test_request_counter%2==0) ? "info-even" : "info-odd"} |
|
2 | %td{:align => "center"} |
|
2 | %td{:align => "center"} |
|
3 | = format_short_time(test_request.submitted_at) |
|
3 | = format_short_time(test_request.submitted_at) |
|
4 | - %td= test_request.problem.full_name |
|
4 | + %td |
|
|
5 | + - if test_request.problem!=nil | ||
|
|
6 | + = test_request.problem.full_name | ||
|
|
7 | + - else | ||
|
|
8 | + (n/a) | ||
|
5 | %td{:align => "center"} |
|
9 | %td{:align => "center"} |
|
6 | = test_request.submission.number |
|
10 | = test_request.submission.number |
|
7 | %td{:align => "center"} |
|
11 | %td{:align => "center"} |
@@ -1,7 +1,11 | |||||
|
1 | = user_title_bar(@user) |
|
1 | = user_title_bar(@user) |
|
2 |
|
2 | ||
|
3 | %div{:style => "text-align: center; font-size: 12px"} |
|
3 | %div{:style => "text-align: center; font-size: 12px"} |
|
4 | - = "Problem: #{@test_request.problem.full_name}" |
|
4 | + Problem: |
|
|
5 | + - if @test_request.problem!=nil | ||
|
|
6 | + = "#{@test_request.problem.full_name}" | ||
|
|
7 | + - else | ||
|
|
8 | + = "(n/a)" | ||
|
5 | %br/ |
|
9 | %br/ |
|
6 | = "Submission: #{@test_request.submission.number}" |
|
10 | = "Submission: #{@test_request.submission.number}" |
|
7 | %br/ |
|
11 | %br/ |
@@ -165,7 +165,7 | |||||
|
165 | margin-top: 10px; |
|
165 | margin-top: 10px; |
|
166 | margin-bottom: 10px; |
|
166 | margin-bottom: 10px; |
|
167 | background: green; |
|
167 | background: green; |
|
168 |
- padding: |
|
168 | + padding: 1px; |
|
169 | } |
|
169 | } |
|
170 |
|
170 | ||
|
171 | div.announcementbox span.title { |
|
171 | div.announcementbox span.title { |
@@ -177,17 +177,17 | |||||
|
177 | div.announcement { |
|
177 | div.announcement { |
|
178 | margin: 2px; |
|
178 | margin: 2px; |
|
179 | background: white; |
|
179 | background: white; |
|
180 |
- padding: |
|
180 | + padding: 1px; |
|
181 | padding-left: 10px; |
|
181 | padding-left: 10px; |
|
182 | padding-right: 10px; |
|
182 | padding-right: 10px; |
|
183 | } |
|
183 | } |
|
184 |
|
184 | ||
|
185 | div.announcement p { |
|
185 | div.announcement p { |
|
186 |
- font-size: 1 |
|
186 | + font-size: 12px; |
|
187 | } |
|
187 | } |
|
188 |
|
188 | ||
|
189 | div.pub-info, div.pub-info p { |
|
189 | div.pub-info, div.pub-info p { |
|
190 | text-align: right; |
|
190 | text-align: right; |
|
191 | font-style: italic; |
|
191 | font-style: italic; |
|
192 |
- font-size: |
|
192 | + font-size: 9px; |
|
193 | - } No newline at end of file |
|
193 | + } |
You need to be logged in to leave comments.
Login now