Description:
added codejom status view
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r220:3fd96d06658c - - 7 files changed: 151 inserted, 0 deleted
@@ -0,0 +1,24 | |||||
|
|
1 | + class StatusesController < ApplicationController | ||
|
|
2 | + | ||
|
|
3 | + def index | ||
|
|
4 | + problem_count = Problem.available_problem_count | ||
|
|
5 | + | ||
|
|
6 | + @dead_users = [] | ||
|
|
7 | + @level_users = {} | ||
|
|
8 | + @levels = (0..CODEJOM_MAX_ALIVE_LEVEL) | ||
|
|
9 | + @levels.each { |l| @level_users[l] = [] } | ||
|
|
10 | + User.find(:all).each do |user| | ||
|
|
11 | + if user.codejom_status==nil | ||
|
|
12 | + user.update_codejom_status | ||
|
|
13 | + user.codejom_status(true) # reload | ||
|
|
14 | + end | ||
|
|
15 | + | ||
|
|
16 | + if not user.codejom_status.alive | ||
|
|
17 | + @dead_users << user | ||
|
|
18 | + else | ||
|
|
19 | + @level_users[user.codejom_level] << user | ||
|
|
20 | + end | ||
|
|
21 | + end | ||
|
|
22 | + end | ||
|
|
23 | + | ||
|
|
24 | + end |
@@ -0,0 +1,17 | |||||
|
|
1 | + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
|
|
2 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
|
3 | + | ||
|
|
4 | + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
|
|
5 | + <head> | ||
|
|
6 | + <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | ||
|
|
7 | + <title>Users: <%= controller.action_name %></title> | ||
|
|
8 | + <%= stylesheet_link_tag 'status' %> | ||
|
|
9 | + </head> | ||
|
|
10 | + <body> | ||
|
|
11 | + | ||
|
|
12 | + <p style="color: green"><%= flash[:notice] %></p> | ||
|
|
13 | + | ||
|
|
14 | + <%= yield %> | ||
|
|
15 | + | ||
|
|
16 | + </body> | ||
|
|
17 | + </html> |
@@ -0,0 +1,17 | |||||
|
|
1 | + <h1>Thailand Code Jom</h1> | ||
|
|
2 | + | ||
|
|
3 | + <div id="dead-status"> | ||
|
|
4 | + <h2>Bye bye</h2> | ||
|
|
5 | + <% @dead_users.each do |user| %> | ||
|
|
6 | + <span class="user-label user-level-dead"><%= user.login %></span> | ||
|
|
7 | + <% end %> | ||
|
|
8 | + </div> | ||
|
|
9 | + <div id="alive-status"> | ||
|
|
10 | + <% @levels.each do |level| %> | ||
|
|
11 | + <div class="region region-level-<%= level %>"> | ||
|
|
12 | + <% @level_users[level].each do |user| %> | ||
|
|
13 | + <span class="user-label user-level-<%= level %>"><%= user.login %></span> | ||
|
|
14 | + <% end %> | ||
|
|
15 | + </div> | ||
|
|
16 | + <% end %> | ||
|
|
17 | + </div> |
@@ -0,0 +1,79 | |||||
|
|
1 | + h1 { | ||
|
|
2 | + height: 25px; | ||
|
|
3 | + color: black; | ||
|
|
4 | + text-align: center; | ||
|
|
5 | + } | ||
|
|
6 | + | ||
|
|
7 | + #dead-status { | ||
|
|
8 | + float: right; | ||
|
|
9 | + width: 200px; | ||
|
|
10 | + background: black; | ||
|
|
11 | + color: white; | ||
|
|
12 | + height: 1000px; | ||
|
|
13 | + padding: 10px; | ||
|
|
14 | + line-height: 30px; | ||
|
|
15 | + } | ||
|
|
16 | + | ||
|
|
17 | + .region { | ||
|
|
18 | + padding: 10px; | ||
|
|
19 | + text-align: center; | ||
|
|
20 | + line-height: 30px; | ||
|
|
21 | + } | ||
|
|
22 | + | ||
|
|
23 | + .region-level-0 { | ||
|
|
24 | + background: #f7f7ff; | ||
|
|
25 | + } | ||
|
|
26 | + .region-level-1 { | ||
|
|
27 | + background: #f0f0ff; | ||
|
|
28 | + } | ||
|
|
29 | + .region-level-2 { | ||
|
|
30 | + background: #e0e0f0; | ||
|
|
31 | + } | ||
|
|
32 | + .region-level-3 { | ||
|
|
33 | + background: #d0d0f0; | ||
|
|
34 | + } | ||
|
|
35 | + .region-level-4 { | ||
|
|
36 | + background: #c0c0d0; | ||
|
|
37 | + } | ||
|
|
38 | + .region-level-5 { | ||
|
|
39 | + background: #b0b0c0; | ||
|
|
40 | + } | ||
|
|
41 | + .region-level-6 { | ||
|
|
42 | + background: #a0a0b0; | ||
|
|
43 | + } | ||
|
|
44 | + .region-level-7 { | ||
|
|
45 | + background: #808090; | ||
|
|
46 | + } | ||
|
|
47 | + .region-level-8 { | ||
|
|
48 | + background: #606080; | ||
|
|
49 | + } | ||
|
|
50 | + .region-level-9 { | ||
|
|
51 | + background: #404080; | ||
|
|
52 | + } | ||
|
|
53 | + .region-level-10 { | ||
|
|
54 | + background: #202060; | ||
|
|
55 | + } | ||
|
|
56 | + | ||
|
|
57 | + .user-label { | ||
|
|
58 | + -moz-border-radius: 5px; | ||
|
|
59 | + color: white; | ||
|
|
60 | + font-weight: bold; | ||
|
|
61 | + padding-top: 2px; | ||
|
|
62 | + padding-bottom: 2px; | ||
|
|
63 | + padding-left: 20px; | ||
|
|
64 | + padding-right: 20px; | ||
|
|
65 | + margin: 2px; | ||
|
|
66 | + } | ||
|
|
67 | + | ||
|
|
68 | + .user-level-dead { background: #707070; color: black; } | ||
|
|
69 | + .user-level-0 { background: #a0a0ff; } | ||
|
|
70 | + .user-level-1 { background: #7070ff; } | ||
|
|
71 | + .user-level-2 { background: #6060ff; } | ||
|
|
72 | + .user-level-3 { background: #5050ff; } | ||
|
|
73 | + .user-level-4 { background: #5050e0; } | ||
|
|
74 | + .user-level-5 { background: #5050d0; } | ||
|
|
75 | + .user-level-6 { background: #4040d0; } | ||
|
|
76 | + .user-level-7 { background: #4040c0; } | ||
|
|
77 | + .user-level-8 { background: #4040b0; } | ||
|
|
78 | + .user-level-9 { background: #2020a0; } | ||
|
|
79 | + .user-level-10 { background: #202070; } |
You need to be logged in to leave comments.
Login now