Description:
merge feature from java, including
* user profile page
* combine user_stat with user_stat_max
* add jquery plugin tablesorter that sorts table
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r433:a8fd17f1561a - - 16 files changed: 375 inserted, 71 deleted
@@ -0,0 +1,197 | |||||
|
|
1 | + /************* | ||
|
|
2 | + Metro Dark Theme | ||
|
|
3 | + *************/ | ||
|
|
4 | + /* overall */ | ||
|
|
5 | + .tablesorter-cafe { | ||
|
|
6 | + // font: 12px/18px 'Segoe UI Semilight', 'Open Sans', Verdana, Arial, Helvetica, sans-serif; | ||
|
|
7 | + color: #000; | ||
|
|
8 | + background-color: #777; | ||
|
|
9 | + margin: 10px 0 15px; | ||
|
|
10 | + text-align: left; | ||
|
|
11 | + border-collapse: collapse; | ||
|
|
12 | + border: #555 1px solid; | ||
|
|
13 | + } | ||
|
|
14 | + | ||
|
|
15 | + .tablesorter-cafe tr.dark-row th, .tablesorter-cafe tr.dark-row td { | ||
|
|
16 | + background-color: #222; | ||
|
|
17 | + color: #fff; | ||
|
|
18 | + text-align: left; | ||
|
|
19 | + font-size: 14px; | ||
|
|
20 | + } | ||
|
|
21 | + | ||
|
|
22 | + /* header/footer */ | ||
|
|
23 | + .tablesorter-cafe caption, | ||
|
|
24 | + .tablesorter-cafe th, | ||
|
|
25 | + .tablesorter-cafe thead td, | ||
|
|
26 | + .tablesorter-cafe tfoot th, | ||
|
|
27 | + .tablesorter-cafe tfoot td { | ||
|
|
28 | + //font-weight: 300; | ||
|
|
29 | + //font-size: 15px; | ||
|
|
30 | + color: #fff; | ||
|
|
31 | + background-color: #777; | ||
|
|
32 | + padding: 2px; | ||
|
|
33 | + border: #555 1px solid; | ||
|
|
34 | + } | ||
|
|
35 | + | ||
|
|
36 | + .tablesorter-cafe .header, | ||
|
|
37 | + .tablesorter-cafe .tablesorter-header { | ||
|
|
38 | + background-image: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAQBAMAAADQT4M0AAAAGFBMVEUAAADu7u7u7u7u7u7u7u7u7u7u7u7u7u5jNePWAAAACHRSTlMAMxIHKwEgMWD59H4AAABSSURBVAjXY2BgYFJgAAHzYhDJ6igSAKTYBAUTgJSioKAQAwNzoaCguAFDiCAQuDIkgigxBgiA8cJAVCpQt6AgSL+JoKAzA0gjUBsQqBcBCYhFAAE/CV4zeSzxAAAAAElFTkSuQmCC); | ||
|
|
39 | + background-position: center right; | ||
|
|
40 | + background-repeat: no-repeat; | ||
|
|
41 | + cursor: pointer; | ||
|
|
42 | + white-space: normal; | ||
|
|
43 | + } | ||
|
|
44 | + .tablesorter-cafe .tablesorter-header-inner { | ||
|
|
45 | + padding: 0 18px 0 4px; | ||
|
|
46 | + } | ||
|
|
47 | + .tablesorter-cafe thead .headerSortUp, | ||
|
|
48 | + .tablesorter-cafe thead .tablesorter-headerSortUp, | ||
|
|
49 | + .tablesorter-cafe thead .tablesorter-headerAsc { | ||
|
|
50 | + background-image: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAQBAMAAADQT4M0AAAAIVBMVEUAAADu7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u5meJAOAAAACnRSTlMAMwsqXt+gIBUGxGoDMAAAAFlJREFUCNctzC0SQAAUReEzGNQ3AlHRiSRZFCVZYgeswRL8hLdK7834wj3tAlGP6y7fYHpKS6w6WwbVG0I1NZVnZPG8/DYxOYlnhUYkA06R1s9ESsxR4NIdPhkPFDFYuEnMAAAAAElFTkSuQmCC); | ||
|
|
51 | + } | ||
|
|
52 | + .tablesorter-cafe thead .headerSortDown, | ||
|
|
53 | + .tablesorter-cafe thead .tablesorter-headerSortDown, | ||
|
|
54 | + .tablesorter-cafe thead .tablesorter-headerDesc { | ||
|
|
55 | + background-image: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAQBAMAAADQT4M0AAAALVBMVEUAAADu7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7i0NViAAAADnRSTlMAMiweCQITTvDctZZqaTlM310AAABcSURBVAjXY2BgYEtgAAFHERDJqigUAKSYBQUNgFSioKAYAwOLIBA4MASBKFUGQxAlzAAF+94BwWuGKBC1lIFl3rt3Lx0YGCzevWsGSjK9e6cAUlT3HKyW9wADAwDRrBiDy6bKzwAAAABJRU5ErkJggg==); | ||
|
|
56 | + } | ||
|
|
57 | + .tablesorter-cafe thead .sorter-false { | ||
|
|
58 | + background-image: none; | ||
|
|
59 | + cursor: default; | ||
|
|
60 | + padding: 4px; | ||
|
|
61 | + } | ||
|
|
62 | + | ||
|
|
63 | + /* tbody */ | ||
|
|
64 | + .tablesorter-cafe td { | ||
|
|
65 | + background-color: #fff; | ||
|
|
66 | + padding: 1px 4px; | ||
|
|
67 | + vertical-align: top; | ||
|
|
68 | + border-style: solid; | ||
|
|
69 | + border-color: #666; | ||
|
|
70 | + border-collapse: collapse; | ||
|
|
71 | + border-width: 0px 1px; | ||
|
|
72 | + | ||
|
|
73 | + } | ||
|
|
74 | + | ||
|
|
75 | + /* hovered row colors */ | ||
|
|
76 | + .tablesorter-cafe tbody > tr:hover > td, | ||
|
|
77 | + .tablesorter-cafe tbody > tr.even:hover > td, | ||
|
|
78 | + .tablesorter-cafe tbody > tr.odd:hover > td { | ||
|
|
79 | + background: #bbb; | ||
|
|
80 | + color: #000; | ||
|
|
81 | + } | ||
|
|
82 | + | ||
|
|
83 | + /* table processing indicator */ | ||
|
|
84 | + .tablesorter-cafe .tablesorter-processing { | ||
|
|
85 | + background-position: center center !important; | ||
|
|
86 | + background-repeat: no-repeat !important; | ||
|
|
87 | + /* background-image: url(../addons/pager/icons/loading.gif) !important; */ | ||
|
|
88 | + background-image: url(data:image/gif;base64,R0lGODlhFAAUAKEAAO7u7lpaWgAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgACACwAAAAAFAAUAAACQZRvoIDtu1wLQUAlqKTVxqwhXIiBnDg6Y4eyx4lKW5XK7wrLeK3vbq8J2W4T4e1nMhpWrZCTt3xKZ8kgsggdJmUFACH5BAEKAAIALAcAAAALAAcAAAIUVB6ii7jajgCAuUmtovxtXnmdUAAAIfkEAQoAAgAsDQACAAcACwAAAhRUIpmHy/3gUVQAQO9NetuugCFWAAAh+QQBCgACACwNAAcABwALAAACE5QVcZjKbVo6ck2AF95m5/6BSwEAIfkEAQoAAgAsBwANAAsABwAAAhOUH3kr6QaAcSrGWe1VQl+mMUIBACH5BAEKAAIALAIADQALAAcAAAIUlICmh7ncTAgqijkruDiv7n2YUAAAIfkEAQoAAgAsAAAHAAcACwAAAhQUIGmHyedehIoqFXLKfPOAaZdWAAAh+QQFCgACACwAAAIABwALAAACFJQFcJiXb15zLYRl7cla8OtlGGgUADs=) !important; | ||
|
|
89 | + } | ||
|
|
90 | + | ||
|
|
91 | + /* pager */ | ||
|
|
92 | + .tablesorter-cafe .tablesorter-pager button { | ||
|
|
93 | + background-color: #444; | ||
|
|
94 | + color: #eee; | ||
|
|
95 | + border: #555 1px solid; | ||
|
|
96 | + cursor: pointer; | ||
|
|
97 | + } | ||
|
|
98 | + .tablesorter-cafe .tablesorter-pager button:hover { | ||
|
|
99 | + background-color: #555; | ||
|
|
100 | + } | ||
|
|
101 | + | ||
|
|
102 | + /* Zebra Widget - row alternating colors */ | ||
|
|
103 | + .tablesorter-cafe tr.odd td { | ||
|
|
104 | + background-color: #eee; | ||
|
|
105 | + } | ||
|
|
106 | + .tablesorter-cafe tr.even td { | ||
|
|
107 | + background-color: #fff; | ||
|
|
108 | + } | ||
|
|
109 | + | ||
|
|
110 | + /* Column Widget - column sort colors */ | ||
|
|
111 | + .tablesorter-cafe tr.odd td.primary { | ||
|
|
112 | + background-color: #bfbfbf; | ||
|
|
113 | + } | ||
|
|
114 | + .tablesorter-cafe td.primary, | ||
|
|
115 | + .tablesorter-cafe tr.even td.primary { | ||
|
|
116 | + background-color: #d9d9d9; | ||
|
|
117 | + } | ||
|
|
118 | + .tablesorter-cafe tr.odd td.secondary { | ||
|
|
119 | + background-color: #d9d9d9; | ||
|
|
120 | + } | ||
|
|
121 | + .tablesorter-cafe td.secondary, | ||
|
|
122 | + .tablesorter-cafe tr.even td.secondary { | ||
|
|
123 | + background-color: #e6e6e6; | ||
|
|
124 | + } | ||
|
|
125 | + .tablesorter-cafe tr.odd td.tertiary { | ||
|
|
126 | + background-color: #e6e6e6; | ||
|
|
127 | + } | ||
|
|
128 | + .tablesorter-cafe td.tertiary, | ||
|
|
129 | + .tablesorter-cafe tr.even td.tertiary { | ||
|
|
130 | + background-color: #f2f2f2; | ||
|
|
131 | + } | ||
|
|
132 | + | ||
|
|
133 | + /* filter widget */ | ||
|
|
134 | + .tablesorter-cafe .tablesorter-filter-row td { | ||
|
|
135 | + background: #eee; | ||
|
|
136 | + line-height: normal; | ||
|
|
137 | + text-align: center; /* center the input */ | ||
|
|
138 | + -webkit-transition: line-height 0.1s ease; | ||
|
|
139 | + -moz-transition: line-height 0.1s ease; | ||
|
|
140 | + -o-transition: line-height 0.1s ease; | ||
|
|
141 | + transition: line-height 0.1s ease; | ||
|
|
142 | + } | ||
|
|
143 | + /* optional disabled input styling */ | ||
|
|
144 | + .tablesorter-cafe .tablesorter-filter-row .disabled { | ||
|
|
145 | + opacity: 0.5; | ||
|
|
146 | + filter: alpha(opacity=50); | ||
|
|
147 | + cursor: not-allowed; | ||
|
|
148 | + } | ||
|
|
149 | + /* hidden filter row */ | ||
|
|
150 | + .tablesorter-cafe .tablesorter-filter-row.hideme td { | ||
|
|
151 | + /*** *********************************************** ***/ | ||
|
|
152 | + /*** change this padding to modify the thickness ***/ | ||
|
|
153 | + /*** of the closed filter row (height = padding x 2) ***/ | ||
|
|
154 | + padding: 2px; | ||
|
|
155 | + /*** *********************************************** ***/ | ||
|
|
156 | + margin: 0; | ||
|
|
157 | + line-height: 0; | ||
|
|
158 | + cursor: pointer; | ||
|
|
159 | + } | ||
|
|
160 | + .tablesorter-cafe .tablesorter-filter-row.hideme .tablesorter-filter { | ||
|
|
161 | + height: 1px; | ||
|
|
162 | + min-height: 0; | ||
|
|
163 | + border: 0; | ||
|
|
164 | + padding: 0; | ||
|
|
165 | + margin: 0; | ||
|
|
166 | + /* don't use visibility: hidden because it disables tabbing */ | ||
|
|
167 | + opacity: 0; | ||
|
|
168 | + filter: alpha(opacity=0); | ||
|
|
169 | + } | ||
|
|
170 | + /* filters */ | ||
|
|
171 | + .tablesorter-cafe .tablesorter-filter { | ||
|
|
172 | + width: 95%; | ||
|
|
173 | + height: auto; | ||
|
|
174 | + margin: 4px; | ||
|
|
175 | + padding: 4px; | ||
|
|
176 | + background-color: #fff; | ||
|
|
177 | + border: 1px solid #bbb; | ||
|
|
178 | + color: #333; | ||
|
|
179 | + -webkit-box-sizing: border-box; | ||
|
|
180 | + -moz-box-sizing: border-box; | ||
|
|
181 | + box-sizing: border-box; | ||
|
|
182 | + -webkit-transition: height 0.1s ease; | ||
|
|
183 | + -moz-transition: height 0.1s ease; | ||
|
|
184 | + -o-transition: height 0.1s ease; | ||
|
|
185 | + transition: height 0.1s ease; | ||
|
|
186 | + } | ||
|
|
187 | + /* rows hidden by filtering (needed for child rows) */ | ||
|
|
188 | + .tablesorter .filtered { | ||
|
|
189 | + display: none; | ||
|
|
190 | + } | ||
|
|
191 | + | ||
|
|
192 | + /* ajax error row */ | ||
|
|
193 | + .tablesorter .tablesorter-errorRow td { | ||
|
|
194 | + text-align: center; | ||
|
|
195 | + cursor: pointer; | ||
|
|
196 | + background-color: #e6bf99; | ||
|
|
197 | + } |
@@ -0,0 +1,54 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'new' | ||
|
|
3 | + = stylesheet_link_tag 'tablesorter-theme.cafe' | ||
|
|
4 | + | ||
|
|
5 | + %script{:type=>"text/javascript"} | ||
|
|
6 | + $(function () { | ||
|
|
7 | + $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
8 | + $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
9 | + $('#my_table').tablesorter({widgets: ['zebra']}); | ||
|
|
10 | + }); | ||
|
|
11 | + | ||
|
|
12 | + %h1 User grading results | ||
|
|
13 | + %h2= params[:action] == 'user_stat' ? "Show scores from latest submission" : "Show max scores in submission range" | ||
|
|
14 | + | ||
|
|
15 | + | ||
|
|
16 | + - if @problem and @problem.errors | ||
|
|
17 | + =error_messages_for 'problem' | ||
|
|
18 | + | ||
|
|
19 | + = render partial: 'submission_range' | ||
|
|
20 | + | ||
|
|
21 | + - if params[:action] == 'user_stat' | ||
|
|
22 | + = "latest score" | ||
|
|
23 | + - else | ||
|
|
24 | + = link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat | ||
|
|
25 | + | ||
|
|
26 | + %table.tablesorter-cafe#my_table | ||
|
|
27 | + %thead | ||
|
|
28 | + %tr | ||
|
|
29 | + %th User | ||
|
|
30 | + %th Name | ||
|
|
31 | + %th Activated? | ||
|
|
32 | + %th Logged in | ||
|
|
33 | + %th Contest(s) | ||
|
|
34 | + - @problems.each do |p| | ||
|
|
35 | + %th= p.name | ||
|
|
36 | + %th Total | ||
|
|
37 | + %th Passed | ||
|
|
38 | + %tbody | ||
|
|
39 | + - @scorearray.each do |sc| | ||
|
|
40 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
41 | + - total,num_passed = 0,0 | ||
|
|
42 | + - sc.each_index do |i| | ||
|
|
43 | + - if i == 0 | ||
|
|
44 | + %td= link_to sc[i].login, controller: 'users', action: 'profile', id: sc[i] | ||
|
|
45 | + %td= sc[i].full_name | ||
|
|
46 | + %td= sc[i].activated | ||
|
|
47 | + %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' | ||
|
|
48 | + %td= sc[i].contests.collect {|c| c.name}.join(', ') | ||
|
|
49 | + - else | ||
|
|
50 | + %td= sc[i][0] | ||
|
|
51 | + - total += sc[i][0] | ||
|
|
52 | + - num_passed += 1 if sc[i][1] | ||
|
|
53 | + %td= total | ||
|
|
54 | + %td= num_passed |
@@ -0,0 +1,40 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'new' | ||
|
|
3 | + | ||
|
|
4 | + %script{:type=>"text/javascript"} | ||
|
|
5 | + $(function () { | ||
|
|
6 | + $('#submission_table').tablesorter({widgets: ['zebra','filter']}); | ||
|
|
7 | + }); | ||
|
|
8 | + | ||
|
|
9 | + %h1= @user.full_name + ' Profile' | ||
|
|
10 | + | ||
|
|
11 | + %h2 Basic info | ||
|
|
12 | + <b>Login:</b> #{@user.login} <br/> | ||
|
|
13 | + <b>Full name:</b> #{@user.full_name} <br /> | ||
|
|
14 | + | ||
|
|
15 | + | ||
|
|
16 | + %h2 Problem Stat | ||
|
|
17 | + | ||
|
|
18 | + %h2 Submissions | ||
|
|
19 | + | ||
|
|
20 | + %table.tablesorter-cafe#submission_table | ||
|
|
21 | + %thead | ||
|
|
22 | + %tr | ||
|
|
23 | + %th ID | ||
|
|
24 | + %th Problem code | ||
|
|
25 | + %th Problem name | ||
|
|
26 | + %th Language | ||
|
|
27 | + %th Result | ||
|
|
28 | + %th Score | ||
|
|
29 | + %tbody | ||
|
|
30 | + - @submission.each do |s| | ||
|
|
31 | + %tr | ||
|
|
32 | + %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id | ||
|
|
33 | + %td= s.problem.name | ||
|
|
34 | + %td= s.problem.full_name | ||
|
|
35 | + %td= s.language.pretty_name | ||
|
|
36 | + %td{style: 'font-family: Droid Sans Mono,Consolas, monospace, mono'}= s.grader_comment | ||
|
|
37 | + %td= s.points/s.problem.full_score * 100 | ||
|
|
38 | + | ||
|
|
39 | + | ||
|
|
40 | + |
@@ -1,19 +1,26 | |||||
|
1 | # See http://help.github.com/ignore-files/ for more about ignoring files. |
|
1 | # See http://help.github.com/ignore-files/ for more about ignoring files. |
|
2 | # |
|
2 | # |
|
3 | # If you find yourself ignoring temporary files generated by your text editor |
|
3 | # If you find yourself ignoring temporary files generated by your text editor |
|
4 | # or operating system, you probably want to add a global ignore instead: |
|
4 | # or operating system, you probably want to add a global ignore instead: |
|
5 | # git config --global core.excludesfile ~/.gitignore_global |
|
5 | # git config --global core.excludesfile ~/.gitignore_global |
|
6 |
|
6 | ||
|
7 | # Ignore bundler config |
|
7 | # Ignore bundler config |
|
8 | /.bundle |
|
8 | /.bundle |
|
9 |
|
9 | ||
|
10 | # Ignore the default SQLite database. |
|
10 | # Ignore the default SQLite database. |
|
11 | /db/*.sqlite3 |
|
11 | /db/*.sqlite3 |
|
12 |
|
12 | ||
|
13 | # Ignore all logfiles and tempfiles. |
|
13 | # Ignore all logfiles and tempfiles. |
|
14 | /log/*.log |
|
14 | /log/*.log |
|
15 | /tmp |
|
15 | /tmp |
|
16 |
|
16 | ||
|
17 | *~ |
|
17 | *~ |
|
18 |
|
18 | ||
|
19 | /vendor/plugins/rails_upgrade |
|
19 | /vendor/plugins/rails_upgrade |
|
|
20 | + | ||
|
|
21 | + #ignore public assets??? | ||
|
|
22 | + /public/assets | ||
|
|
23 | + | ||
|
|
24 | + #ignore .orig and .swp | ||
|
|
25 | + *.orig | ||
|
|
26 | + *.swp |
@@ -1,58 +1,60 | |||||
|
1 | source 'https://rubygems.org' |
|
1 | source 'https://rubygems.org' |
|
2 |
|
2 | ||
|
3 | gem 'rails', '3.2.19' |
|
3 | gem 'rails', '3.2.19' |
|
4 |
|
4 | ||
|
5 | # Bundle edge Rails instead: |
|
5 | # Bundle edge Rails instead: |
|
6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
7 |
|
7 | ||
|
8 | gem 'mysql2' |
|
8 | gem 'mysql2' |
|
9 |
|
9 | ||
|
10 | # Gems used only for assets and not required |
|
10 | # Gems used only for assets and not required |
|
11 | # in production environments by default. |
|
11 | # in production environments by default. |
|
12 | group :assets do |
|
12 | group :assets do |
|
13 | gem 'sass-rails', '~> 3.2.3' |
|
13 | gem 'sass-rails', '~> 3.2.3' |
|
14 | gem 'coffee-rails', '~> 3.2.1' |
|
14 | gem 'coffee-rails', '~> 3.2.1' |
|
15 |
|
15 | ||
|
16 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes |
|
16 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes |
|
17 | # gem 'therubyracer', :platforms => :ruby |
|
17 | # gem 'therubyracer', :platforms => :ruby |
|
18 |
|
18 | ||
|
19 | gem 'uglifier', '>= 1.0.3' |
|
19 | gem 'uglifier', '>= 1.0.3' |
|
20 | end |
|
20 | end |
|
21 |
|
21 | ||
|
22 | gem 'prototype-rails' |
|
22 | gem 'prototype-rails' |
|
23 |
|
23 | ||
|
24 | # To use ActiveModel has_secure_password |
|
24 | # To use ActiveModel has_secure_password |
|
25 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
25 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
26 |
|
26 | ||
|
27 | # To use Jbuilder templates for JSON |
|
27 | # To use Jbuilder templates for JSON |
|
28 | # gem 'jbuilder' |
|
28 | # gem 'jbuilder' |
|
29 |
|
29 | ||
|
30 | # Use unicorn as the app server |
|
30 | # Use unicorn as the app server |
|
31 | # gem 'unicorn' |
|
31 | # gem 'unicorn' |
|
32 |
|
32 | ||
|
33 | # Deploy with Capistrano |
|
33 | # Deploy with Capistrano |
|
34 | # gem 'capistrano' |
|
34 | # gem 'capistrano' |
|
35 |
|
35 | ||
|
36 | # To use debugger |
|
36 | # To use debugger |
|
37 | # gem 'debugger' |
|
37 | # gem 'debugger' |
|
38 | # |
|
38 | # |
|
39 |
|
39 | ||
|
|
40 | + # jquery addition | ||
|
40 | gem 'jquery-rails' |
|
41 | gem 'jquery-rails' |
|
41 | gem 'jquery-ui-sass-rails' |
|
42 | gem 'jquery-ui-sass-rails' |
|
42 | gem 'jquery-timepicker-addon-rails' |
|
43 | gem 'jquery-timepicker-addon-rails' |
|
|
44 | + gem 'jquery-tablesorter' | ||
|
43 |
|
45 | ||
|
44 | #syntax highlighter |
|
46 | #syntax highlighter |
|
45 | gem 'rouge' |
|
47 | gem 'rouge' |
|
46 |
|
48 | ||
|
47 | gem "haml" |
|
49 | gem "haml" |
|
48 | gem "mail" |
|
50 | gem "mail" |
|
49 | gem "rdiscount" |
|
51 | gem "rdiscount" |
|
50 | gem "test-unit" |
|
52 | gem "test-unit" |
|
51 | gem 'will_paginate', '~> 3.0.0' |
|
53 | gem 'will_paginate', '~> 3.0.0' |
|
52 | gem 'dynamic_form' |
|
54 | gem 'dynamic_form' |
|
53 | gem 'in_place_editing' |
|
55 | gem 'in_place_editing' |
|
54 | gem 'verification', :git => 'git://github.com/sikachu/verification.git' |
|
56 | gem 'verification', :git => 'git://github.com/sikachu/verification.git' |
|
55 |
|
57 | ||
|
56 | group :test, :development do |
|
58 | group :test, :development do |
|
57 | gem "rspec-rails", "~> 2.0" |
|
59 | gem "rspec-rails", "~> 2.0" |
|
58 | end |
|
60 | end |
@@ -1,168 +1,171 | |||||
|
1 | GIT |
|
1 | GIT |
|
2 | remote: git://github.com/sikachu/verification.git |
|
2 | remote: git://github.com/sikachu/verification.git |
|
3 | revision: 76eaf51b13276ecae54bd9cd115832595d2ff56d |
|
3 | revision: 76eaf51b13276ecae54bd9cd115832595d2ff56d |
|
4 | specs: |
|
4 | specs: |
|
5 | verification (1.0.3) |
|
5 | verification (1.0.3) |
|
6 | actionpack (>= 3.0.0, < 5.0) |
|
6 | actionpack (>= 3.0.0, < 5.0) |
|
7 | activesupport (>= 3.0.0, < 5.0) |
|
7 | activesupport (>= 3.0.0, < 5.0) |
|
8 |
|
8 | ||
|
9 | GEM |
|
9 | GEM |
|
10 | remote: https://rubygems.org/ |
|
10 | remote: https://rubygems.org/ |
|
11 | specs: |
|
11 | specs: |
|
12 | actionmailer (3.2.19) |
|
12 | actionmailer (3.2.19) |
|
13 | actionpack (= 3.2.19) |
|
13 | actionpack (= 3.2.19) |
|
14 | mail (~> 2.5.4) |
|
14 | mail (~> 2.5.4) |
|
15 | actionpack (3.2.19) |
|
15 | actionpack (3.2.19) |
|
16 | activemodel (= 3.2.19) |
|
16 | activemodel (= 3.2.19) |
|
17 | activesupport (= 3.2.19) |
|
17 | activesupport (= 3.2.19) |
|
18 | builder (~> 3.0.0) |
|
18 | builder (~> 3.0.0) |
|
19 | erubis (~> 2.7.0) |
|
19 | erubis (~> 2.7.0) |
|
20 | journey (~> 1.0.4) |
|
20 | journey (~> 1.0.4) |
|
21 | rack (~> 1.4.5) |
|
21 | rack (~> 1.4.5) |
|
22 | rack-cache (~> 1.2) |
|
22 | rack-cache (~> 1.2) |
|
23 | rack-test (~> 0.6.1) |
|
23 | rack-test (~> 0.6.1) |
|
24 | sprockets (~> 2.2.1) |
|
24 | sprockets (~> 2.2.1) |
|
25 | activemodel (3.2.19) |
|
25 | activemodel (3.2.19) |
|
26 | activesupport (= 3.2.19) |
|
26 | activesupport (= 3.2.19) |
|
27 | builder (~> 3.0.0) |
|
27 | builder (~> 3.0.0) |
|
28 | activerecord (3.2.19) |
|
28 | activerecord (3.2.19) |
|
29 | activemodel (= 3.2.19) |
|
29 | activemodel (= 3.2.19) |
|
30 | activesupport (= 3.2.19) |
|
30 | activesupport (= 3.2.19) |
|
31 | arel (~> 3.0.2) |
|
31 | arel (~> 3.0.2) |
|
32 | tzinfo (~> 0.3.29) |
|
32 | tzinfo (~> 0.3.29) |
|
33 | activeresource (3.2.19) |
|
33 | activeresource (3.2.19) |
|
34 | activemodel (= 3.2.19) |
|
34 | activemodel (= 3.2.19) |
|
35 | activesupport (= 3.2.19) |
|
35 | activesupport (= 3.2.19) |
|
36 | activesupport (3.2.19) |
|
36 | activesupport (3.2.19) |
|
37 | i18n (~> 0.6, >= 0.6.4) |
|
37 | i18n (~> 0.6, >= 0.6.4) |
|
38 | multi_json (~> 1.0) |
|
38 | multi_json (~> 1.0) |
|
39 | arel (3.0.3) |
|
39 | arel (3.0.3) |
|
40 | builder (3.0.4) |
|
40 | builder (3.0.4) |
|
41 | coffee-rails (3.2.2) |
|
41 | coffee-rails (3.2.2) |
|
42 | coffee-script (>= 2.2.0) |
|
42 | coffee-script (>= 2.2.0) |
|
43 | railties (~> 3.2.0) |
|
43 | railties (~> 3.2.0) |
|
44 | coffee-script (2.3.0) |
|
44 | coffee-script (2.3.0) |
|
45 | coffee-script-source |
|
45 | coffee-script-source |
|
46 | execjs |
|
46 | execjs |
|
47 | coffee-script-source (1.7.1) |
|
47 | coffee-script-source (1.7.1) |
|
48 | diff-lcs (1.2.5) |
|
48 | diff-lcs (1.2.5) |
|
49 | dynamic_form (1.1.4) |
|
49 | dynamic_form (1.1.4) |
|
50 | erubis (2.7.0) |
|
50 | erubis (2.7.0) |
|
51 | execjs (2.2.1) |
|
51 | execjs (2.2.1) |
|
52 | haml (4.0.5) |
|
52 | haml (4.0.5) |
|
53 | tilt |
|
53 | tilt |
|
54 | hike (1.2.3) |
|
54 | hike (1.2.3) |
|
55 | i18n (0.6.11) |
|
55 | i18n (0.6.11) |
|
56 | in_place_editing (1.2.0) |
|
56 | in_place_editing (1.2.0) |
|
57 | journey (1.0.4) |
|
57 | journey (1.0.4) |
|
58 | jquery-rails (3.1.1) |
|
58 | jquery-rails (3.1.1) |
|
59 | railties (>= 3.0, < 5.0) |
|
59 | railties (>= 3.0, < 5.0) |
|
60 | thor (>= 0.14, < 2.0) |
|
60 | thor (>= 0.14, < 2.0) |
|
|
61 | + jquery-tablesorter (1.12.7) | ||
|
|
62 | + railties (>= 3.1, < 5) | ||
|
61 | jquery-timepicker-addon-rails (1.4.1) |
|
63 | jquery-timepicker-addon-rails (1.4.1) |
|
62 | railties (>= 3.1) |
|
64 | railties (>= 3.1) |
|
63 | jquery-ui-rails (4.0.3) |
|
65 | jquery-ui-rails (4.0.3) |
|
64 | jquery-rails |
|
66 | jquery-rails |
|
65 | railties (>= 3.1.0) |
|
67 | railties (>= 3.1.0) |
|
66 | jquery-ui-sass-rails (4.0.3.0) |
|
68 | jquery-ui-sass-rails (4.0.3.0) |
|
67 | jquery-rails |
|
69 | jquery-rails |
|
68 | jquery-ui-rails (= 4.0.3) |
|
70 | jquery-ui-rails (= 4.0.3) |
|
69 | railties (>= 3.1.0) |
|
71 | railties (>= 3.1.0) |
|
70 | json (1.8.1) |
|
72 | json (1.8.1) |
|
71 | mail (2.5.4) |
|
73 | mail (2.5.4) |
|
72 | mime-types (~> 1.16) |
|
74 | mime-types (~> 1.16) |
|
73 | treetop (~> 1.4.8) |
|
75 | treetop (~> 1.4.8) |
|
74 | mime-types (1.25.1) |
|
76 | mime-types (1.25.1) |
|
75 | multi_json (1.10.1) |
|
77 | multi_json (1.10.1) |
|
76 | mysql2 (0.3.16) |
|
78 | mysql2 (0.3.16) |
|
77 | polyglot (0.3.5) |
|
79 | polyglot (0.3.5) |
|
78 | power_assert (0.1.3) |
|
80 | power_assert (0.1.3) |
|
79 | prototype-rails (3.2.1) |
|
81 | prototype-rails (3.2.1) |
|
80 | rails (~> 3.2) |
|
82 | rails (~> 3.2) |
|
81 | rack (1.4.5) |
|
83 | rack (1.4.5) |
|
82 | rack-cache (1.2) |
|
84 | rack-cache (1.2) |
|
83 | rack (>= 0.4) |
|
85 | rack (>= 0.4) |
|
84 | rack-ssl (1.3.4) |
|
86 | rack-ssl (1.3.4) |
|
85 | rack |
|
87 | rack |
|
86 | rack-test (0.6.2) |
|
88 | rack-test (0.6.2) |
|
87 | rack (>= 1.0) |
|
89 | rack (>= 1.0) |
|
88 | rails (3.2.19) |
|
90 | rails (3.2.19) |
|
89 | actionmailer (= 3.2.19) |
|
91 | actionmailer (= 3.2.19) |
|
90 | actionpack (= 3.2.19) |
|
92 | actionpack (= 3.2.19) |
|
91 | activerecord (= 3.2.19) |
|
93 | activerecord (= 3.2.19) |
|
92 | activeresource (= 3.2.19) |
|
94 | activeresource (= 3.2.19) |
|
93 | activesupport (= 3.2.19) |
|
95 | activesupport (= 3.2.19) |
|
94 | bundler (~> 1.0) |
|
96 | bundler (~> 1.0) |
|
95 | railties (= 3.2.19) |
|
97 | railties (= 3.2.19) |
|
96 | railties (3.2.19) |
|
98 | railties (3.2.19) |
|
97 | actionpack (= 3.2.19) |
|
99 | actionpack (= 3.2.19) |
|
98 | activesupport (= 3.2.19) |
|
100 | activesupport (= 3.2.19) |
|
99 | rack-ssl (~> 1.3.2) |
|
101 | rack-ssl (~> 1.3.2) |
|
100 | rake (>= 0.8.7) |
|
102 | rake (>= 0.8.7) |
|
101 | rdoc (~> 3.4) |
|
103 | rdoc (~> 3.4) |
|
102 | thor (>= 0.14.6, < 2.0) |
|
104 | thor (>= 0.14.6, < 2.0) |
|
103 | rake (10.3.2) |
|
105 | rake (10.3.2) |
|
104 | rdiscount (2.1.7.1) |
|
106 | rdiscount (2.1.7.1) |
|
105 | rdoc (3.12.2) |
|
107 | rdoc (3.12.2) |
|
106 | json (~> 1.4) |
|
108 | json (~> 1.4) |
|
107 | rouge (1.6.2) |
|
109 | rouge (1.6.2) |
|
108 | rspec-collection_matchers (1.0.0) |
|
110 | rspec-collection_matchers (1.0.0) |
|
109 | rspec-expectations (>= 2.99.0.beta1) |
|
111 | rspec-expectations (>= 2.99.0.beta1) |
|
110 | rspec-core (2.99.2) |
|
112 | rspec-core (2.99.2) |
|
111 | rspec-expectations (2.99.2) |
|
113 | rspec-expectations (2.99.2) |
|
112 | diff-lcs (>= 1.1.3, < 2.0) |
|
114 | diff-lcs (>= 1.1.3, < 2.0) |
|
113 | rspec-mocks (2.99.2) |
|
115 | rspec-mocks (2.99.2) |
|
114 | rspec-rails (2.99.0) |
|
116 | rspec-rails (2.99.0) |
|
115 | actionpack (>= 3.0) |
|
117 | actionpack (>= 3.0) |
|
116 | activemodel (>= 3.0) |
|
118 | activemodel (>= 3.0) |
|
117 | activesupport (>= 3.0) |
|
119 | activesupport (>= 3.0) |
|
118 | railties (>= 3.0) |
|
120 | railties (>= 3.0) |
|
119 | rspec-collection_matchers |
|
121 | rspec-collection_matchers |
|
120 | rspec-core (~> 2.99.0) |
|
122 | rspec-core (~> 2.99.0) |
|
121 | rspec-expectations (~> 2.99.0) |
|
123 | rspec-expectations (~> 2.99.0) |
|
122 | rspec-mocks (~> 2.99.0) |
|
124 | rspec-mocks (~> 2.99.0) |
|
123 | sass (3.4.1) |
|
125 | sass (3.4.1) |
|
124 | sass-rails (3.2.6) |
|
126 | sass-rails (3.2.6) |
|
125 | railties (~> 3.2.0) |
|
127 | railties (~> 3.2.0) |
|
126 | sass (>= 3.1.10) |
|
128 | sass (>= 3.1.10) |
|
127 | tilt (~> 1.3) |
|
129 | tilt (~> 1.3) |
|
128 | sprockets (2.2.2) |
|
130 | sprockets (2.2.2) |
|
129 | hike (~> 1.2) |
|
131 | hike (~> 1.2) |
|
130 | multi_json (~> 1.0) |
|
132 | multi_json (~> 1.0) |
|
131 | rack (~> 1.0) |
|
133 | rack (~> 1.0) |
|
132 | tilt (~> 1.1, != 1.3.0) |
|
134 | tilt (~> 1.1, != 1.3.0) |
|
133 | test-unit (3.0.1) |
|
135 | test-unit (3.0.1) |
|
134 | power_assert |
|
136 | power_assert |
|
135 | thor (0.19.1) |
|
137 | thor (0.19.1) |
|
136 | tilt (1.4.1) |
|
138 | tilt (1.4.1) |
|
137 | treetop (1.4.15) |
|
139 | treetop (1.4.15) |
|
138 | polyglot |
|
140 | polyglot |
|
139 | polyglot (>= 0.3.1) |
|
141 | polyglot (>= 0.3.1) |
|
140 | tzinfo (0.3.41) |
|
142 | tzinfo (0.3.41) |
|
141 | uglifier (2.5.3) |
|
143 | uglifier (2.5.3) |
|
142 | execjs (>= 0.3.0) |
|
144 | execjs (>= 0.3.0) |
|
143 | json (>= 1.8.0) |
|
145 | json (>= 1.8.0) |
|
144 | will_paginate (3.0.7) |
|
146 | will_paginate (3.0.7) |
|
145 |
|
147 | ||
|
146 | PLATFORMS |
|
148 | PLATFORMS |
|
147 | ruby |
|
149 | ruby |
|
148 |
|
150 | ||
|
149 | DEPENDENCIES |
|
151 | DEPENDENCIES |
|
150 | coffee-rails (~> 3.2.1) |
|
152 | coffee-rails (~> 3.2.1) |
|
151 | dynamic_form |
|
153 | dynamic_form |
|
152 | haml |
|
154 | haml |
|
153 | in_place_editing |
|
155 | in_place_editing |
|
154 | jquery-rails |
|
156 | jquery-rails |
|
|
157 | + jquery-tablesorter | ||
|
155 | jquery-timepicker-addon-rails |
|
158 | jquery-timepicker-addon-rails |
|
156 | jquery-ui-sass-rails |
|
159 | jquery-ui-sass-rails |
|
157 |
|
160 | ||
|
158 | mysql2 |
|
161 | mysql2 |
|
159 | prototype-rails |
|
162 | prototype-rails |
|
160 | rails (= 3.2.19) |
|
163 | rails (= 3.2.19) |
|
161 | rdiscount |
|
164 | rdiscount |
|
162 | rouge |
|
165 | rouge |
|
163 | rspec-rails (~> 2.0) |
|
166 | rspec-rails (~> 2.0) |
|
164 | sass-rails (~> 3.2.3) |
|
167 | sass-rails (~> 3.2.3) |
|
165 | test-unit |
|
168 | test-unit |
|
166 | uglifier (>= 1.0.3) |
|
169 | uglifier (>= 1.0.3) |
|
167 | verification! |
|
170 | verification! |
|
168 | will_paginate (~> 3.0.0) |
|
171 | will_paginate (~> 3.0.0) |
@@ -1,6 +1,7 | |||||
|
1 | //= require jquery |
|
1 | //= require jquery |
|
2 | //= require jquery_ujs |
|
2 | //= require jquery_ujs |
|
3 | //= require jquery.ui.all |
|
3 | //= require jquery.ui.all |
|
4 | //= require jquery.ui.datepicker |
|
4 | //= require jquery.ui.datepicker |
|
5 | //= require jquery.ui.slider |
|
5 | //= require jquery.ui.slider |
|
6 | //= require jquery-ui-timepicker-addon |
|
6 | //= require jquery-ui-timepicker-addon |
|
|
7 | + //= require jquery-tablesorter |
@@ -1,199 +1,200 | |||||
|
1 |
|
1 | ||
|
2 | @import jquery.ui.core |
|
2 | @import jquery.ui.core |
|
3 | @import jquery.ui.theme |
|
3 | @import jquery.ui.theme |
|
4 | @import jquery.ui.datepicker |
|
4 | @import jquery.ui.datepicker |
|
5 | @import jquery.ui.slider |
|
5 | @import jquery.ui.slider |
|
6 | @import jquery-ui-timepicker-addon |
|
6 | @import jquery-ui-timepicker-addon |
|
7 | - |
|
7 | + @import jquery-tablesorter/theme.metro-dark |
|
|
8 | + @import tablesorter-theme.cafe | ||
|
8 |
|
9 | ||
|
9 | body |
|
10 | body |
|
10 | background: white image-url("topbg.jpg") repeat-x top center |
|
11 | background: white image-url("topbg.jpg") repeat-x top center |
|
11 | font-size: 13px |
|
12 | font-size: 13px |
|
12 | font-family: Tahoma, "sans-serif" |
|
13 | font-family: Tahoma, "sans-serif" |
|
13 | margin: 10px |
|
14 | margin: 10px |
|
14 | padding: 10px |
|
15 | padding: 10px |
|
15 |
|
16 | ||
|
16 |
|
17 | ||
|
17 | input |
|
18 | input |
|
18 | font-family: Tahoma, "sans-serif" |
|
19 | font-family: Tahoma, "sans-serif" |
|
19 |
|
20 | ||
|
20 |
|
21 | ||
|
21 | h1 |
|
22 | h1 |
|
22 | font-size: 24px |
|
23 | font-size: 24px |
|
23 | color: #334488 |
|
24 | color: #334488 |
|
24 | line-height: 2em |
|
25 | line-height: 2em |
|
25 |
|
26 | ||
|
26 |
|
27 | ||
|
27 | h2 |
|
28 | h2 |
|
28 | font-size: 18px |
|
29 | font-size: 18px |
|
29 | color: #5566bb |
|
30 | color: #5566bb |
|
30 | line-height: 1.5em |
|
31 | line-height: 1.5em |
|
31 |
|
32 | ||
|
32 |
|
33 | ||
|
33 | hr |
|
34 | hr |
|
34 | border-top: 1px solid #dddddd |
|
35 | border-top: 1px solid #dddddd |
|
35 | border-bottom: 1px solid #eeeeee |
|
36 | border-bottom: 1px solid #eeeeee |
|
36 |
|
37 | ||
|
37 |
|
38 | ||
|
38 | a |
|
39 | a |
|
39 | color: #6666cc |
|
40 | color: #6666cc |
|
40 | text-decoration: none |
|
41 | text-decoration: none |
|
41 |
|
42 | ||
|
42 | &:link, &:visited |
|
43 | &:link, &:visited |
|
43 | color: #6666cc |
|
44 | color: #6666cc |
|
44 | text-decoration: none |
|
45 | text-decoration: none |
|
45 |
|
46 | ||
|
46 | &:hover, &:focus |
|
47 | &:hover, &:focus |
|
47 | color: #111166 |
|
48 | color: #111166 |
|
48 | text-decoration: none |
|
49 | text-decoration: none |
|
49 |
|
50 | ||
|
50 |
|
51 | ||
|
51 | div |
|
52 | div |
|
52 | &.userbar |
|
53 | &.userbar |
|
53 | line-height: 1.5em |
|
54 | line-height: 1.5em |
|
54 | text-align: right |
|
55 | text-align: right |
|
55 | font-size: 12px |
|
56 | font-size: 12px |
|
56 |
|
57 | ||
|
57 | &.title |
|
58 | &.title |
|
58 | padding: 10px 0px |
|
59 | padding: 10px 0px |
|
59 | line-height: 1.5em |
|
60 | line-height: 1.5em |
|
60 | font-size: 13px |
|
61 | font-size: 13px |
|
61 |
|
62 | ||
|
62 | span.contest-over-msg |
|
63 | span.contest-over-msg |
|
63 | font-size: 15px |
|
64 | font-size: 15px |
|
64 | color: red |
|
65 | color: red |
|
65 |
|
66 | ||
|
66 | table |
|
67 | table |
|
67 | width: 100% |
|
68 | width: 100% |
|
68 | font-weight: bold |
|
69 | font-weight: bold |
|
69 |
|
70 | ||
|
70 | td |
|
71 | td |
|
71 | &.left-col |
|
72 | &.left-col |
|
72 | text-align: left |
|
73 | text-align: left |
|
73 | vertical-align: top |
|
74 | vertical-align: top |
|
74 | color: #444444 |
|
75 | color: #444444 |
|
75 |
|
76 | ||
|
76 | &.right-col |
|
77 | &.right-col |
|
77 | text-align: right |
|
78 | text-align: right |
|
78 | vertical-align: top |
|
79 | vertical-align: top |
|
79 | font-size: 18px |
|
80 | font-size: 18px |
|
80 | color: #116699 |
|
81 | color: #116699 |
|
81 |
|
82 | ||
|
82 |
|
83 | ||
|
83 | table.info |
|
84 | table.info |
|
84 | margin: 10px 0 |
|
85 | margin: 10px 0 |
|
85 | border: 1px solid #666666 |
|
86 | border: 1px solid #666666 |
|
86 | border-collapse: collapse |
|
87 | border-collapse: collapse |
|
87 | font-size: 12px |
|
88 | font-size: 12px |
|
88 |
|
89 | ||
|
89 | th |
|
90 | th |
|
90 | border: 1px solid #666666 |
|
91 | border: 1px solid #666666 |
|
91 | line-height: 1.5em |
|
92 | line-height: 1.5em |
|
92 | padding: 0 0.5em |
|
93 | padding: 0 0.5em |
|
93 |
|
94 | ||
|
94 | td |
|
95 | td |
|
95 | border-left: 1px solid #666666 |
|
96 | border-left: 1px solid #666666 |
|
96 | border-right: 1px solid #666666 |
|
97 | border-right: 1px solid #666666 |
|
97 | line-height: 1.5em |
|
98 | line-height: 1.5em |
|
98 | padding: 0 0.5em |
|
99 | padding: 0 0.5em |
|
99 |
|
100 | ||
|
100 |
|
101 | ||
|
101 | tr |
|
102 | tr |
|
102 | &.info-head |
|
103 | &.info-head |
|
103 | background: #777777 |
|
104 | background: #777777 |
|
104 | color: white |
|
105 | color: white |
|
105 |
|
106 | ||
|
106 | &.info-odd |
|
107 | &.info-odd |
|
107 | background: #eeeeee |
|
108 | background: #eeeeee |
|
108 |
|
109 | ||
|
109 | &.info-even |
|
110 | &.info-even |
|
110 | background: #fcfcfc |
|
111 | background: #fcfcfc |
|
111 |
|
112 | ||
|
112 | =basicbox |
|
113 | =basicbox |
|
113 | background: #eeeeff |
|
114 | background: #eeeeff |
|
114 | border: 1px dotted #99aaee |
|
115 | border: 1px dotted #99aaee |
|
115 | padding: 5px |
|
116 | padding: 5px |
|
116 | margin: 10px 0px |
|
117 | margin: 10px 0px |
|
117 | color: black |
|
118 | color: black |
|
118 | font-size: 13px |
|
119 | font-size: 13px |
|
119 |
|
120 | ||
|
120 | .infobox |
|
121 | .infobox |
|
121 | +basicbox |
|
122 | +basicbox |
|
122 |
|
123 | ||
|
123 | .submitbox |
|
124 | .submitbox |
|
124 | +basicbox |
|
125 | +basicbox |
|
125 |
|
126 | ||
|
126 | .errorExplanation |
|
127 | .errorExplanation |
|
127 | border: 1px dotted gray |
|
128 | border: 1px dotted gray |
|
128 | color: #bb2222 |
|
129 | color: #bb2222 |
|
129 | padding: 5px 15px 5px 15px |
|
130 | padding: 5px 15px 5px 15px |
|
130 | margin-bottom: 5px |
|
131 | margin-bottom: 5px |
|
131 | background-color: white |
|
132 | background-color: white |
|
132 | font-weight: normal |
|
133 | font-weight: normal |
|
133 |
|
134 | ||
|
134 | h2 |
|
135 | h2 |
|
135 | color: #cc1111 |
|
136 | color: #cc1111 |
|
136 | font-weight: bold |
|
137 | font-weight: bold |
|
137 |
|
138 | ||
|
138 |
|
139 | ||
|
139 | table.uinfo |
|
140 | table.uinfo |
|
140 | border-collapse: collapse |
|
141 | border-collapse: collapse |
|
141 | border: 1px solid black |
|
142 | border: 1px solid black |
|
142 | font-size: 13px |
|
143 | font-size: 13px |
|
143 |
|
144 | ||
|
144 |
|
145 | ||
|
145 | td.uinfo |
|
146 | td.uinfo |
|
146 | vertical-align: top |
|
147 | vertical-align: top |
|
147 | border: 1px solid black |
|
148 | border: 1px solid black |
|
148 | padding: 5px |
|
149 | padding: 5px |
|
149 |
|
150 | ||
|
150 |
|
151 | ||
|
151 | th.uinfo |
|
152 | th.uinfo |
|
152 | background: lightgreen |
|
153 | background: lightgreen |
|
153 | vertical-align: top |
|
154 | vertical-align: top |
|
154 | text-align: right |
|
155 | text-align: right |
|
155 | border: 1px solid black |
|
156 | border: 1px solid black |
|
156 | padding: 5px |
|
157 | padding: 5px |
|
157 |
|
158 | ||
|
158 |
|
159 | ||
|
159 | div |
|
160 | div |
|
160 | &.compilermsgbody |
|
161 | &.compilermsgbody |
|
161 | font-family: monospace |
|
162 | font-family: monospace |
|
162 |
|
163 | ||
|
163 | &.task-menu |
|
164 | &.task-menu |
|
164 | text-align: center |
|
165 | text-align: center |
|
165 | font-size: 13px |
|
166 | font-size: 13px |
|
166 | line-height: 1.75em |
|
167 | line-height: 1.75em |
|
167 | font-weight: bold |
|
168 | font-weight: bold |
|
168 | border-top: 1px dashed gray |
|
169 | border-top: 1px dashed gray |
|
169 | border-bottom: 1px dashed gray |
|
170 | border-bottom: 1px dashed gray |
|
170 | margin-top: 2px |
|
171 | margin-top: 2px |
|
171 | margin-bottom: 4px |
|
172 | margin-bottom: 4px |
|
172 |
|
173 | ||
|
173 |
|
174 | ||
|
174 | table.taskdesc |
|
175 | table.taskdesc |
|
175 | border: 2px solid #dddddd |
|
176 | border: 2px solid #dddddd |
|
176 | border-collapse: collapse |
|
177 | border-collapse: collapse |
|
177 | margin: 10px auto |
|
178 | margin: 10px auto |
|
178 | width: 90% |
|
179 | width: 90% |
|
179 | font-size: 13px |
|
180 | font-size: 13px |
|
180 |
|
181 | ||
|
181 | p |
|
182 | p |
|
182 | font-size: 13px |
|
183 | font-size: 13px |
|
183 |
|
184 | ||
|
184 | tr.name |
|
185 | tr.name |
|
185 | border: 2px solid #dddddd |
|
186 | border: 2px solid #dddddd |
|
186 | background: #dddddd |
|
187 | background: #dddddd |
|
187 | color: #333333 |
|
188 | color: #333333 |
|
188 | font-weight: bold |
|
189 | font-weight: bold |
|
189 | font-size: 14px |
|
190 | font-size: 14px |
|
190 | line-height: 1.5em |
|
191 | line-height: 1.5em |
|
191 | text-align: center |
|
192 | text-align: center |
|
192 |
|
193 | ||
|
193 | td |
|
194 | td |
|
194 | &.desc-odd |
|
195 | &.desc-odd |
|
195 | padding: 5px |
|
196 | padding: 5px |
|
196 | padding-left: 20px |
|
197 | padding-left: 20px |
|
197 | background: #fefeee |
|
198 | background: #fefeee |
|
198 |
|
199 | ||
|
199 | &.desc-even |
|
200 | &.desc-even |
@@ -1,188 +1,189 | |||||
|
1 | class ReportController < ApplicationController |
|
1 | class ReportController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :admin_authorization, only: [:login_stat,:submission_stat] |
|
3 | before_filter :admin_authorization, only: [:login_stat,:submission_stat] |
|
4 | before_filter(only: [:problem_hof]) { |c| |
|
4 | before_filter(only: [:problem_hof]) { |c| |
|
5 | return false unless authenticate |
|
5 | return false unless authenticate |
|
6 |
|
6 | ||
|
7 | if GraderConfiguration["right.user_view_submission"] |
|
7 | if GraderConfiguration["right.user_view_submission"] |
|
8 | return true; |
|
8 | return true; |
|
9 | end |
|
9 | end |
|
10 |
|
10 | ||
|
11 | admin_authorization |
|
11 | admin_authorization |
|
12 | } |
|
12 | } |
|
13 |
|
13 | ||
|
14 | def login_stat |
|
14 | def login_stat |
|
15 | @logins = Array.new |
|
15 | @logins = Array.new |
|
16 |
|
16 | ||
|
17 | date_and_time = '%Y-%m-%d %H:%M' |
|
17 | date_and_time = '%Y-%m-%d %H:%M' |
|
18 | begin |
|
18 | begin |
|
19 | @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
|
19 | @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
|
20 | rescue |
|
20 | rescue |
|
21 | @since_time = DateTime.new(1000,1,1) |
|
21 | @since_time = DateTime.new(1000,1,1) |
|
22 | end |
|
22 | end |
|
23 | begin |
|
23 | begin |
|
24 | @until_time = DateTime.strptime(params[:until_datetime],date_and_time) |
|
24 | @until_time = DateTime.strptime(params[:until_datetime],date_and_time) |
|
25 | rescue |
|
25 | rescue |
|
26 | @until_time = DateTime.new(3000,1,1) |
|
26 | @until_time = DateTime.new(3000,1,1) |
|
27 | end |
|
27 | end |
|
28 |
|
28 | ||
|
29 | User.all.each do |user| |
|
29 | User.all.each do |user| |
|
30 |
- @logins << { |
|
30 | + @logins << { id: user.id, |
|
|
31 | + login: user.login, | ||
|
31 | full_name: user.full_name, |
|
32 | full_name: user.full_name, |
|
32 | count: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
33 | count: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
33 | user.id,@since_time,@until_time) |
|
34 | user.id,@since_time,@until_time) |
|
34 | .count(:id), |
|
35 | .count(:id), |
|
35 | min: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
36 | min: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
36 | user.id,@since_time,@until_time) |
|
37 | user.id,@since_time,@until_time) |
|
37 | .minimum(:created_at), |
|
38 | .minimum(:created_at), |
|
38 | max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
39 | max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?", |
|
39 | user.id,@since_time,@until_time) |
|
40 | user.id,@since_time,@until_time) |
|
40 | .maximum(:created_at) |
|
41 | .maximum(:created_at) |
|
41 | } |
|
42 | } |
|
42 | end |
|
43 | end |
|
43 | end |
|
44 | end |
|
44 |
|
45 | ||
|
45 | def submission_stat |
|
46 | def submission_stat |
|
46 |
|
47 | ||
|
47 | date_and_time = '%Y-%m-%d %H:%M' |
|
48 | date_and_time = '%Y-%m-%d %H:%M' |
|
48 | begin |
|
49 | begin |
|
49 | @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
|
50 | @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
|
50 | rescue |
|
51 | rescue |
|
51 | @since_time = DateTime.new(1000,1,1) |
|
52 | @since_time = DateTime.new(1000,1,1) |
|
52 | end |
|
53 | end |
|
53 | begin |
|
54 | begin |
|
54 | @until_time = DateTime.strptime(params[:until_datetime],date_and_time) |
|
55 | @until_time = DateTime.strptime(params[:until_datetime],date_and_time) |
|
55 | rescue |
|
56 | rescue |
|
56 | @until_time = DateTime.new(3000,1,1) |
|
57 | @until_time = DateTime.new(3000,1,1) |
|
57 | end |
|
58 | end |
|
58 |
|
59 | ||
|
59 | @submissions = {} |
|
60 | @submissions = {} |
|
60 |
|
61 | ||
|
61 | User.find_each do |user| |
|
62 | User.find_each do |user| |
|
62 | @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } } |
|
63 | @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } } |
|
63 | end |
|
64 | end |
|
64 |
|
65 | ||
|
65 | Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s| |
|
66 | Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s| |
|
66 | if @submissions[s.user_id] |
|
67 | if @submissions[s.user_id] |
|
67 | if not @submissions[s.user_id][:sub].has_key?(s.problem_id) |
|
68 | if not @submissions[s.user_id][:sub].has_key?(s.problem_id) |
|
68 | a = nil |
|
69 | a = nil |
|
69 | begin |
|
70 | begin |
|
70 | a = Problem.find(s.problem_id) |
|
71 | a = Problem.find(s.problem_id) |
|
71 | rescue |
|
72 | rescue |
|
72 | a = nil |
|
73 | a = nil |
|
73 | end |
|
74 | end |
|
74 | @submissions[s.user_id][:sub][s.problem_id] = |
|
75 | @submissions[s.user_id][:sub][s.problem_id] = |
|
75 | { prob_name: (a ? a.full_name : '(NULL)'), |
|
76 | { prob_name: (a ? a.full_name : '(NULL)'), |
|
76 | sub_ids: [s.id] } |
|
77 | sub_ids: [s.id] } |
|
77 | else |
|
78 | else |
|
78 | @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id |
|
79 | @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id |
|
79 | end |
|
80 | end |
|
80 | @submissions[s.user_id][:count] += 1 |
|
81 | @submissions[s.user_id][:count] += 1 |
|
81 | end |
|
82 | end |
|
82 | end |
|
83 | end |
|
83 | end |
|
84 | end |
|
84 |
|
85 | ||
|
85 | def problem_hof |
|
86 | def problem_hof |
|
86 | # gen problem list |
|
87 | # gen problem list |
|
87 | @user = User.find(session[:user_id]) |
|
88 | @user = User.find(session[:user_id]) |
|
88 | @problems = @user.available_problems |
|
89 | @problems = @user.available_problems |
|
89 |
|
90 | ||
|
90 | # get selected problems or the default |
|
91 | # get selected problems or the default |
|
91 | if params[:id] |
|
92 | if params[:id] |
|
92 | begin |
|
93 | begin |
|
93 | @problem = Problem.available.find(params[:id]) |
|
94 | @problem = Problem.available.find(params[:id]) |
|
94 | rescue |
|
95 | rescue |
|
95 | redirect_to action: :problem_hof |
|
96 | redirect_to action: :problem_hof |
|
96 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
97 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
97 | return |
|
98 | return |
|
98 | end |
|
99 | end |
|
99 | end |
|
100 | end |
|
100 |
|
101 | ||
|
101 | if @problem |
|
102 | if @problem |
|
102 | #aggregrate by language |
|
103 | #aggregrate by language |
|
103 | @by_lang = {} |
|
104 | @by_lang = {} |
|
104 | Submission.where(problem_id: @problem.id).find_each do |sub| |
|
105 | Submission.where(problem_id: @problem.id).find_each do |sub| |
|
105 | lang = Language.find_by_id(sub.language_id) |
|
106 | lang = Language.find_by_id(sub.language_id) |
|
106 | next unless lang |
|
107 | next unless lang |
|
107 | next unless sub.points >= @problem.full_score |
|
108 | next unless sub.points >= @problem.full_score |
|
108 |
|
109 | ||
|
109 | #initialize |
|
110 | #initialize |
|
110 | unless @by_lang.has_key?(lang.pretty_name) |
|
111 | unless @by_lang.has_key?(lang.pretty_name) |
|
111 | @by_lang[lang.pretty_name] = { |
|
112 | @by_lang[lang.pretty_name] = { |
|
112 | runtime: { avail: false, value: 2**30-1 }, |
|
113 | runtime: { avail: false, value: 2**30-1 }, |
|
113 | memory: { avail: false, value: 2**30-1 }, |
|
114 | memory: { avail: false, value: 2**30-1 }, |
|
114 | length: { avail: false, value: 2**30-1 }, |
|
115 | length: { avail: false, value: 2**30-1 }, |
|
115 | first: { avail: false, value: DateTime.new(3000,1,1) } |
|
116 | first: { avail: false, value: DateTime.new(3000,1,1) } |
|
116 | } |
|
117 | } |
|
117 | end |
|
118 | end |
|
118 |
|
119 | ||
|
119 | if sub.max_runtime and sub.max_runtime < @by_lang[lang.pretty_name][:runtime][:value] |
|
120 | if sub.max_runtime and sub.max_runtime < @by_lang[lang.pretty_name][:runtime][:value] |
|
120 | @by_lang[lang.pretty_name][:runtime] = { |
|
121 | @by_lang[lang.pretty_name][:runtime] = { |
|
121 | avail: true, |
|
122 | avail: true, |
|
122 | user_id: sub.user_id, |
|
123 | user_id: sub.user_id, |
|
123 | value: sub.max_runtime, |
|
124 | value: sub.max_runtime, |
|
124 | sub_id: sub.id |
|
125 | sub_id: sub.id |
|
125 | } |
|
126 | } |
|
126 | end |
|
127 | end |
|
127 |
|
128 | ||
|
128 | if sub.peak_memory and sub.peak_memory < @by_lang[lang.pretty_name][:memory][:value] |
|
129 | if sub.peak_memory and sub.peak_memory < @by_lang[lang.pretty_name][:memory][:value] |
|
129 | @by_lang[lang.pretty_name][:memory] = { |
|
130 | @by_lang[lang.pretty_name][:memory] = { |
|
130 | avail: true, |
|
131 | avail: true, |
|
131 | user_id: sub.user_id, |
|
132 | user_id: sub.user_id, |
|
132 | value: sub.peak_memory, |
|
133 | value: sub.peak_memory, |
|
133 | sub_id: sub.id |
|
134 | sub_id: sub.id |
|
134 | } |
|
135 | } |
|
135 | end |
|
136 | end |
|
136 |
|
137 | ||
|
137 | if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and |
|
138 | if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and |
|
138 | !sub.user.admin? |
|
139 | !sub.user.admin? |
|
139 | @by_lang[lang.pretty_name][:first] = { |
|
140 | @by_lang[lang.pretty_name][:first] = { |
|
140 | avail: true, |
|
141 | avail: true, |
|
141 | user_id: sub.user_id, |
|
142 | user_id: sub.user_id, |
|
142 | value: sub.submitted_at, |
|
143 | value: sub.submitted_at, |
|
143 | sub_id: sub.id |
|
144 | sub_id: sub.id |
|
144 | } |
|
145 | } |
|
145 | end |
|
146 | end |
|
146 |
|
147 | ||
|
147 | if @by_lang[lang.pretty_name][:length][:value] > sub.effective_code_length |
|
148 | if @by_lang[lang.pretty_name][:length][:value] > sub.effective_code_length |
|
148 | @by_lang[lang.pretty_name][:length] = { |
|
149 | @by_lang[lang.pretty_name][:length] = { |
|
149 | avail: true, |
|
150 | avail: true, |
|
150 | user_id: sub.user_id, |
|
151 | user_id: sub.user_id, |
|
151 | value: sub.effective_code_length, |
|
152 | value: sub.effective_code_length, |
|
152 | sub_id: sub.id |
|
153 | sub_id: sub.id |
|
153 | } |
|
154 | } |
|
154 | end |
|
155 | end |
|
155 | end |
|
156 | end |
|
156 |
|
157 | ||
|
157 | #process user_id |
|
158 | #process user_id |
|
158 | @by_lang.each do |lang,prop| |
|
159 | @by_lang.each do |lang,prop| |
|
159 | prop.each do |k,v| |
|
160 | prop.each do |k,v| |
|
160 | v[:user] = User.exists?(v[:user_id]) ? User.find(v[:user_id]).full_name : "(NULL)" |
|
161 | v[:user] = User.exists?(v[:user_id]) ? User.find(v[:user_id]).full_name : "(NULL)" |
|
161 | end |
|
162 | end |
|
162 | end |
|
163 | end |
|
163 |
|
164 | ||
|
164 | #sum into best |
|
165 | #sum into best |
|
165 | if @by_lang and @by_lang.first |
|
166 | if @by_lang and @by_lang.first |
|
166 | @best = @by_lang.first[1] |
|
167 | @best = @by_lang.first[1] |
|
167 | @by_lang.each do |lang,prop| |
|
168 | @by_lang.each do |lang,prop| |
|
168 | if @best[:runtime][:value] >= prop[:runtime][:value] |
|
169 | if @best[:runtime][:value] >= prop[:runtime][:value] |
|
169 | @best[:runtime] = prop[:runtime] |
|
170 | @best[:runtime] = prop[:runtime] |
|
170 | @best[:runtime][:lang] = lang |
|
171 | @best[:runtime][:lang] = lang |
|
171 | end |
|
172 | end |
|
172 | if @best[:memory][:value] >= prop[:memory][:value] |
|
173 | if @best[:memory][:value] >= prop[:memory][:value] |
|
173 | @best[:memory] = prop[:memory] |
|
174 | @best[:memory] = prop[:memory] |
|
174 | @best[:memory][:lang] = lang |
|
175 | @best[:memory][:lang] = lang |
|
175 | end |
|
176 | end |
|
176 | if @best[:length][:value] >= prop[:length][:value] |
|
177 | if @best[:length][:value] >= prop[:length][:value] |
|
177 | @best[:length] = prop[:length] |
|
178 | @best[:length] = prop[:length] |
|
178 | @best[:length][:lang] = lang |
|
179 | @best[:length][:lang] = lang |
|
179 | end |
|
180 | end |
|
180 | if @best[:first][:value] >= prop[:first][:value] |
|
181 | if @best[:first][:value] >= prop[:first][:value] |
|
181 | @best[:first] = prop[:first] |
|
182 | @best[:first] = prop[:first] |
|
182 | @best[:first][:lang] = lang |
|
183 | @best[:first][:lang] = lang |
|
183 | end |
|
184 | end |
|
184 | end |
|
185 | end |
|
185 | end |
|
186 | end |
|
186 | end |
|
187 | end |
|
187 | end |
|
188 | end |
|
188 | end |
|
189 | end |
@@ -1,353 +1,355 | |||||
|
1 | class UserAdminController < ApplicationController |
|
1 | class UserAdminController < ApplicationController |
|
2 |
|
2 | ||
|
3 | include MailHelperMethods |
|
3 | include MailHelperMethods |
|
4 |
|
4 | ||
|
5 | before_filter :admin_authorization |
|
5 | before_filter :admin_authorization |
|
6 |
|
6 | ||
|
7 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
7 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
8 | verify :method => :post, :only => [ :destroy, |
|
8 | verify :method => :post, :only => [ :destroy, |
|
9 | :create, :create_from_list, |
|
9 | :create, :create_from_list, |
|
10 | :update, |
|
10 | :update, |
|
11 | :manage_contest, |
|
11 | :manage_contest, |
|
12 | :bulk_mail |
|
12 | :bulk_mail |
|
13 | ], |
|
13 | ], |
|
14 | :redirect_to => { :action => :list } |
|
14 | :redirect_to => { :action => :list } |
|
15 |
|
15 | ||
|
16 | def index |
|
16 | def index |
|
17 | list |
|
17 | list |
|
18 | render :action => 'list' |
|
18 | render :action => 'list' |
|
19 | end |
|
19 | end |
|
20 |
|
20 | ||
|
21 | def list |
|
21 | def list |
|
22 | @user_count = User.count |
|
22 | @user_count = User.count |
|
23 | if params[:page] == 'all' |
|
23 | if params[:page] == 'all' |
|
24 | @users = User.all |
|
24 | @users = User.all |
|
25 | @paginated = false |
|
25 | @paginated = false |
|
26 | else |
|
26 | else |
|
27 | @users = User.paginate :page => params[:page] |
|
27 | @users = User.paginate :page => params[:page] |
|
28 | @paginated = true |
|
28 | @paginated = true |
|
29 | end |
|
29 | end |
|
30 | @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at'] |
|
30 | @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at'] |
|
31 | @contests = Contest.enabled |
|
31 | @contests = Contest.enabled |
|
32 | end |
|
32 | end |
|
33 |
|
33 | ||
|
34 | def active |
|
34 | def active |
|
35 | sessions = ActiveRecord::SessionStore::Session.find(:all, :conditions => ["updated_at >= ?", 60.minutes.ago]) |
|
35 | sessions = ActiveRecord::SessionStore::Session.find(:all, :conditions => ["updated_at >= ?", 60.minutes.ago]) |
|
36 | @users = [] |
|
36 | @users = [] |
|
37 | sessions.each do |session| |
|
37 | sessions.each do |session| |
|
38 | if session.data[:user_id] |
|
38 | if session.data[:user_id] |
|
39 | @users << User.find(session.data[:user_id]) |
|
39 | @users << User.find(session.data[:user_id]) |
|
40 | end |
|
40 | end |
|
41 | end |
|
41 | end |
|
42 | end |
|
42 | end |
|
43 |
|
43 | ||
|
44 | def show |
|
44 | def show |
|
45 | @user = User.find(params[:id]) |
|
45 | @user = User.find(params[:id]) |
|
46 | end |
|
46 | end |
|
47 |
|
47 | ||
|
48 | def new |
|
48 | def new |
|
49 | @user = User.new |
|
49 | @user = User.new |
|
50 | end |
|
50 | end |
|
51 |
|
51 | ||
|
52 | def create |
|
52 | def create |
|
53 | @user = User.new(params[:user]) |
|
53 | @user = User.new(params[:user]) |
|
54 | @user.activated = true |
|
54 | @user.activated = true |
|
55 | if @user.save |
|
55 | if @user.save |
|
56 | flash[:notice] = 'User was successfully created.' |
|
56 | flash[:notice] = 'User was successfully created.' |
|
57 | redirect_to :action => 'list' |
|
57 | redirect_to :action => 'list' |
|
58 | else |
|
58 | else |
|
59 | render :action => 'new' |
|
59 | render :action => 'new' |
|
60 | end |
|
60 | end |
|
61 | end |
|
61 | end |
|
62 |
|
62 | ||
|
63 | def create_from_list |
|
63 | def create_from_list |
|
64 | lines = params[:user_list] |
|
64 | lines = params[:user_list] |
|
65 |
|
65 | ||
|
66 | note = [] |
|
66 | note = [] |
|
67 |
|
67 | ||
|
68 | lines.split("\n").each do |line| |
|
68 | lines.split("\n").each do |line| |
|
69 | items = line.chomp.split(',') |
|
69 | items = line.chomp.split(',') |
|
70 | if items.length>=2 |
|
70 | if items.length>=2 |
|
71 | login = items[0] |
|
71 | login = items[0] |
|
72 | full_name = items[1] |
|
72 | full_name = items[1] |
|
73 |
|
73 | ||
|
74 | added_random_password = false |
|
74 | added_random_password = false |
|
75 | if items.length>=3 |
|
75 | if items.length>=3 |
|
76 | password = items[2].chomp(" ") |
|
76 | password = items[2].chomp(" ") |
|
77 | user_alias = (items.length>=4) ? items[3] : login |
|
77 | user_alias = (items.length>=4) ? items[3] : login |
|
78 | else |
|
78 | else |
|
79 | password = random_password |
|
79 | password = random_password |
|
80 | user_alias = (items.length>=4) ? items[3] : login |
|
80 | user_alias = (items.length>=4) ? items[3] : login |
|
81 | added_random_password = true |
|
81 | added_random_password = true |
|
82 | end |
|
82 | end |
|
83 |
|
83 | ||
|
84 | user = User.new({:login => login, |
|
84 | user = User.new({:login => login, |
|
85 | :full_name => full_name, |
|
85 | :full_name => full_name, |
|
86 | :password => password, |
|
86 | :password => password, |
|
87 | :password_confirmation => password, |
|
87 | :password_confirmation => password, |
|
88 | :alias => user_alias}) |
|
88 | :alias => user_alias}) |
|
89 | user.activated = true |
|
89 | user.activated = true |
|
90 | user.save |
|
90 | user.save |
|
91 |
|
91 | ||
|
92 | if added_random_password |
|
92 | if added_random_password |
|
93 | note << "'#{login}' (+)" |
|
93 | note << "'#{login}' (+)" |
|
94 | else |
|
94 | else |
|
95 | note << login |
|
95 | note << login |
|
96 | end |
|
96 | end |
|
97 | end |
|
97 | end |
|
98 | end |
|
98 | end |
|
99 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
99 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
100 | ' were successfully created. ' + |
|
100 | ' were successfully created. ' + |
|
101 | '( (+) - created with random passwords.)' |
|
101 | '( (+) - created with random passwords.)' |
|
102 | redirect_to :action => 'list' |
|
102 | redirect_to :action => 'list' |
|
103 | end |
|
103 | end |
|
104 |
|
104 | ||
|
105 | def edit |
|
105 | def edit |
|
106 | @user = User.find(params[:id]) |
|
106 | @user = User.find(params[:id]) |
|
107 | end |
|
107 | end |
|
108 |
|
108 | ||
|
109 | def update |
|
109 | def update |
|
110 | @user = User.find(params[:id]) |
|
110 | @user = User.find(params[:id]) |
|
111 | if @user.update_attributes(params[:user]) |
|
111 | if @user.update_attributes(params[:user]) |
|
112 | flash[:notice] = 'User was successfully updated.' |
|
112 | flash[:notice] = 'User was successfully updated.' |
|
113 | redirect_to :action => 'show', :id => @user |
|
113 | redirect_to :action => 'show', :id => @user |
|
114 | else |
|
114 | else |
|
115 | render :action => 'edit' |
|
115 | render :action => 'edit' |
|
116 | end |
|
116 | end |
|
117 | end |
|
117 | end |
|
118 |
|
118 | ||
|
119 | def destroy |
|
119 | def destroy |
|
120 | User.find(params[:id]).destroy |
|
120 | User.find(params[:id]).destroy |
|
121 | redirect_to :action => 'list' |
|
121 | redirect_to :action => 'list' |
|
122 | end |
|
122 | end |
|
123 |
|
123 | ||
|
124 | def user_stat |
|
124 | def user_stat |
|
125 | @problems = Problem.find_available_problems |
|
125 | @problems = Problem.find_available_problems |
|
126 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
126 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
127 | @scorearray = Array.new |
|
127 | @scorearray = Array.new |
|
128 | @users.each do |u| |
|
128 | @users.each do |u| |
|
129 | ustat = Array.new |
|
129 | ustat = Array.new |
|
130 | ustat[0] = u |
|
130 | ustat[0] = u |
|
131 | @problems.each do |p| |
|
131 | @problems.each do |p| |
|
132 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
132 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
133 | if (sub!=nil) and (sub.points!=nil) |
|
133 | if (sub!=nil) and (sub.points!=nil) |
|
134 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
134 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
135 | else |
|
135 | else |
|
136 | ustat << [0,false] |
|
136 | ustat << [0,false] |
|
137 | end |
|
137 | end |
|
138 | end |
|
138 | end |
|
139 | @scorearray << ustat |
|
139 | @scorearray << ustat |
|
140 | end |
|
140 | end |
|
141 | end |
|
141 | end |
|
142 |
|
142 | ||
|
143 | def user_stat_max |
|
143 | def user_stat_max |
|
144 | @problems = Problem.find_available_problems |
|
144 | @problems = Problem.find_available_problems |
|
145 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
145 | @users = User.find(:all, :include => [:contests, :contest_stat]) |
|
146 | @scorearray = Array.new |
|
146 | @scorearray = Array.new |
|
147 | #set up range from param |
|
147 | #set up range from param |
|
148 | since_id = params.fetch(:since_id, 0).to_i |
|
148 | since_id = params.fetch(:since_id, 0).to_i |
|
149 | until_id = params.fetch(:until_id, 0).to_i |
|
149 | until_id = params.fetch(:until_id, 0).to_i |
|
150 | @users.each do |u| |
|
150 | @users.each do |u| |
|
151 | ustat = Array.new |
|
151 | ustat = Array.new |
|
152 | ustat[0] = u |
|
152 | ustat[0] = u |
|
153 | @problems.each do |p| |
|
153 | @problems.each do |p| |
|
154 | max_points = 0 |
|
154 | max_points = 0 |
|
155 | Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| |
|
155 | Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| |
|
156 | max_points = sub.points if sub and sub.points and (sub.points > max_points) |
|
156 | max_points = sub.points if sub and sub.points and (sub.points > max_points) |
|
157 | end |
|
157 | end |
|
158 | ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] |
|
158 | ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] |
|
159 | end |
|
159 | end |
|
160 | @scorearray << ustat |
|
160 | @scorearray << ustat |
|
161 | end |
|
161 | end |
|
|
162 | + | ||
|
|
163 | + render template: 'user_admin/user_stat' | ||
|
162 | end |
|
164 | end |
|
163 |
|
165 | ||
|
164 | def import |
|
166 | def import |
|
165 | if params[:file]=='' |
|
167 | if params[:file]=='' |
|
166 | flash[:notice] = 'Error importing no file' |
|
168 | flash[:notice] = 'Error importing no file' |
|
167 | redirect_to :action => 'list' and return |
|
169 | redirect_to :action => 'list' and return |
|
168 | end |
|
170 | end |
|
169 | import_from_file(params[:file]) |
|
171 | import_from_file(params[:file]) |
|
170 | end |
|
172 | end |
|
171 |
|
173 | ||
|
172 | def random_all_passwords |
|
174 | def random_all_passwords |
|
173 | users = User.find(:all) |
|
175 | users = User.find(:all) |
|
174 | @prefix = params[:prefix] || '' |
|
176 | @prefix = params[:prefix] || '' |
|
175 | @non_admin_users = User.find_non_admin_with_prefix(@prefix) |
|
177 | @non_admin_users = User.find_non_admin_with_prefix(@prefix) |
|
176 | @changed = false |
|
178 | @changed = false |
|
177 | if request.request_method == 'POST' |
|
179 | if request.request_method == 'POST' |
|
178 | @non_admin_users.each do |user| |
|
180 | @non_admin_users.each do |user| |
|
179 | password = random_password |
|
181 | password = random_password |
|
180 | user.password = password |
|
182 | user.password = password |
|
181 | user.password_confirmation = password |
|
183 | user.password_confirmation = password |
|
182 | user.save |
|
184 | user.save |
|
183 | end |
|
185 | end |
|
184 | @changed = true |
|
186 | @changed = true |
|
185 | end |
|
187 | end |
|
186 | end |
|
188 | end |
|
187 |
|
189 | ||
|
188 | # contest management |
|
190 | # contest management |
|
189 |
|
191 | ||
|
190 | def contests |
|
192 | def contests |
|
191 | @contest, @users = find_contest_and_user_from_contest_id(params[:id]) |
|
193 | @contest, @users = find_contest_and_user_from_contest_id(params[:id]) |
|
192 | @contests = Contest.enabled |
|
194 | @contests = Contest.enabled |
|
193 | end |
|
195 | end |
|
194 |
|
196 | ||
|
195 | def assign_from_list |
|
197 | def assign_from_list |
|
196 | contest_id = params[:users_contest_id] |
|
198 | contest_id = params[:users_contest_id] |
|
197 | org_contest, users = find_contest_and_user_from_contest_id(contest_id) |
|
199 | org_contest, users = find_contest_and_user_from_contest_id(contest_id) |
|
198 | contest = Contest.find(params[:new_contest][:id]) |
|
200 | contest = Contest.find(params[:new_contest][:id]) |
|
199 | if !contest |
|
201 | if !contest |
|
200 | flash[:notice] = 'Error: no contest' |
|
202 | flash[:notice] = 'Error: no contest' |
|
201 | redirect_to :action => 'contests', :id =>contest_id |
|
203 | redirect_to :action => 'contests', :id =>contest_id |
|
202 | end |
|
204 | end |
|
203 |
|
205 | ||
|
204 | note = [] |
|
206 | note = [] |
|
205 | users.each do |u| |
|
207 | users.each do |u| |
|
206 | u.contests = [contest] |
|
208 | u.contests = [contest] |
|
207 | note << u.login |
|
209 | note << u.login |
|
208 | end |
|
210 | end |
|
209 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
211 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
210 | " were successfully reassigned to #{contest.title}." |
|
212 | " were successfully reassigned to #{contest.title}." |
|
211 | redirect_to :action => 'contests', :id =>contest.id |
|
213 | redirect_to :action => 'contests', :id =>contest.id |
|
212 | end |
|
214 | end |
|
213 |
|
215 | ||
|
214 | def add_to_contest |
|
216 | def add_to_contest |
|
215 | user = User.find(params[:id]) |
|
217 | user = User.find(params[:id]) |
|
216 | contest = Contest.find(params[:contest_id]) |
|
218 | contest = Contest.find(params[:contest_id]) |
|
217 | if user and contest |
|
219 | if user and contest |
|
218 | user.contests << contest |
|
220 | user.contests << contest |
|
219 | end |
|
221 | end |
|
220 | redirect_to :action => 'list' |
|
222 | redirect_to :action => 'list' |
|
221 | end |
|
223 | end |
|
222 |
|
224 | ||
|
223 | def remove_from_contest |
|
225 | def remove_from_contest |
|
224 | user = User.find(params[:id]) |
|
226 | user = User.find(params[:id]) |
|
225 | contest = Contest.find(params[:contest_id]) |
|
227 | contest = Contest.find(params[:contest_id]) |
|
226 | if user and contest |
|
228 | if user and contest |
|
227 | user.contests.delete(contest) |
|
229 | user.contests.delete(contest) |
|
228 | end |
|
230 | end |
|
229 | redirect_to :action => 'list' |
|
231 | redirect_to :action => 'list' |
|
230 | end |
|
232 | end |
|
231 |
|
233 | ||
|
232 | def contest_management |
|
234 | def contest_management |
|
233 | end |
|
235 | end |
|
234 |
|
236 | ||
|
235 | def manage_contest |
|
237 | def manage_contest |
|
236 | contest = Contest.find(params[:contest][:id]) |
|
238 | contest = Contest.find(params[:contest][:id]) |
|
237 | if !contest |
|
239 | if !contest |
|
238 | flash[:notice] = 'You did not choose the contest.' |
|
240 | flash[:notice] = 'You did not choose the contest.' |
|
239 | redirect_to :action => 'contest_management' and return |
|
241 | redirect_to :action => 'contest_management' and return |
|
240 | end |
|
242 | end |
|
241 |
|
243 | ||
|
242 | operation = params[:operation] |
|
244 | operation = params[:operation] |
|
243 |
|
245 | ||
|
244 | if not ['add','remove','assign'].include? operation |
|
246 | if not ['add','remove','assign'].include? operation |
|
245 | flash[:notice] = 'You did not choose the operation to perform.' |
|
247 | flash[:notice] = 'You did not choose the operation to perform.' |
|
246 | redirect_to :action => 'contest_management' and return |
|
248 | redirect_to :action => 'contest_management' and return |
|
247 | end |
|
249 | end |
|
248 |
|
250 | ||
|
249 | lines = params[:login_list] |
|
251 | lines = params[:login_list] |
|
250 | if !lines or lines.blank? |
|
252 | if !lines or lines.blank? |
|
251 | flash[:notice] = 'You entered an empty list.' |
|
253 | flash[:notice] = 'You entered an empty list.' |
|
252 | redirect_to :action => 'contest_management' and return |
|
254 | redirect_to :action => 'contest_management' and return |
|
253 | end |
|
255 | end |
|
254 |
|
256 | ||
|
255 | note = [] |
|
257 | note = [] |
|
256 | users = [] |
|
258 | users = [] |
|
257 | lines.split("\n").each do |line| |
|
259 | lines.split("\n").each do |line| |
|
258 | user = User.find_by_login(line.chomp) |
|
260 | user = User.find_by_login(line.chomp) |
|
259 | if user |
|
261 | if user |
|
260 | if operation=='add' |
|
262 | if operation=='add' |
|
261 | if ! user.contests.include? contest |
|
263 | if ! user.contests.include? contest |
|
262 | user.contests << contest |
|
264 | user.contests << contest |
|
263 | end |
|
265 | end |
|
264 | elsif operation=='remove' |
|
266 | elsif operation=='remove' |
|
265 | user.contests.delete(contest) |
|
267 | user.contests.delete(contest) |
|
266 | else |
|
268 | else |
|
267 | user.contests = [contest] |
|
269 | user.contests = [contest] |
|
268 | end |
|
270 | end |
|
269 |
|
271 | ||
|
270 | if params[:reset_timer] |
|
272 | if params[:reset_timer] |
|
271 | user.contest_stat.forced_logout = true |
|
273 | user.contest_stat.forced_logout = true |
|
272 | user.contest_stat.reset_timer_and_save |
|
274 | user.contest_stat.reset_timer_and_save |
|
273 | end |
|
275 | end |
|
274 |
|
276 | ||
|
275 | if params[:notification_emails] |
|
277 | if params[:notification_emails] |
|
276 | send_contest_update_notification_email(user, contest) |
|
278 | send_contest_update_notification_email(user, contest) |
|
277 | end |
|
279 | end |
|
278 |
|
280 | ||
|
279 | note << user.login |
|
281 | note << user.login |
|
280 | users << user |
|
282 | users << user |
|
281 | end |
|
283 | end |
|
282 | end |
|
284 | end |
|
283 |
|
285 | ||
|
284 | if params[:reset_timer] |
|
286 | if params[:reset_timer] |
|
285 | logout_users(users) |
|
287 | logout_users(users) |
|
286 | end |
|
288 | end |
|
287 |
|
289 | ||
|
288 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
290 | flash[:notice] = 'User(s) ' + note.join(', ') + |
|
289 | ' were successfully modified. ' |
|
291 | ' were successfully modified. ' |
|
290 | redirect_to :action => 'contest_management' |
|
292 | redirect_to :action => 'contest_management' |
|
291 | end |
|
293 | end |
|
292 |
|
294 | ||
|
293 | # admin management |
|
295 | # admin management |
|
294 |
|
296 | ||
|
295 | def admin |
|
297 | def admin |
|
296 | @admins = User.find(:all).find_all {|user| user.admin? } |
|
298 | @admins = User.find(:all).find_all {|user| user.admin? } |
|
297 | end |
|
299 | end |
|
298 |
|
300 | ||
|
299 | def grant_admin |
|
301 | def grant_admin |
|
300 | login = params[:login] |
|
302 | login = params[:login] |
|
301 | user = User.find_by_login(login) |
|
303 | user = User.find_by_login(login) |
|
302 | if user!=nil |
|
304 | if user!=nil |
|
303 | admin_role = Role.find_by_name('admin') |
|
305 | admin_role = Role.find_by_name('admin') |
|
304 | user.roles << admin_role |
|
306 | user.roles << admin_role |
|
305 | else |
|
307 | else |
|
306 | flash[:notice] = 'Unknown user' |
|
308 | flash[:notice] = 'Unknown user' |
|
307 | end |
|
309 | end |
|
308 | flash[:notice] = 'User added as admins' |
|
310 | flash[:notice] = 'User added as admins' |
|
309 | redirect_to :action => 'admin' |
|
311 | redirect_to :action => 'admin' |
|
310 | end |
|
312 | end |
|
311 |
|
313 | ||
|
312 | def revoke_admin |
|
314 | def revoke_admin |
|
313 | user = User.find(params[:id]) |
|
315 | user = User.find(params[:id]) |
|
314 | if user==nil |
|
316 | if user==nil |
|
315 | flash[:notice] = 'Unknown user' |
|
317 | flash[:notice] = 'Unknown user' |
|
316 | redirect_to :action => 'admin' and return |
|
318 | redirect_to :action => 'admin' and return |
|
317 | elsif user.login == 'root' |
|
319 | elsif user.login == 'root' |
|
318 | flash[:notice] = 'You cannot revoke admisnistrator permission from root.' |
|
320 | flash[:notice] = 'You cannot revoke admisnistrator permission from root.' |
|
319 | redirect_to :action => 'admin' and return |
|
321 | redirect_to :action => 'admin' and return |
|
320 | end |
|
322 | end |
|
321 |
|
323 | ||
|
322 | admin_role = Role.find_by_name('admin') |
|
324 | admin_role = Role.find_by_name('admin') |
|
323 | user.roles.delete(admin_role) |
|
325 | user.roles.delete(admin_role) |
|
324 | flash[:notice] = 'User permission revoked' |
|
326 | flash[:notice] = 'User permission revoked' |
|
325 | redirect_to :action => 'admin' |
|
327 | redirect_to :action => 'admin' |
|
326 | end |
|
328 | end |
|
327 |
|
329 | ||
|
328 | # mass mailing |
|
330 | # mass mailing |
|
329 |
|
331 | ||
|
330 | def mass_mailing |
|
332 | def mass_mailing |
|
331 | end |
|
333 | end |
|
332 |
|
334 | ||
|
333 | def bulk_mail |
|
335 | def bulk_mail |
|
334 | lines = params[:login_list] |
|
336 | lines = params[:login_list] |
|
335 | if !lines or lines.blank? |
|
337 | if !lines or lines.blank? |
|
336 | flash[:notice] = 'You entered an empty list.' |
|
338 | flash[:notice] = 'You entered an empty list.' |
|
337 | redirect_to :action => 'mass_mailing' and return |
|
339 | redirect_to :action => 'mass_mailing' and return |
|
338 | end |
|
340 | end |
|
339 |
|
341 | ||
|
340 | mail_subject = params[:subject] |
|
342 | mail_subject = params[:subject] |
|
341 | if !mail_subject or mail_subject.blank? |
|
343 | if !mail_subject or mail_subject.blank? |
|
342 | flash[:notice] = 'You entered an empty mail subject.' |
|
344 | flash[:notice] = 'You entered an empty mail subject.' |
|
343 | redirect_to :action => 'mass_mailing' and return |
|
345 | redirect_to :action => 'mass_mailing' and return |
|
344 | end |
|
346 | end |
|
345 |
|
347 | ||
|
346 | mail_body = params[:email_body] |
|
348 | mail_body = params[:email_body] |
|
347 | if !mail_body or mail_body.blank? |
|
349 | if !mail_body or mail_body.blank? |
|
348 | flash[:notice] = 'You entered an empty mail body.' |
|
350 | flash[:notice] = 'You entered an empty mail body.' |
|
349 | redirect_to :action => 'mass_mailing' and return |
|
351 | redirect_to :action => 'mass_mailing' and return |
|
350 | end |
|
352 | end |
|
351 |
|
353 | ||
|
352 | note = [] |
|
354 | note = [] |
|
353 | users = [] |
|
355 | users = [] |
@@ -1,156 +1,176 | |||||
|
1 | require 'net/smtp' |
|
1 | require 'net/smtp' |
|
2 |
|
2 | ||
|
3 | class UsersController < ApplicationController |
|
3 | class UsersController < ApplicationController |
|
4 |
|
4 | ||
|
5 | include MailHelperMethods |
|
5 | include MailHelperMethods |
|
6 |
|
6 | ||
|
7 | before_filter :authenticate, :except => [:new, |
|
7 | before_filter :authenticate, :except => [:new, |
|
8 | :register, |
|
8 | :register, |
|
9 | :confirm, |
|
9 | :confirm, |
|
10 | :forget, |
|
10 | :forget, |
|
11 | :retrieve_password] |
|
11 | :retrieve_password] |
|
12 |
|
12 | ||
|
13 | before_filter :verify_online_registration, :only => [:new, |
|
13 | before_filter :verify_online_registration, :only => [:new, |
|
14 | :register, |
|
14 | :register, |
|
15 | :forget, |
|
15 | :forget, |
|
16 | :retrieve_password] |
|
16 | :retrieve_password] |
|
|
17 | + before_filter :authenticate, :profile_authorization, only: [:profile] | ||
|
17 |
|
18 | ||
|
18 | verify :method => :post, :only => [:chg_passwd], |
|
19 | verify :method => :post, :only => [:chg_passwd], |
|
19 | :redirect_to => { :action => :index } |
|
20 | :redirect_to => { :action => :index } |
|
20 |
|
21 | ||
|
21 | #in_place_edit_for :user, :alias_for_editing |
|
22 | #in_place_edit_for :user, :alias_for_editing |
|
22 | #in_place_edit_for :user, :email_for_editing |
|
23 | #in_place_edit_for :user, :email_for_editing |
|
23 |
|
24 | ||
|
24 | def index |
|
25 | def index |
|
25 | if !GraderConfiguration['system.user_setting_enabled'] |
|
26 | if !GraderConfiguration['system.user_setting_enabled'] |
|
26 | redirect_to :controller => 'main', :action => 'list' |
|
27 | redirect_to :controller => 'main', :action => 'list' |
|
27 | else |
|
28 | else |
|
28 | @user = User.find(session[:user_id]) |
|
29 | @user = User.find(session[:user_id]) |
|
29 | end |
|
30 | end |
|
30 | end |
|
31 | end |
|
31 |
|
32 | ||
|
32 | def chg_passwd |
|
33 | def chg_passwd |
|
33 | user = User.find(session[:user_id]) |
|
34 | user = User.find(session[:user_id]) |
|
34 | user.password = params[:passwd] |
|
35 | user.password = params[:passwd] |
|
35 | user.password_confirmation = params[:passwd_verify] |
|
36 | user.password_confirmation = params[:passwd_verify] |
|
36 | if user.save |
|
37 | if user.save |
|
37 | flash[:notice] = 'password changed' |
|
38 | flash[:notice] = 'password changed' |
|
38 | else |
|
39 | else |
|
39 | flash[:notice] = 'Error: password changing failed' |
|
40 | flash[:notice] = 'Error: password changing failed' |
|
40 | end |
|
41 | end |
|
41 | redirect_to :action => 'index' |
|
42 | redirect_to :action => 'index' |
|
42 | end |
|
43 | end |
|
43 |
|
44 | ||
|
44 | def new |
|
45 | def new |
|
45 | @user = User.new |
|
46 | @user = User.new |
|
46 | render :action => 'new', :layout => 'empty' |
|
47 | render :action => 'new', :layout => 'empty' |
|
47 | end |
|
48 | end |
|
48 |
|
49 | ||
|
49 | def register |
|
50 | def register |
|
50 | if(params[:cancel]) |
|
51 | if(params[:cancel]) |
|
51 | redirect_to :controller => 'main', :action => 'login' |
|
52 | redirect_to :controller => 'main', :action => 'login' |
|
52 | return |
|
53 | return |
|
53 | end |
|
54 | end |
|
54 | @user = User.new(params[:user]) |
|
55 | @user = User.new(params[:user]) |
|
55 | @user.password_confirmation = @user.password = User.random_password |
|
56 | @user.password_confirmation = @user.password = User.random_password |
|
56 | @user.activated = false |
|
57 | @user.activated = false |
|
57 | if (@user.valid?) and (@user.save) |
|
58 | if (@user.valid?) and (@user.save) |
|
58 | if send_confirmation_email(@user) |
|
59 | if send_confirmation_email(@user) |
|
59 | render :action => 'new_splash', :layout => 'empty' |
|
60 | render :action => 'new_splash', :layout => 'empty' |
|
60 | else |
|
61 | else |
|
61 | @admin_email = GraderConfiguration['system.admin_email'] |
|
62 | @admin_email = GraderConfiguration['system.admin_email'] |
|
62 | render :action => 'email_error', :layout => 'empty' |
|
63 | render :action => 'email_error', :layout => 'empty' |
|
63 | end |
|
64 | end |
|
64 | else |
|
65 | else |
|
65 | @user.errors.add_to_base("Email cannot be blank") if @user.email=='' |
|
66 | @user.errors.add_to_base("Email cannot be blank") if @user.email=='' |
|
66 | render :action => 'new', :layout => 'empty' |
|
67 | render :action => 'new', :layout => 'empty' |
|
67 | end |
|
68 | end |
|
68 | end |
|
69 | end |
|
69 |
|
70 | ||
|
70 | def confirm |
|
71 | def confirm |
|
71 | login = params[:login] |
|
72 | login = params[:login] |
|
72 | key = params[:activation] |
|
73 | key = params[:activation] |
|
73 | @user = User.find_by_login(login) |
|
74 | @user = User.find_by_login(login) |
|
74 | if (@user) and (@user.verify_activation_key(key)) |
|
75 | if (@user) and (@user.verify_activation_key(key)) |
|
75 | if @user.valid? # check uniquenss of email |
|
76 | if @user.valid? # check uniquenss of email |
|
76 | @user.activated = true |
|
77 | @user.activated = true |
|
77 | @user.save |
|
78 | @user.save |
|
78 | @result = :successful |
|
79 | @result = :successful |
|
79 | else |
|
80 | else |
|
80 | @result = :email_used |
|
81 | @result = :email_used |
|
81 | end |
|
82 | end |
|
82 | else |
|
83 | else |
|
83 | @result = :failed |
|
84 | @result = :failed |
|
84 | end |
|
85 | end |
|
85 | render :action => 'confirm', :layout => 'empty' |
|
86 | render :action => 'confirm', :layout => 'empty' |
|
86 | end |
|
87 | end |
|
87 |
|
88 | ||
|
88 | def forget |
|
89 | def forget |
|
89 | render :action => 'forget', :layout => 'empty' |
|
90 | render :action => 'forget', :layout => 'empty' |
|
90 | end |
|
91 | end |
|
91 |
|
92 | ||
|
92 | def retrieve_password |
|
93 | def retrieve_password |
|
93 | email = params[:email] |
|
94 | email = params[:email] |
|
94 | user = User.find_by_email(email) |
|
95 | user = User.find_by_email(email) |
|
95 | if user |
|
96 | if user |
|
96 | last_updated_time = user.updated_at || user.created_at || (Time.now.gmtime - 1.hour) |
|
97 | last_updated_time = user.updated_at || user.created_at || (Time.now.gmtime - 1.hour) |
|
97 | if last_updated_time > Time.now.gmtime - 5.minutes |
|
98 | if last_updated_time > Time.now.gmtime - 5.minutes |
|
98 | flash[:notice] = 'The account has recently created or new password has recently been requested. Please wait for 5 minutes' |
|
99 | flash[:notice] = 'The account has recently created or new password has recently been requested. Please wait for 5 minutes' |
|
99 | else |
|
100 | else |
|
100 | user.password = user.password_confirmation = User.random_password |
|
101 | user.password = user.password_confirmation = User.random_password |
|
101 | user.save |
|
102 | user.save |
|
102 | send_new_password_email(user) |
|
103 | send_new_password_email(user) |
|
103 | flash[:notice] = 'New password has been mailed to you.' |
|
104 | flash[:notice] = 'New password has been mailed to you.' |
|
104 | end |
|
105 | end |
|
105 | else |
|
106 | else |
|
106 | flash[:notice] = I18n.t 'registration.password_retrieval.no_email' |
|
107 | flash[:notice] = I18n.t 'registration.password_retrieval.no_email' |
|
107 | end |
|
108 | end |
|
108 | redirect_to :action => 'forget' |
|
109 | redirect_to :action => 'forget' |
|
109 | end |
|
110 | end |
|
110 |
|
111 | ||
|
|
112 | + def profile | ||
|
|
113 | + @user = User.find(params[:id]) | ||
|
|
114 | + @submission = Submission.where(user_id: params[:id]).all | ||
|
|
115 | + end | ||
|
|
116 | + | ||
|
111 | protected |
|
117 | protected |
|
112 |
|
118 | ||
|
113 | def verify_online_registration |
|
119 | def verify_online_registration |
|
114 | if !GraderConfiguration['system.online_registration'] |
|
120 | if !GraderConfiguration['system.online_registration'] |
|
115 | redirect_to :controller => 'main', :action => 'login' |
|
121 | redirect_to :controller => 'main', :action => 'login' |
|
116 | end |
|
122 | end |
|
117 | end |
|
123 | end |
|
118 |
|
124 | ||
|
119 | def send_confirmation_email(user) |
|
125 | def send_confirmation_email(user) |
|
120 | contest_name = GraderConfiguration['contest.name'] |
|
126 | contest_name = GraderConfiguration['contest.name'] |
|
121 | activation_url = url_for(:action => 'confirm', |
|
127 | activation_url = url_for(:action => 'confirm', |
|
122 | :login => user.login, |
|
128 | :login => user.login, |
|
123 | :activation => user.activation_key) |
|
129 | :activation => user.activation_key) |
|
124 | home_url = url_for(:controller => 'main', :action => 'index') |
|
130 | home_url = url_for(:controller => 'main', :action => 'index') |
|
125 | mail_subject = "[#{contest_name}] Confirmation" |
|
131 | mail_subject = "[#{contest_name}] Confirmation" |
|
126 | mail_body = t('registration.email_body', { |
|
132 | mail_body = t('registration.email_body', { |
|
127 | :full_name => user.full_name, |
|
133 | :full_name => user.full_name, |
|
128 | :contest_name => contest_name, |
|
134 | :contest_name => contest_name, |
|
129 | :login => user.login, |
|
135 | :login => user.login, |
|
130 | :password => user.password, |
|
136 | :password => user.password, |
|
131 | :activation_url => activation_url, |
|
137 | :activation_url => activation_url, |
|
132 | :admin_email => admin_email |
|
138 | :admin_email => admin_email |
|
133 | }) |
|
139 | }) |
|
134 |
|
140 | ||
|
135 | logger.info mail_body |
|
141 | logger.info mail_body |
|
136 |
|
142 | ||
|
137 | send_mail(user.email, mail_subject, mail_body) |
|
143 | send_mail(user.email, mail_subject, mail_body) |
|
138 | end |
|
144 | end |
|
139 |
|
145 | ||
|
140 | def send_new_password_email(user) |
|
146 | def send_new_password_email(user) |
|
141 | contest_name = GraderConfiguration['contest.name'] |
|
147 | contest_name = GraderConfiguration['contest.name'] |
|
142 | mail_subject = "[#{contest_name}] Password recovery" |
|
148 | mail_subject = "[#{contest_name}] Password recovery" |
|
143 | mail_body = t('registration.password_retrieval.email_body', { |
|
149 | mail_body = t('registration.password_retrieval.email_body', { |
|
144 | :full_name => user.full_name, |
|
150 | :full_name => user.full_name, |
|
145 | :contest_name => contest_name, |
|
151 | :contest_name => contest_name, |
|
146 | :login => user.login, |
|
152 | :login => user.login, |
|
147 | :password => user.password, |
|
153 | :password => user.password, |
|
148 | :admin_email => admin_email |
|
154 | :admin_email => admin_email |
|
149 | }) |
|
155 | }) |
|
150 |
|
156 | ||
|
151 | logger.info mail_body |
|
157 | logger.info mail_body |
|
152 |
|
158 | ||
|
153 | send_mail(user.email, mail_subject, mail_body) |
|
159 | send_mail(user.email, mail_subject, mail_body) |
|
154 | end |
|
160 | end |
|
155 |
|
161 | ||
|
|
162 | + # allow viewing of regular user profile only when options allow so | ||
|
|
163 | + # only admins can view admins profile | ||
|
|
164 | + def profile_authorization | ||
|
|
165 | + #if view admins' profile, allow only admin | ||
|
|
166 | + return false unless(params[:id]) | ||
|
|
167 | + user = User.find(params[:id]) | ||
|
|
168 | + return false unless user | ||
|
|
169 | + return admin_authorization if user.admin? | ||
|
|
170 | + return true if GraderConfiguration["right.user_view_submission"] | ||
|
|
171 | + | ||
|
|
172 | + #finally, we allow only admin | ||
|
|
173 | + admin_authorization | ||
|
156 | end |
|
174 | end |
|
|
175 | + | ||
|
|
176 | + end |
@@ -1,62 +1,79 | |||||
|
1 | :css |
|
1 | :css |
|
2 | .hof_user { color: orangered; font-style: italic; } |
|
2 | .hof_user { color: orangered; font-style: italic; } |
|
3 | .hof_language { color: green; font-style: italic; } |
|
3 | .hof_language { color: green; font-style: italic; } |
|
4 | .hof_value { color: deeppink;font-style: italic; } |
|
4 | .hof_value { color: deeppink;font-style: italic; } |
|
5 |
|
5 | ||
|
6 | %h2 Overall |
|
6 | %h2 Overall |
|
7 |
|
7 | ||
|
8 | - if @best |
|
8 | - if @best |
|
9 | %b Best Runtime: |
|
9 | %b Best Runtime: |
|
10 | - by <span class="hof_user">#{@best[:runtime][:user]}</span> using <span class="hof_language">#{@best[:runtime][:lang]}</span> with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span> at submission |
|
10 | + by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]} |
|
|
11 | + using <span class="hof_language">#{@best[:runtime][:lang]}</span> | ||
|
|
12 | + with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span> | ||
|
|
13 | + at submission | ||
|
11 | = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id]) |
|
14 | = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id]) |
|
12 | %br/ |
|
15 | %br/ |
|
13 |
|
16 | ||
|
14 | %b Best Memory Usage: |
|
17 | %b Best Memory Usage: |
|
15 | - by <span class="hof_user">#{@best[:memory][:user]}</span> using <span class="hof_language">#{@best[:memory][:lang]}</span> with <span class="hof_value">#{@best[:memory][:value]} kbytes </span> at submission |
|
18 | + by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]} |
|
|
19 | + using <span class="hof_language">#{@best[:memory][:lang]}</span> | ||
|
|
20 | + with <span class="hof_value">#{@best[:memory][:value]} kbytes </span> | ||
|
|
21 | + at submission | ||
|
16 | = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id]) |
|
22 | = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id]) |
|
17 | %br/ |
|
23 | %br/ |
|
18 |
|
24 | ||
|
19 |
%b Shortest Code: |
|
25 | %b Shortest Code: |
|
20 | - by <span class="hof_user">#{@best[:length][:user]}</span> using <span class="hof_language">#{@best[:length][:lang]}</span> with <span class="hof_value">#{@best[:length][:value]} bytes</span> at submission |
|
26 | + by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]} |
|
|
27 | + using <span class="hof_language">#{@best[:length][:lang]}</span> | ||
|
|
28 | + with <span class="hof_value">#{@best[:length][:value]} bytes</span> | ||
|
|
29 | + at submission | ||
|
21 | = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id]) |
|
30 | = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id]) |
|
22 | %br/ |
|
31 | %br/ |
|
23 |
|
32 | ||
|
24 |
%b First solver: |
|
33 | %b First solver: |
|
25 | - <span class="hof_user">#{@best[:first][:user]}</span> is the first solver using <span class="hof_language">#{@best[:first][:lang]}</span> on <span class="hof_value">#{@best[:first][:value]}</span> at submission |
|
34 | + #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver |
|
|
35 | + using <span class="hof_language">#{@best[:first][:lang]}</span> | ||
|
|
36 | + on <span class="hof_value">#{@best[:first][:value]}</span> | ||
|
|
37 | + at submission | ||
|
26 | = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id]) |
|
38 | = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id]) |
|
27 | %br/ |
|
39 | %br/ |
|
28 |
|
40 | ||
|
29 |
|
41 | ||
|
30 | %p |
|
42 | %p |
|
31 | This counts only for submission with 100% score <br/> |
|
43 | This counts only for submission with 100% score <br/> |
|
32 | Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...) |
|
44 | Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...) |
|
33 |
|
45 | ||
|
34 | %h2 By language |
|
46 | %h2 By language |
|
35 |
|
47 | ||
|
36 | %table.info |
|
48 | %table.info |
|
37 | %thead |
|
49 | %thead |
|
38 | %tr.info-head |
|
50 | %tr.info-head |
|
39 | %th Language |
|
51 | %th Language |
|
40 | %th Best runtime (ms) |
|
52 | %th Best runtime (ms) |
|
41 | %th Best memory (kbytes) |
|
53 | %th Best memory (kbytes) |
|
42 | %th Shortest Code (bytes) |
|
54 | %th Shortest Code (bytes) |
|
43 | %th First solver |
|
55 | %th First solver |
|
44 | %tbody |
|
56 | %tbody |
|
45 | - @by_lang.each do |lang,value| |
|
57 | - @by_lang.each do |lang,value| |
|
46 | %tr{class: cycle('info-even','info-odd')} |
|
58 | %tr{class: cycle('info-even','info-odd')} |
|
47 | %td= lang |
|
59 | %td= lang |
|
48 | %td |
|
60 | %td |
|
49 | - = "#{value[:runtime][:user]} (#{(value[:runtime][:value] * 1000).to_i} @" |
|
61 | + = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id] |
|
|
62 | + = "(#{(value[:runtime][:value] * 1000).to_i} @" | ||
|
50 | = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe |
|
63 | = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe |
|
51 | %td |
|
64 | %td |
|
52 |
- = |
|
65 | + = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id] |
|
|
66 | + = "(#{value[:memory][:value]} @" | ||
|
53 | = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe |
|
67 | = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe |
|
54 | %td |
|
68 | %td |
|
55 |
- = |
|
69 | + = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id] |
|
|
70 | + = "(#{value[:length][:value]} @" | ||
|
56 | = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe |
|
71 | = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe |
|
57 | %td |
|
72 | %td |
|
58 | - = "#{value[:first][:user]} (#{value[:first][:value]} @" |
|
73 | + - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong... |
|
|
74 | + = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id] | ||
|
|
75 | + = "(#{value[:first][:value]} @" | ||
|
59 | = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe |
|
76 | = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe |
|
60 |
|
77 | ||
|
61 | - else |
|
78 | - else |
|
62 | %h3 No submissions |
|
79 | %h3 No submissions |
@@ -1,31 +1,32 | |||||
|
1 | - content_for :header do |
|
1 | - content_for :header do |
|
|
2 | + = stylesheet_link_tag 'tablesorter-theme.cafe' | ||
|
2 | = javascript_include_tag 'new' |
|
3 | = javascript_include_tag 'new' |
|
3 |
|
4 | ||
|
4 | %script{:type=>"text/javascript"} |
|
5 | %script{:type=>"text/javascript"} |
|
5 | $(function () { |
|
6 | $(function () { |
|
6 | $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
7 | $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
7 | $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
8 | $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
|
9 | + $('#my_table').tablesorter({widthFixed: true, widgets: ['zebra']}); | ||
|
8 | }); |
|
10 | }); |
|
9 |
|
11 | ||
|
10 | %h1 Login status |
|
12 | %h1 Login status |
|
11 |
|
13 | ||
|
12 | =render partial: 'report_menu' |
|
14 | =render partial: 'report_menu' |
|
13 | =render partial: 'date_range', locals: {param_text: 'Login date range:', title: 'Query login stat in the range' } |
|
15 | =render partial: 'date_range', locals: {param_text: 'Login date range:', title: 'Query login stat in the range' } |
|
14 |
|
16 | ||
|
15 | - %table.info |
|
17 | + %table.tablesorter-cafe#my_table |
|
16 | %thead |
|
18 | %thead |
|
17 | - %tr.info-head |
|
19 | + %tr |
|
18 | %th login |
|
20 | %th login |
|
19 | %th full name |
|
21 | %th full name |
|
20 | %th login count |
|
22 | %th login count |
|
21 | %th earliest |
|
23 | %th earliest |
|
22 | %th latest |
|
24 | %th latest |
|
23 | %tbody |
|
25 | %tbody |
|
24 | - @logins.each do |l| |
|
26 | - @logins.each do |l| |
|
25 | %tr{class: cycle('info-even','info-odd')} |
|
27 | %tr{class: cycle('info-even','info-odd')} |
|
26 | - %td= l[:login] |
|
28 | + %td= link_to l[:login], controller: 'users', action: 'profile', id: l[:id] |
|
27 | %td= l[:full_name] |
|
29 | %td= l[:full_name] |
|
28 | %td= l[:count] |
|
30 | %td= l[:count] |
|
29 | %td= l[:min] ? l[:min].in_time_zone.strftime('%Y-%m-%d %H:%M') : '' |
|
31 | %td= l[:min] ? l[:min].in_time_zone.strftime('%Y-%m-%d %H:%M') : '' |
|
30 |
- %td= l[:max] ? l[:max].in_time_zone |
|
32 | + %td= l[:max] ? time_ago_in_words(l[:max].in_time_zone) + ' ago' : '' |
|
31 | - |
|
@@ -1,44 +1,50 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'new' | ||
|
|
3 | + = stylesheet_link_tag 'tablesorter-theme.cafe' | ||
|
|
4 | + | ||
|
|
5 | + %script{:type=>"text/javascript"} | ||
|
|
6 | + $(function () { | ||
|
|
7 | + $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
8 | + $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
9 | + $('#my_table').tablesorter({widgets: ['zebra']}); | ||
|
|
10 | + }); | ||
|
|
11 | + | ||
|
1 | %h1 User grading results |
|
12 | %h1 User grading results |
|
2 | %h2 Show max scores in submission range |
|
13 | %h2 Show max scores in submission range |
|
3 |
|
14 | ||
|
4 | - if @problem and @problem.errors |
|
15 | - if @problem and @problem.errors |
|
5 | =error_messages_for 'problem' |
|
16 | =error_messages_for 'problem' |
|
6 |
|
17 | ||
|
7 | = render partial: 'submission_range' |
|
18 | = render partial: 'submission_range' |
|
8 |
|
19 | ||
|
9 | - - if @log |
|
||
|
10 | - %h3 Import log |
|
||
|
11 | - %pre.import-log |
|
||
|
12 | - = @log |
|
||
|
13 | - |
|
||
|
14 | %p= link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat |
|
20 | %p= link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat |
|
15 |
|
21 | ||
|
16 | - %table.info |
|
22 | + %table.tablesorter-cafe#my_table{style: 'width:auto;'} |
|
17 | %thead |
|
23 | %thead |
|
18 | - %tr.info-head |
|
24 | + %tr |
|
19 | %th User |
|
25 | %th User |
|
20 | %th Name |
|
26 | %th Name |
|
21 | %th Activated? |
|
27 | %th Activated? |
|
22 | %th Logged in |
|
28 | %th Logged in |
|
23 | %th Contest(s) |
|
29 | %th Contest(s) |
|
24 | - @problems.each do |p| |
|
30 | - @problems.each do |p| |
|
25 | %th= p.name |
|
31 | %th= p.name |
|
26 | %th Total |
|
32 | %th Total |
|
27 | %th Passed |
|
33 | %th Passed |
|
28 | %tbody |
|
34 | %tbody |
|
29 | - @scorearray.each do |sc| |
|
35 | - @scorearray.each do |sc| |
|
30 | %tr{class: cycle('info-even','info-odd')} |
|
36 | %tr{class: cycle('info-even','info-odd')} |
|
31 | - total,num_passed = 0,0 |
|
37 | - total,num_passed = 0,0 |
|
32 | - sc.each_index do |i| |
|
38 | - sc.each_index do |i| |
|
33 | - if i == 0 |
|
39 | - if i == 0 |
|
34 | %td= sc[i].login |
|
40 | %td= sc[i].login |
|
35 | %td= sc[i].full_name |
|
41 | %td= sc[i].full_name |
|
36 | %td= sc[i].activated |
|
42 | %td= sc[i].activated |
|
37 | %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' |
|
43 | %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' |
|
38 | %td= sc[i].contests.collect {|c| c.name}.join(', ') |
|
44 | %td= sc[i].contests.collect {|c| c.name}.join(', ') |
|
39 | - else |
|
45 | - else |
|
40 | %td= sc[i][0] |
|
46 | %td= sc[i][0] |
|
41 | - total += sc[i][0] |
|
47 | - total += sc[i][0] |
|
42 | - num_passed += 1 if sc[i][1] |
|
48 | - num_passed += 1 if sc[i][1] |
|
43 | %td= total |
|
49 | %td= total |
|
44 | %td= num_passed |
|
50 | %td= num_passed |
@@ -1,64 +1,64 | |||||
|
1 | require File.expand_path('../boot', __FILE__) |
|
1 | require File.expand_path('../boot', __FILE__) |
|
2 |
|
2 | ||
|
3 | require 'rails/all' |
|
3 | require 'rails/all' |
|
4 |
|
4 | ||
|
5 | if defined?(Bundler) |
|
5 | if defined?(Bundler) |
|
6 | # If you precompile assets before deploying to production, use this line |
|
6 | # If you precompile assets before deploying to production, use this line |
|
7 | Bundler.require(*Rails.groups(:assets => %w(development test))) |
|
7 | Bundler.require(*Rails.groups(:assets => %w(development test))) |
|
8 | # If you want your assets lazily compiled in production, use this line |
|
8 | # If you want your assets lazily compiled in production, use this line |
|
9 | # Bundler.require(:default, :assets, Rails.env) |
|
9 | # Bundler.require(:default, :assets, Rails.env) |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | module CafeGrader |
|
12 | module CafeGrader |
|
13 | class Application < Rails::Application |
|
13 | class Application < Rails::Application |
|
14 | # Settings in config/environments/* take precedence over those specified here. |
|
14 | # Settings in config/environments/* take precedence over those specified here. |
|
15 | # Application configuration should go into files in config/initializers |
|
15 | # Application configuration should go into files in config/initializers |
|
16 | # -- all .rb files in that directory are automatically loaded. |
|
16 | # -- all .rb files in that directory are automatically loaded. |
|
17 |
|
17 | ||
|
18 | # Custom directories with classes and modules you want to be autoloadable. |
|
18 | # Custom directories with classes and modules you want to be autoloadable. |
|
19 | config.autoload_paths += %W(#{config.root}/lib) |
|
19 | config.autoload_paths += %W(#{config.root}/lib) |
|
20 |
|
20 | ||
|
21 | # Only load the plugins named here, in the order given (default is alphabetical). |
|
21 | # Only load the plugins named here, in the order given (default is alphabetical). |
|
22 | # :all can be used as a placeholder for all plugins not explicitly named. |
|
22 | # :all can be used as a placeholder for all plugins not explicitly named. |
|
23 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] |
|
23 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] |
|
24 |
|
24 | ||
|
25 | # Activate observers that should always be running. |
|
25 | # Activate observers that should always be running. |
|
26 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer |
|
26 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer |
|
27 |
|
27 | ||
|
28 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. |
|
28 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. |
|
29 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. |
|
29 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. |
|
30 | config.time_zone = 'UTC' |
|
30 | config.time_zone = 'UTC' |
|
31 |
|
31 | ||
|
32 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. |
|
32 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. |
|
33 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] |
|
33 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] |
|
34 | config.i18n.default_locale = :en |
|
34 | config.i18n.default_locale = :en |
|
35 |
|
35 | ||
|
36 | # Configure the default encoding used in templates for Ruby 1.9. |
|
36 | # Configure the default encoding used in templates for Ruby 1.9. |
|
37 | config.encoding = "utf-8" |
|
37 | config.encoding = "utf-8" |
|
38 |
|
38 | ||
|
39 | # Configure sensitive parameters which will be filtered from the log file. |
|
39 | # Configure sensitive parameters which will be filtered from the log file. |
|
40 | config.filter_parameters += [:password] |
|
40 | config.filter_parameters += [:password] |
|
41 |
|
41 | ||
|
42 | # Enable escaping HTML in JSON. |
|
42 | # Enable escaping HTML in JSON. |
|
43 | config.active_support.escape_html_entities_in_json = true |
|
43 | config.active_support.escape_html_entities_in_json = true |
|
44 |
|
44 | ||
|
45 | # Use SQL instead of Active Record's schema dumper when creating the database. |
|
45 | # Use SQL instead of Active Record's schema dumper when creating the database. |
|
46 | # This is necessary if your schema can't be completely dumped by the schema dumper, |
|
46 | # This is necessary if your schema can't be completely dumped by the schema dumper, |
|
47 | # like if you have constraints or database-specific column types |
|
47 | # like if you have constraints or database-specific column types |
|
48 | # config.active_record.schema_format = :sql |
|
48 | # config.active_record.schema_format = :sql |
|
49 |
|
49 | ||
|
50 | # Enforce whitelist mode for mass assignment. |
|
50 | # Enforce whitelist mode for mass assignment. |
|
51 | # This will create an empty whitelist of attributes available for mass-assignment for all models |
|
51 | # This will create an empty whitelist of attributes available for mass-assignment for all models |
|
52 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible |
|
52 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible |
|
53 | # parameters by using an attr_accessible or attr_protected declaration. |
|
53 | # parameters by using an attr_accessible or attr_protected declaration. |
|
54 | config.active_record.whitelist_attributes = false |
|
54 | config.active_record.whitelist_attributes = false |
|
55 |
|
55 | ||
|
56 | # Enable the asset pipeline |
|
56 | # Enable the asset pipeline |
|
57 | config.assets.enabled = true |
|
57 | config.assets.enabled = true |
|
58 |
|
58 | ||
|
59 | # Version of your assets, change this if you want to expire all your assets |
|
59 | # Version of your assets, change this if you want to expire all your assets |
|
60 | config.assets.version = '1.0' |
|
60 | config.assets.version = '1.0' |
|
61 |
|
61 | ||
|
62 |
- config.assets.precompile += ['announcement_refresh.js','effects.js','site_update.js','graders.css','problems.css' |
|
62 | + config.assets.precompile += ['announcement_refresh.js','effects.js','site_update.js','graders.css','problems.css'] |
|
63 | end |
|
63 | end |
|
64 | end |
|
64 | end |
deleted file |
You need to be logged in to leave comments.
Login now