Description:
add table sorter and combine user_stat and user_stat_max action into one view
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r430:6e39492e3fa5 - - 11 files changed: 286 inserted, 60 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= sc[i].login
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
@@ -17,3 +17,10
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
@@ -37,9 +37,11
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'
@@ -58,6 +58,8
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)
@@ -152,6 +154,7
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 mail
160 mail
@@ -4,3 +4,4
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
@@ -4,7 +4,8
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
@@ -159,6 +159,8
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
@@ -1,10 +1,12
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
@@ -12,9 +14,9
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
@@ -27,5 +29,4
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.strftime('%Y-%m-%d %H:%M') : ''
32 + %td= l[:max] ? time_ago_in_words(l[:max].in_time_zone) + ' ago' : ''
31 -
@@ -1,3 +1,14
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
@@ -6,16 +17,11
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?
deleted file
You need to be logged in to leave comments. Login now