Description:
[web] in problems, added turn_all_off, and improved ui git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@128 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r56:ae06afdcf005 - - 4 files changed: 71 inserted, 39 deleted

@@ -0,0 +1,8
1 +
2 + tr.available {
3 + background: #c0ffc0;
4 + }
5 +
6 + tr.not-available {
7 + background: #ffc0c0;
8 + }
@@ -60,11 +60,20
60 problem = Problem.find(params[:id])
60 problem = Problem.find(params[:id])
61 problem.available = !(problem.available)
61 problem.available = !(problem.available)
62 problem.save
62 problem.save
63 redirect_to :action => 'list'
63 redirect_to :action => 'list'
64 end
64 end
65
65
66 + def turn_all_off
67 + Problem.find(:all,
68 + :conditions => "available = 1").each do |problem|
69 + problem.available = false
70 + problem.save
71 + end
72 + redirect_to :action => 'list'
73 + end
74 +
66 def stat
75 def stat
67 @problem = Problem.find(params[:id])
76 @problem = Problem.find(params[:id])
68 @submissions = Submission.find_all_last_by_problem(params[:id])
77 @submissions = Submission.find_all_last_by_problem(params[:id])
69 end
78 end
70 end
79 end
@@ -1,30 +1,32
1 <% content_for :head do %>
1 <% content_for :head do %>
2 <%= stylesheet_link_tag 'scaffold' %>
2 <%= stylesheet_link_tag 'scaffold' %>
3 + <%= stylesheet_link_tag 'problems' %>
3 <%= javascript_include_tag :defaults %>
4 <%= javascript_include_tag :defaults %>
4 <% end %>
5 <% end %>
5
6
6 <h1>Listing problems</h1>
7 <h1>Listing problems</h1>
7
8
8 <div class="usermenu">
9 <div class="usermenu">
9 <%= link_to 'Main', :controller => 'main', :action => 'list' %>
10 <%= link_to 'Main', :controller => 'main', :action => 'list' %>
10 </div>
11 </div>
11
12
12 - <%= link_to 'New problem', :action => 'new' %><br/>
13 + <%= link_to 'New problem', :action => 'new' %>
14 + <%= link_to 'Turn off all problems', :action => 'turn_all_off' %><br/>
13
15
14 <table>
16 <table>
15 <tr>
17 <tr>
16 <th>Name</th>
18 <th>Name</th>
17 <th>Full name</th>
19 <th>Full name</th>
18 <th>Full score</th>
20 <th>Full score</th>
19 <th>Date added</th>
21 <th>Date added</th>
20 <th>Available</th>
22 <th>Available</th>
21 </tr>
23 </tr>
22
24
23 <% for problem in @problems %>
25 <% for problem in @problems %>
24 - <tr>
26 + <tr class="<%= (problem.available) ? "available" : "not-available" %>">
25 <% @problem=problem %>
27 <% @problem=problem %>
26 <td><%= in_place_editor_field :problem, :name, {}, :rows=>1 %>
28 <td><%= in_place_editor_field :problem, :name, {}, :rows=>1 %>
27 <td><%= in_place_editor_field :problem, :full_name, {}, :rows=>1 %>
29 <td><%= in_place_editor_field :problem, :full_name, {}, :rows=>1 %>
28 <td><%= in_place_editor_field :problem, :full_score, {}, :rows=>1 %>
30 <td><%= in_place_editor_field :problem, :full_score, {}, :rows=>1 %>
29 <td><%= problem.date_added %>
31 <td><%= problem.date_added %>
30 <td><%= problem.available %>
32 <td><%= problem.available %>
@@ -1,57 +1,28
1 + /* Normal text */
1 p {
2 p {
2 font-size: 12px;
3 font-size: 12px;
3 }
4 }
4
5
5 - div.title {
6 + /* This is the main menu bad*/
6 - font-size: 20px;
7 - font-weight: bold;
8 - background: lightgreen;
9 - padding: 2px;
10 - }
11 -
12 div.userbar {
7 div.userbar {
13 border-top: thin solid grey;
8 border-top: thin solid grey;
14 border-bottom: thin solid grey;
9 border-bottom: thin solid grey;
15 text-align: right;
10 text-align: right;
16 font-size: 12px;
11 font-size: 12px;
17 }
12 }
18
13
19 - div.compilermsgbody {
14 + /* This is the top bar, displaying user's full name */
20 - font-family: monospace;
15 + div.title {
21 - }
16 + font-size: 20px;
22 -
23 - div.submitbox {
24 - border: thin solid black;
25 - padding: 5px;
26 - color: white;
27 - background-color: #777777;
28 font-weight: bold;
17 font-weight: bold;
29 - font-size: 13px;
18 + background: lightgreen;
19 + padding: 2px;
30 }
20 }
31
21
32 - table.uinfo {
22 + /* Standard table with header and rows with alternating background */
33 - border-collapse: collapse;
34 - border: 1px solid black;
35 - font-size: 13px;
36 - }
37 -
38 - td.uinfo {
39 - vertical-align: top;
40 - border: 1px solid black;
41 - padding: 5px;
42 - }
43 -
44 - th.uinfo {
45 - background: lightgreen;
46 - vertical-align: top;
47 - text-align: right;
48 - border: 1px solid black;
49 - padding: 5px;
50 - }
51 -
52 table.info {
23 table.info {
53 border: 1px solid black;
24 border: 1px solid black;
54 border-collapse: collapse;
25 border-collapse: collapse;
55 font-size: 12px;
26 font-size: 12px;
56 }
27 }
57
28
@@ -74,12 +45,54
74 }
45 }
75
46
76 tr.info-even {
47 tr.info-even {
77 background: #f0f0f0;
48 background: #f0f0f0;
78 }
49 }
79
50
51 + /*******************************
52 + [Main]
53 + ********************************/
54 + div.submitbox {
55 + border: thin solid black;
56 + padding: 5px;
57 + color: white;
58 + background-color: #777777;
59 + font-weight: bold;
60 + font-size: 13px;
61 + }
62 +
63 + /*******************************
64 + [Settings]
65 + ********************************/
66 + table.uinfo {
67 + border-collapse: collapse;
68 + border: 1px solid black;
69 + font-size: 13px;
70 + }
71 +
72 + td.uinfo {
73 + vertical-align: top;
74 + border: 1px solid black;
75 + padding: 5px;
76 + }
77 +
78 + th.uinfo {
79 + background: lightgreen;
80 + vertical-align: top;
81 + text-align: right;
82 + border: 1px solid black;
83 + padding: 5px;
84 + }
85 +
86 + /*******************************
87 + [Submission]
88 + ********************************/
89 + div.compilermsgbody {
90 + font-family: monospace;
91 + }
92 +
80 div.task-menu {
93 div.task-menu {
81 text-align: center;
94 text-align: center;
82 font-size: 13px;
95 font-size: 13px;
83 font-weight: bold;
96 font-weight: bold;
84 border-top: 1px solid black;
97 border-top: 1px solid black;
85 border-bottom: 1px solid black;
98 border-bottom: 1px solid black;
You need to be logged in to leave comments. Login now