Description:
- add problem toggle test js reponse (it was forgotten) - change score report to bootstrap-sortable
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r570:0b74eb4e28fa - - 8 files changed: 77 inserted, 25 deleted

@@ -0,0 +1,2
1 + = render partial: 'toggle_button',
2 + locals: {button_id: "#problem-test-#{@problem.id}",button_on: @problem.test_allowed?}
@@ -12,64 +12,68
12 # Gems used only for assets and not required
12 # Gems used only for assets and not required
13 # in production environments by default.
13 # in production environments by default.
14 group :assets do
14 group :assets do
15 gem 'sass-rails', '~> 3.2.6'
15 gem 'sass-rails', '~> 3.2.6'
16 gem 'coffee-rails', '~> 3.2.2'
16 gem 'coffee-rails', '~> 3.2.2'
17
17
18 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
18 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
19 # gem 'therubyracer', :platforms => :ruby
19 # gem 'therubyracer', :platforms => :ruby
20
20
21 gem 'uglifier'
21 gem 'uglifier'
22 end
22 end
23
23
24 gem 'prototype-rails'
24 gem 'prototype-rails'
25
25
26 # To use ActiveModel has_secure_password
26 # To use ActiveModel has_secure_password
27 # gem 'bcrypt-ruby', '~> 3.0.0'
27 # gem 'bcrypt-ruby', '~> 3.0.0'
28
28
29 # To use Jbuilder templates for JSON
29 # To use Jbuilder templates for JSON
30 # gem 'jbuilder'
30 # gem 'jbuilder'
31
31
32 # Use unicorn as the app server
32 # Use unicorn as the app server
33 # gem 'unicorn'
33 # gem 'unicorn'
34
34
35 # Deploy with Capistrano
35 # Deploy with Capistrano
36 # gem 'capistrano'
36 # gem 'capistrano'
37
37
38 # To use debugger
38 # To use debugger
39 # gem 'debugger'
39 # gem 'debugger'
40 #
40 #
41
41
42 #in-place editor
42 #in-place editor
43 gem 'best_in_place', '~> 3.0.1'
43 gem 'best_in_place', '~> 3.0.1'
44
44
45 # jquery addition
45 # jquery addition
46 gem 'jquery-rails'
46 gem 'jquery-rails'
47 gem 'jquery-ui-sass-rails'
47 gem 'jquery-ui-sass-rails'
48 gem 'jquery-timepicker-addon-rails'
48 gem 'jquery-timepicker-addon-rails'
49 gem 'jquery-tablesorter'
49 gem 'jquery-tablesorter'
50
50
51 #syntax highlighter
51 #syntax highlighter
52 gem 'rouge'
52 gem 'rouge'
53
53
54 #add bootstrap
54 #add bootstrap
55 gem 'bootstrap-sass', '~> 3.2.0'
55 gem 'bootstrap-sass', '~> 3.2.0'
56 gem 'bootstrap-switch-rails'
56 gem 'bootstrap-switch-rails'
57 gem 'bootstrap-toggle-rails'
57 gem 'bootstrap-toggle-rails'
58 gem 'autoprefixer-rails'
58 gem 'autoprefixer-rails'
59
59
60 + #bootstrap sortable
61 + gem 'momentjs-rails'
62 + gem 'rails_bootstrap_sortable'
63 +
64 + #ace editor
60 gem 'ace-rails-ap'
65 gem 'ace-rails-ap'
61
66
62 -
63 gem 'haml'
67 gem 'haml'
64 gem 'haml-rails'
68 gem 'haml-rails'
65 gem 'mail'
69 gem 'mail'
66 gem 'rdiscount'
70 gem 'rdiscount'
67 gem 'test-unit'
71 gem 'test-unit'
68 gem 'will_paginate', '~> 3.0.7'
72 gem 'will_paginate', '~> 3.0.7'
69 gem 'dynamic_form'
73 gem 'dynamic_form'
70 gem 'in_place_editing'
74 gem 'in_place_editing'
71 gem 'verification', :git => 'https://github.com/sikachu/verification.git'
75 gem 'verification', :git => 'https://github.com/sikachu/verification.git'
72
76
73 group :test, :development do
77 group :test, :development do
74 gem 'rspec-rails', '~> 2.99.0'
78 gem 'rspec-rails', '~> 2.99.0'
75 end
79 end
@@ -45,153 +45,159
45 actionpack (>= 3.2)
45 actionpack (>= 3.2)
46 railties (>= 3.2)
46 railties (>= 3.2)
47 bootstrap-sass (3.2.0.2)
47 bootstrap-sass (3.2.0.2)
48 sass (~> 3.2)
48 sass (~> 3.2)
49 bootstrap-switch-rails (3.3.3)
49 bootstrap-switch-rails (3.3.3)
50 bootstrap-toggle-rails (2.2.1.0)
50 bootstrap-toggle-rails (2.2.1.0)
51 builder (3.0.4)
51 builder (3.0.4)
52 coffee-rails (3.2.2)
52 coffee-rails (3.2.2)
53 coffee-script (>= 2.2.0)
53 coffee-script (>= 2.2.0)
54 railties (~> 3.2.0)
54 railties (~> 3.2.0)
55 coffee-script (2.3.0)
55 coffee-script (2.3.0)
56 coffee-script-source
56 coffee-script-source
57 execjs
57 execjs
58 coffee-script-source (1.9.0)
58 coffee-script-source (1.9.0)
59 diff-lcs (1.2.5)
59 diff-lcs (1.2.5)
60 dynamic_form (1.1.4)
60 dynamic_form (1.1.4)
61 erubis (2.7.0)
61 erubis (2.7.0)
62 execjs (2.3.0)
62 execjs (2.3.0)
63 haml (4.0.6)
63 haml (4.0.6)
64 tilt
64 tilt
65 haml-rails (0.4)
65 haml-rails (0.4)
66 actionpack (>= 3.1, < 4.1)
66 actionpack (>= 3.1, < 4.1)
67 activesupport (>= 3.1, < 4.1)
67 activesupport (>= 3.1, < 4.1)
68 haml (>= 3.1, < 4.1)
68 haml (>= 3.1, < 4.1)
69 railties (>= 3.1, < 4.1)
69 railties (>= 3.1, < 4.1)
70 hike (1.2.3)
70 hike (1.2.3)
71 i18n (0.7.0)
71 i18n (0.7.0)
72 in_place_editing (1.2.0)
72 in_place_editing (1.2.0)
73 journey (1.0.4)
73 journey (1.0.4)
74 jquery-rails (3.1.2)
74 jquery-rails (3.1.2)
75 railties (>= 3.0, < 5.0)
75 railties (>= 3.0, < 5.0)
76 thor (>= 0.14, < 2.0)
76 thor (>= 0.14, < 2.0)
77 jquery-tablesorter (1.13.4)
77 jquery-tablesorter (1.13.4)
78 railties (>= 3.1, < 5)
78 railties (>= 3.1, < 5)
79 jquery-timepicker-addon-rails (1.4.1)
79 jquery-timepicker-addon-rails (1.4.1)
80 railties (>= 3.1)
80 railties (>= 3.1)
81 jquery-ui-rails (4.0.3)
81 jquery-ui-rails (4.0.3)
82 jquery-rails
82 jquery-rails
83 railties (>= 3.1.0)
83 railties (>= 3.1.0)
84 jquery-ui-sass-rails (4.0.3.0)
84 jquery-ui-sass-rails (4.0.3.0)
85 jquery-rails
85 jquery-rails
86 jquery-ui-rails (= 4.0.3)
86 jquery-ui-rails (= 4.0.3)
87 railties (>= 3.1.0)
87 railties (>= 3.1.0)
88 json (1.8.2)
88 json (1.8.2)
89 mail (2.5.4)
89 mail (2.5.4)
90 mime-types (~> 1.16)
90 mime-types (~> 1.16)
91 treetop (~> 1.4.8)
91 treetop (~> 1.4.8)
92 mime-types (1.25.1)
92 mime-types (1.25.1)
93 + momentjs-rails (2.11.1)
94 + railties (>= 3.1)
93 multi_json (1.10.1)
95 multi_json (1.10.1)
94 mysql2 (0.3.20)
96 mysql2 (0.3.20)
95 polyglot (0.3.5)
97 polyglot (0.3.5)
96 power_assert (0.2.2)
98 power_assert (0.2.2)
97 prototype-rails (3.2.1)
99 prototype-rails (3.2.1)
98 rails (~> 3.2)
100 rails (~> 3.2)
99 rack (1.4.5)
101 rack (1.4.5)
100 rack-cache (1.2)
102 rack-cache (1.2)
101 rack (>= 0.4)
103 rack (>= 0.4)
102 rack-ssl (1.3.4)
104 rack-ssl (1.3.4)
103 rack
105 rack
104 rack-test (0.6.3)
106 rack-test (0.6.3)
105 rack (>= 1.0)
107 rack (>= 1.0)
106 rails (3.2.21)
108 rails (3.2.21)
107 actionmailer (= 3.2.21)
109 actionmailer (= 3.2.21)
108 actionpack (= 3.2.21)
110 actionpack (= 3.2.21)
109 activerecord (= 3.2.21)
111 activerecord (= 3.2.21)
110 activeresource (= 3.2.21)
112 activeresource (= 3.2.21)
111 activesupport (= 3.2.21)
113 activesupport (= 3.2.21)
112 bundler (~> 1.0)
114 bundler (~> 1.0)
113 railties (= 3.2.21)
115 railties (= 3.2.21)
116 + rails_bootstrap_sortable (2.0.0)
117 + momentjs-rails (~> 2, >= 2.8.3)
114 railties (3.2.21)
118 railties (3.2.21)
115 actionpack (= 3.2.21)
119 actionpack (= 3.2.21)
116 activesupport (= 3.2.21)
120 activesupport (= 3.2.21)
117 rack-ssl (~> 1.3.2)
121 rack-ssl (~> 1.3.2)
118 rake (>= 0.8.7)
122 rake (>= 0.8.7)
119 rdoc (~> 3.4)
123 rdoc (~> 3.4)
120 thor (>= 0.14.6, < 2.0)
124 thor (>= 0.14.6, < 2.0)
121 rake (10.4.2)
125 rake (10.4.2)
122 rdiscount (2.1.8)
126 rdiscount (2.1.8)
123 rdoc (3.12.2)
127 rdoc (3.12.2)
124 json (~> 1.4)
128 json (~> 1.4)
125 rouge (1.8.0)
129 rouge (1.8.0)
126 rspec-collection_matchers (1.1.2)
130 rspec-collection_matchers (1.1.2)
127 rspec-expectations (>= 2.99.0.beta1)
131 rspec-expectations (>= 2.99.0.beta1)
128 rspec-core (2.99.2)
132 rspec-core (2.99.2)
129 rspec-expectations (2.99.2)
133 rspec-expectations (2.99.2)
130 diff-lcs (>= 1.1.3, < 2.0)
134 diff-lcs (>= 1.1.3, < 2.0)
131 rspec-mocks (2.99.3)
135 rspec-mocks (2.99.3)
132 rspec-rails (2.99.0)
136 rspec-rails (2.99.0)
133 actionpack (>= 3.0)
137 actionpack (>= 3.0)
134 activemodel (>= 3.0)
138 activemodel (>= 3.0)
135 activesupport (>= 3.0)
139 activesupport (>= 3.0)
136 railties (>= 3.0)
140 railties (>= 3.0)
137 rspec-collection_matchers
141 rspec-collection_matchers
138 rspec-core (~> 2.99.0)
142 rspec-core (~> 2.99.0)
139 rspec-expectations (~> 2.99.0)
143 rspec-expectations (~> 2.99.0)
140 rspec-mocks (~> 2.99.0)
144 rspec-mocks (~> 2.99.0)
141 sass (3.4.11)
145 sass (3.4.11)
142 sass-rails (3.2.6)
146 sass-rails (3.2.6)
143 railties (~> 3.2.0)
147 railties (~> 3.2.0)
144 sass (>= 3.1.10)
148 sass (>= 3.1.10)
145 tilt (~> 1.3)
149 tilt (~> 1.3)
146 select2-rails (4.0.1)
150 select2-rails (4.0.1)
147 thor (~> 0.14)
151 thor (~> 0.14)
148 sprockets (2.2.3)
152 sprockets (2.2.3)
149 hike (~> 1.2)
153 hike (~> 1.2)
150 multi_json (~> 1.0)
154 multi_json (~> 1.0)
151 rack (~> 1.0)
155 rack (~> 1.0)
152 tilt (~> 1.1, != 1.3.0)
156 tilt (~> 1.1, != 1.3.0)
153 test-unit (3.0.9)
157 test-unit (3.0.9)
154 power_assert
158 power_assert
155 thor (0.19.1)
159 thor (0.19.1)
156 tilt (1.4.1)
160 tilt (1.4.1)
157 treetop (1.4.15)
161 treetop (1.4.15)
158 polyglot
162 polyglot
159 polyglot (>= 0.3.1)
163 polyglot (>= 0.3.1)
160 tzinfo (0.3.43)
164 tzinfo (0.3.43)
161 uglifier (2.7.0)
165 uglifier (2.7.0)
162 execjs (>= 0.3.0)
166 execjs (>= 0.3.0)
163 json (>= 1.8.0)
167 json (>= 1.8.0)
164 will_paginate (3.0.7)
168 will_paginate (3.0.7)
165
169
166 PLATFORMS
170 PLATFORMS
167 ruby
171 ruby
168
172
169 DEPENDENCIES
173 DEPENDENCIES
170 ace-rails-ap
174 ace-rails-ap
171 autoprefixer-rails
175 autoprefixer-rails
172 best_in_place (~> 3.0.1)
176 best_in_place (~> 3.0.1)
173 bootstrap-sass (~> 3.2.0)
177 bootstrap-sass (~> 3.2.0)
174 bootstrap-switch-rails
178 bootstrap-switch-rails
175 bootstrap-toggle-rails
179 bootstrap-toggle-rails
176 coffee-rails (~> 3.2.2)
180 coffee-rails (~> 3.2.2)
177 dynamic_form
181 dynamic_form
178 haml
182 haml
179 haml-rails
183 haml-rails
180 in_place_editing
184 in_place_editing
181 jquery-rails
185 jquery-rails
182 jquery-tablesorter
186 jquery-tablesorter
183 jquery-timepicker-addon-rails
187 jquery-timepicker-addon-rails
184 jquery-ui-sass-rails
188 jquery-ui-sass-rails
185 mail
189 mail
190 + momentjs-rails
186 mysql2
191 mysql2
187 prototype-rails
192 prototype-rails
188 rails (= 3.2.21)
193 rails (= 3.2.21)
194 + rails_bootstrap_sortable
189 rdiscount
195 rdiscount
190 rouge
196 rouge
191 rspec-rails (~> 2.99.0)
197 rspec-rails (~> 2.99.0)
192 sass-rails (~> 3.2.6)
198 sass-rails (~> 3.2.6)
193 select2-rails
199 select2-rails
194 test-unit
200 test-unit
195 uglifier
201 uglifier
196 verification!
202 verification!
197 will_paginate (~> 3.0.7)
203 will_paginate (~> 3.0.7)
@@ -1,35 +1,35
1 // This is a manifest file that'll be compiled into application.js, which will include all the files
1 // This is a manifest file that'll be compiled into application.js, which will include all the files
2 // listed below.
2 // listed below.
3 //
3 //
4 // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
4 // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5 // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 //
6 //
7 // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
7 // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 // the compiled file.
8 // the compiled file.
9 //
9 //
10 // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
10 // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11 // GO AFTER THE REQUIRES BELOW.
11 // GO AFTER THE REQUIRES BELOW.
12 //
12 //
13 //= require jquery
13 //= require jquery
14 //= require jquery_ujs
14 //= require jquery_ujs
15 //= require jquery.ui.all
15 //= require jquery.ui.all
16 //= require bootstrap-sprockets
16 //= require bootstrap-sprockets
17 - //x= require bootstrap-switch
17 + //= require moment
18 - //= require bootstrap-toggle
18 + //= require bootstrap-sortable
19 //= require select2
19 //= require select2
20 //= require custom
20 //= require custom
21 //= require ace-rails-ap
21 //= require ace-rails-ap
22 //= require ace/mode-c_cpp
22 //= require ace/mode-c_cpp
23 //= require ace/mode-ruby
23 //= require ace/mode-ruby
24 //= require ace/mode-pascal
24 //= require ace/mode-pascal
25 //= require ace/mode-javascript
25 //= require ace/mode-javascript
26 //= require ace/mode-java
26 //= require ace/mode-java
27 //= require ace/theme-merbivore
27 //= require ace/theme-merbivore
28
28
29
29
30 // since this is after blank line, it is not downloaded
30 // since this is after blank line, it is not downloaded
31 //x= require prototype
31 //x= require prototype
32 //x= require prototype_ujs
32 //x= require prototype_ujs
33 //x= require effects
33 //x= require effects
34 //x= require dragdrop
34 //x= require dragdrop
35 //x= require controls
35 //x= require controls
@@ -1,47 +1,47
1 $(document).on 'change', '.btn-file :file', ->
1 $(document).on 'change', '.btn-file :file', ->
2 input = $(this)
2 input = $(this)
3 numFiles = if input.get(0).files then input.get(0).files.length else 1
3 numFiles = if input.get(0).files then input.get(0).files.length else 1
4 label = input.val().replace(/\\/g, '/').replace(/.*\//, '')
4 label = input.val().replace(/\\/g, '/').replace(/.*\//, '')
5 input.trigger 'fileselect', [
5 input.trigger 'fileselect', [
6 numFiles
6 numFiles
7 label
7 label
8 ]
8 ]
9 return
9 return
10
10
11
11
12 # document ready
12 # document ready
13
13
14 $ ->
14 $ ->
15 $(".select2").select2()
15 $(".select2").select2()
16 #$(".bootstrap-switch").bootstrapSwitch()
16 #$(".bootstrap-switch").bootstrapSwitch()
17 $(".bootstrap-toggle").bootstrapToggle()
17 $(".bootstrap-toggle").bootstrapToggle()
18 $('.btn-file :file').on 'fileselect', (event, numFiles, label) ->
18 $('.btn-file :file').on 'fileselect', (event, numFiles, label) ->
19 input = $(this).parents('.input-group').find(':text')
19 input = $(this).parents('.input-group').find(':text')
20 log = if numFiles > 1 then numFiles + ' files selected' else label
20 log = if numFiles > 1 then numFiles + ' files selected' else label
21 if input.length
21 if input.length
22 input.val log
22 input.val log
23 else
23 else
24 if log
24 if log
25 alert log
25 alert log
26 return
26 return
27 $(".go-button").on 'click', (event) ->
27 $(".go-button").on 'click', (event) ->
28 link = $(this).attr("data-source")
28 link = $(this).attr("data-source")
29 url = $(link).val()
29 url = $(link).val()
30 if url
30 if url
31 window.location.href = url
31 window.location.href = url
32 return
32 return
33 $('.ajax-toggle').on 'click', (event) ->
33 $('.ajax-toggle').on 'click', (event) ->
34 target = $(event.target)
34 target = $(event.target)
35 target.removeClass 'btn-default'
35 target.removeClass 'btn-default'
36 target.removeClass 'btn-success'
36 target.removeClass 'btn-success'
37 target.addClass 'btn-warning'
37 target.addClass 'btn-warning'
38 target.text '...'
38 target.text '...'
39 return
39 return
40 -
40 +
41 #ace editor
41 #ace editor
42 e = ace.edit("editor")
42 e = ace.edit("editor")
43 e.setTheme('ace/theme/merbivore')
43 e.setTheme('ace/theme/merbivore')
44 e.getSession().setTabSize(2)
44 e.getSession().setTabSize(2)
45 e.getSession().setUseSoftTabs(true)
45 e.getSession().setUseSoftTabs(true)
46
46
47 return
47 return
@@ -1,182 +1,195
1 /*
1 /*
2 * This is a manifest file that'll be compiled into application.css, which will include all the files
2 * This is a manifest file that'll be compiled into application.css, which will include all the files
3 * listed below.
3 * listed below.
4 *
4 *
5 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
5 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
6 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 *
7 *
8 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
8 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 * compiled file so the styles you add here take precedence over styles defined in any styles
9 * compiled file so the styles you add here take precedence over styles defined in any styles
10 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
10 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11 * file per style scope.
11 * file per style scope.
12 *
12 *
13 // bootstrap says that we should not do this, but @import each file instead
13 // bootstrap says that we should not do this, but @import each file instead
14 # *= require_tree .
14 # *= require_tree .
15 # *= require_self
15 # *= require_self
16 */
16 */
17
17
18 @import jquery.ui.all
18 @import jquery.ui.all
19 @import jquery.ui.core
19 @import jquery.ui.core
20 @import jquery.ui.core
20 @import jquery.ui.core
21 @import jquery.ui.theme
21 @import jquery.ui.theme
22 @import jquery.ui.datepicker
22 @import jquery.ui.datepicker
23 @import jquery.ui.slider
23 @import jquery.ui.slider
24 @import jquery-ui-timepicker-addon
24 @import jquery-ui-timepicker-addon
25 @import jquery-tablesorter/theme.metro-dark
25 @import jquery-tablesorter/theme.metro-dark
26 @import tablesorter-theme.cafe
26 @import tablesorter-theme.cafe
27
27
28 //bootstrap
28 //bootstrap
29 @import bootstrap-sprockets
29 @import bootstrap-sprockets
30 @import bootstrap
30 @import bootstrap
31 @import select2
31 @import select2
32 @import select2-bootstrap
32 @import select2-bootstrap
33 //@import bootstrap3-switch
33 //@import bootstrap3-switch
34 @import bootstrap-toggle
34 @import bootstrap-toggle
35 + @import bootstrap-sortable
35
36
36 //bootstrap navbar color (from)
37 //bootstrap navbar color (from)
37 $bgDefault : #19197b
38 $bgDefault : #19197b
38 $bgHighlight : #06064b
39 $bgHighlight : #06064b
39 $colDefault : #8e8eb4
40 $colDefault : #8e8eb4
40 $colHighlight : #ffffff
41 $colHighlight : #ffffff
41 $dropDown : false
42 $dropDown : false
42 .navbar-default
43 .navbar-default
43 background-color: $bgDefault
44 background-color: $bgDefault
44 border-color: $bgHighlight
45 border-color: $bgHighlight
45 .navbar-brand
46 .navbar-brand
46 color: $colDefault
47 color: $colDefault
47 &:hover, &:focus
48 &:hover, &:focus
48 color: $colHighlight
49 color: $colHighlight
49 .navbar-text
50 .navbar-text
50 color: $colDefault
51 color: $colDefault
51 .navbar-nav
52 .navbar-nav
52 > li
53 > li
53 > a
54 > a
54 color: $colDefault
55 color: $colDefault
55 &:hover, &:focus
56 &:hover, &:focus
56 color: $colHighlight
57 color: $colHighlight
57 @if $dropDown
58 @if $dropDown
58 > .dropdown-menu
59 > .dropdown-menu
59 background-color: $bgDefault
60 background-color: $bgDefault
60 > li
61 > li
61 > a
62 > a
62 color: $colDefault
63 color: $colDefault
63 &:hover, &:focus
64 &:hover, &:focus
64 color: $colHighlight
65 color: $colHighlight
65 background-color: $bgHighlight
66 background-color: $bgHighlight
66 > .divider
67 > .divider
67 background-color: $bgHighlight
68 background-color: $bgHighlight
68 @if $dropDown
69 @if $dropDown
69 .open .dropdown-menu > .active
70 .open .dropdown-menu > .active
70 > a, > a:hover, > a:focus
71 > a, > a:hover, > a:focus
71 color: $colHighlight
72 color: $colHighlight
72 background-color: $bgHighlight
73 background-color: $bgHighlight
73 > .active
74 > .active
74 > a, > a:hover, > a:focus
75 > a, > a:hover, > a:focus
75 color: $colHighlight
76 color: $colHighlight
76 background-color: $bgHighlight
77 background-color: $bgHighlight
77 > .open
78 > .open
78 > a, > a:hover, > a:focus
79 > a, > a:hover, > a:focus
79 color: $colHighlight
80 color: $colHighlight
80 background-color: $bgHighlight
81 background-color: $bgHighlight
81 .navbar-toggle
82 .navbar-toggle
82 border-color: $bgHighlight
83 border-color: $bgHighlight
83 &:hover, &:focus
84 &:hover, &:focus
84 background-color: $bgHighlight
85 background-color: $bgHighlight
85 .icon-bar
86 .icon-bar
86 background-color: $colDefault
87 background-color: $colDefault
87 .navbar-collapse,
88 .navbar-collapse,
88 .navbar-form
89 .navbar-form
89 border-color: $colDefault
90 border-color: $colDefault
90 .navbar-link
91 .navbar-link
91 color: $colDefault
92 color: $colDefault
92 &:hover
93 &:hover
93 color: $colHighlight
94 color: $colHighlight
94 @media (max-width: 767px)
95 @media (max-width: 767px)
95 .navbar-default .navbar-nav .open .dropdown-menu
96 .navbar-default .navbar-nav .open .dropdown-menu
96 > li > a
97 > li > a
97 color: $colDefault
98 color: $colDefault
98 &:hover, &:focus
99 &:hover, &:focus
99 color: $colHighlight
100 color: $colHighlight
100 > .active
101 > .active
101 > a, > a:hover, > a:focus
102 > a, > a:hover, > a:focus
102 color: $colHighlight
103 color: $colHighlight
103 background-color: $bgHighlight
104 background-color: $bgHighlight
104
105
105 .secondnavbar
106 .secondnavbar
106 top: 50px
107 top: 50px
107
108
109 +
110 + // --------------- bootstrap file upload ----------------------
108 .btn-file
111 .btn-file
109 position: relative
112 position: relative
110 overflow: hidden
113 overflow: hidden
111
114
112 .btn-file input[type=file]
115 .btn-file input[type=file]
113 position: absolute
116 position: absolute
114 top: 0
117 top: 0
115 right: 0
118 right: 0
116 min-width: 100%
119 min-width: 100%
117 min-height: 100%
120 min-height: 100%
118 font-size: 100px
121 font-size: 100px
119 text-align: right
122 text-align: right
120 filter: alpha(opacity=0)
123 filter: alpha(opacity=0)
121 opacity: 0
124 opacity: 0
122 outline: none
125 outline: none
123 background: white
126 background: white
124 cursor: inherit
127 cursor: inherit
125 display: block
128 display: block
126
129
127 body
130 body
128 background: white image-url("topbg.jpg") repeat-x top center
131 background: white image-url("topbg.jpg") repeat-x top center
129 //font-size: 13px
132 //font-size: 13px
130 //font-family: Tahoma, "sans-serif"
133 //font-family: Tahoma, "sans-serif"
131 margin: 10px
134 margin: 10px
132 padding: 10px
135 padding: 10px
133 - padding-top: 40px
136 + padding-top: 60px
134
137
138 + // ------------------ bootstrap sortable --------------------
139 + table.sortable th
140 + padding-right: 20px !important
141 + span.sign
142 + right: -15px !important
143 + &.text-right
144 + padding-left: 20px !important
145 + padding-right: 8px !important
146 + &:after, span.sign
147 + left: -15px !important
135
148
136 input
149 input
137 font-family: Tahoma, "sans-serif"
150 font-family: Tahoma, "sans-serif"
138
151
139
152
140 h1
153 h1
141 font-size: 24px
154 font-size: 24px
142 color: #334488
155 color: #334488
143 line-height: 2em
156 line-height: 2em
144
157
145
158
146 h2
159 h2
147 font-size: 18px
160 font-size: 18px
148 color: #5566bb
161 color: #5566bb
149 line-height: 1.5em
162 line-height: 1.5em
150
163
151
164
152 hr
165 hr
153 border-top: 1px solid #dddddd
166 border-top: 1px solid #dddddd
154 border-bottom: 1px solid #eeeeee
167 border-bottom: 1px solid #eeeeee
155
168
156
169
157 //#a
170 //#a
158 // color: #6666cc
171 // color: #6666cc
159 // text-decoration: none
172 // text-decoration: none
160 //
173 //
161 // &:link, &:visited
174 // &:link, &:visited
162 // color: #6666cc
175 // color: #6666cc
163 // text-decoration: none
176 // text-decoration: none
164 //
177 //
165 // &:hover, &:focus
178 // &:hover, &:focus
166 // color: #111166
179 // color: #111166
167 // text-decoration: none
180 // text-decoration: none
168
181
169
182
170 div
183 div
171 &.userbar
184 &.userbar
172 line-height: 1.5em
185 line-height: 1.5em
173 text-align: right
186 text-align: right
174 font-size: 12px
187 font-size: 12px
175
188
176 &.title
189 &.title
177 padding: 10px 0px
190 padding: 10px 0px
178 line-height: 1.5em
191 line-height: 1.5em
179 font-size: 13px
192 font-size: 13px
180
193
181 span.contest-over-msg
194 span.contest-over-msg
182 font-size: 15px
195 font-size: 15px
@@ -1,129 +1,154
1 class ReportController < ApplicationController
1 class ReportController < ApplicationController
2
2
3 before_filter :admin_authorization, only: [:login_stat,:submission_stat, :stuck, :cheat_report, :cheat_scruntinize]
3 before_filter :admin_authorization, only: [:login_stat,:submission_stat, :stuck, :cheat_report, :cheat_scruntinize]
4
4
5 before_filter(only: [:problem_hof]) { |c|
5 before_filter(only: [:problem_hof]) { |c|
6 return false unless authenticate
6 return false unless authenticate
7
7
8 if GraderConfiguration["right.user_view_submission"]
8 if GraderConfiguration["right.user_view_submission"]
9 return true;
9 return true;
10 end
10 end
11
11
12 admin_authorization
12 admin_authorization
13 }
13 }
14
14
15 + def score
16 + if params[:commit] == 'download csv'
17 + @problems = Problem.all
18 + else
19 + @problems = Problem.find_available_problems
20 + end
21 + @users = User.includes(:contests, :contest_stat).where(enabled: true) #find(:all, :include => [:contests, :contest_stat]).where(enabled: true)
22 + @scorearray = Array.new
23 + @users.each do |u|
24 + ustat = Array.new
25 + ustat[0] = u
26 + @problems.each do |p|
27 + sub = Submission.find_last_by_user_and_problem(u.id,p.id)
28 + if (sub!=nil) and (sub.points!=nil) and p and p.full_score
29 + ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
30 + else
31 + ustat << [0,false]
32 + end
33 + end
34 + @scorearray << ustat
35 + end
36 + if params[:commit] == 'download csv' then
37 + csv = gen_csv_from_scorearray(@scorearray,@problems)
38 + send_data csv, filename: 'last_score.csv'
39 + else
40 + render template: 'user_admin/user_stat'
41 + end
42 +
43 + end
44 +
15 def login_stat
45 def login_stat
16 @logins = Array.new
46 @logins = Array.new
17
47
18 date_and_time = '%Y-%m-%d %H:%M'
48 date_and_time = '%Y-%m-%d %H:%M'
19 begin
49 begin
20 md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/)
50 md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/)
21 @since_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i)
51 @since_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i)
22 rescue
52 rescue
23 @since_time = DateTime.new(1000,1,1)
53 @since_time = DateTime.new(1000,1,1)
24 end
54 end
25 begin
55 begin
26 md = params[:until_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/)
56 md = params[:until_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/)
27 @until_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i)
57 @until_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i)
28 rescue
58 rescue
29 @until_time = DateTime.new(3000,1,1)
59 @until_time = DateTime.new(3000,1,1)
30 end
60 end
31
61
32 User.all.each do |user|
62 User.all.each do |user|
33 @logins << { id: user.id,
63 @logins << { id: user.id,
34 login: user.login,
64 login: user.login,
35 full_name: user.full_name,
65 full_name: user.full_name,
36 count: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
66 count: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
37 user.id,@since_time,@until_time)
67 user.id,@since_time,@until_time)
38 .count(:id),
68 .count(:id),
39 min: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
69 min: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
40 user.id,@since_time,@until_time)
70 user.id,@since_time,@until_time)
41 .minimum(:created_at),
71 .minimum(:created_at),
42 max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
72 max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
43 user.id,@since_time,@until_time)
73 user.id,@since_time,@until_time)
44 .maximum(:created_at),
74 .maximum(:created_at),
45 ip: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
75 ip: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
46 user.id,@since_time,@until_time)
76 user.id,@since_time,@until_time)
47 .select(:ip_address).uniq
77 .select(:ip_address).uniq
48
78
49 }
79 }
50 end
80 end
51 end
81 end
52
82
53 def submission_stat
83 def submission_stat
54
84
55 date_and_time = '%Y-%m-%d %H:%M'
85 date_and_time = '%Y-%m-%d %H:%M'
56 begin
86 begin
57 @since_time = DateTime.strptime(params[:since_datetime],date_and_time)
87 @since_time = DateTime.strptime(params[:since_datetime],date_and_time)
58 rescue
88 rescue
59 @since_time = DateTime.new(1000,1,1)
89 @since_time = DateTime.new(1000,1,1)
60 end
90 end
61 begin
91 begin
62 @until_time = DateTime.strptime(params[:until_datetime],date_and_time)
92 @until_time = DateTime.strptime(params[:until_datetime],date_and_time)
63 rescue
93 rescue
64 @until_time = DateTime.new(3000,1,1)
94 @until_time = DateTime.new(3000,1,1)
65 end
95 end
66
96
67 @submissions = {}
97 @submissions = {}
68
98
69 User.find_each do |user|
99 User.find_each do |user|
70 @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } }
100 @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } }
71 end
101 end
72
102
73 Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s|
103 Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s|
74 if @submissions[s.user_id]
104 if @submissions[s.user_id]
75 if not @submissions[s.user_id][:sub].has_key?(s.problem_id)
105 if not @submissions[s.user_id][:sub].has_key?(s.problem_id)
76 - a = nil
106 + a = Problem.find_by_id(s.problem_id)
77 - begin
78 - a = Problem.find(s.problem_id)
79 - rescue
80 - a = nil
81 - end
82 @submissions[s.user_id][:sub][s.problem_id] =
107 @submissions[s.user_id][:sub][s.problem_id] =
83 { prob_name: (a ? a.full_name : '(NULL)'),
108 { prob_name: (a ? a.full_name : '(NULL)'),
84 sub_ids: [s.id] }
109 sub_ids: [s.id] }
85 else
110 else
86 @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id
111 @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id
87 end
112 end
88 @submissions[s.user_id][:count] += 1
113 @submissions[s.user_id][:count] += 1
89 end
114 end
90 end
115 end
91 end
116 end
92
117
93 def problem_hof
118 def problem_hof
94 # gen problem list
119 # gen problem list
95 @user = User.find(session[:user_id])
120 @user = User.find(session[:user_id])
96 @problems = @user.available_problems
121 @problems = @user.available_problems
97
122
98 # get selected problems or the default
123 # get selected problems or the default
99 if params[:id]
124 if params[:id]
100 begin
125 begin
101 @problem = Problem.available.find(params[:id])
126 @problem = Problem.available.find(params[:id])
102 rescue
127 rescue
103 redirect_to action: :problem_hof
128 redirect_to action: :problem_hof
104 flash[:notice] = 'Error: submissions for that problem are not viewable.'
129 flash[:notice] = 'Error: submissions for that problem are not viewable.'
105 return
130 return
106 end
131 end
107 end
132 end
108
133
109 return unless @problem
134 return unless @problem
110
135
111 @by_lang = {} #aggregrate by language
136 @by_lang = {} #aggregrate by language
112
137
113 range =65
138 range =65
114 @histogram = { data: Array.new(range,0), summary: {} }
139 @histogram = { data: Array.new(range,0), summary: {} }
115 @summary = {count: 0, solve: 0, attempt: 0}
140 @summary = {count: 0, solve: 0, attempt: 0}
116 user = Hash.new(0)
141 user = Hash.new(0)
117 Submission.where(problem_id: @problem.id).find_each do |sub|
142 Submission.where(problem_id: @problem.id).find_each do |sub|
118 #histogram
143 #histogram
119 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
144 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
120 @histogram[:data][d.to_i] += 1 if d < range
145 @histogram[:data][d.to_i] += 1 if d < range
121
146
122 next unless sub.points
147 next unless sub.points
123 @summary[:count] += 1
148 @summary[:count] += 1
124 user[sub.user_id] = [user[sub.user_id], (sub.points >= @problem.full_score) ? 1 : 0].max
149 user[sub.user_id] = [user[sub.user_id], (sub.points >= @problem.full_score) ? 1 : 0].max
125
150
126 lang = Language.find_by_id(sub.language_id)
151 lang = Language.find_by_id(sub.language_id)
127 next unless lang
152 next unless lang
128 next unless sub.points >= @problem.full_score
153 next unless sub.points >= @problem.full_score
129
154
@@ -1,59 +1,61
1 - - content_for :header do
1 + /- content_for :header do
2 - = javascript_include_tag 'local_jquery'
2 + / = javascript_include_tag 'local_jquery'
3 - = stylesheet_link_tag 'tablesorter-theme.cafe'
3 + / = stylesheet_link_tag 'tablesorter-theme.cafe'
4
4
5 %script{:type=>"text/javascript"}
5 %script{:type=>"text/javascript"}
6 $(function () {
6 $(function () {
7 $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} );
7 $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} );
8 $('#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({widgets: ['zebra']});
9 + /$('#my_table').tablesorter({widgets: ['zebra']});
10 });
10 });
11
11
12 %h1 User grading results
12 %h1 User grading results
13 %h2= params[:action] == 'user_stat' ? "Show scores from latest submission" : "Show max scores in submission range"
13 %h2= params[:action] == 'user_stat' ? "Show scores from latest submission" : "Show max scores in submission range"
14
14
15
15
16 - if @problem and @problem.errors
16 - if @problem and @problem.errors
17 =error_messages_for 'problem'
17 =error_messages_for 'problem'
18
18
19 = render partial: 'submission_range'
19 = render partial: 'submission_range'
20
20
21 - if params[:action] == 'user_stat'
21 - if params[:action] == 'user_stat'
22 %h3 Latest score
22 %h3 Latest score
23 = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat, commit: 'download csv'
23 = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat, commit: 'download csv'
24 - else
24 - else
25 %h3 Max score
25 %h3 Max score
26 = link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat
26 = link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat
27 = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat_max, commit: 'download csv'
27 = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat_max, commit: 'download csv'
28
28
29 - %table.tablesorter-cafe#my_table
29 + %table.table.sortable.table-striped.table-bordered
30 %thead
30 %thead
31 %tr
31 %tr
32 - %th User
32 + %th Login
33 %th Name
33 %th Name
34 %th Activated?
34 %th Activated?
35 - %th Logged in
35 + %th Logged_in
36 %th Contest(s)
36 %th Contest(s)
37 %th Remark
37 %th Remark
38 - @problems.each do |p|
38 - @problems.each do |p|
39 - %th= p.name
39 + %th.text-right= p.name
40 - %th Total
40 + %th.text-right Total
41 - %th Passed
41 + %th.text-right Passed
42 %tbody
42 %tbody
43 - @scorearray.each do |sc|
43 - @scorearray.each do |sc|
44 - %tr{class: cycle('info-even','info-odd')}
44 + %tr
45 - total,num_passed = 0,0
45 - total,num_passed = 0,0
46 - sc.each_index do |i|
46 - sc.each_index do |i|
47 - if i == 0
47 - if i == 0
48 %td= link_to sc[i].login, controller: 'users', action: 'profile', id: sc[i]
48 %td= link_to sc[i].login, controller: 'users', action: 'profile', id: sc[i]
49 %td= sc[i].full_name
49 %td= sc[i].full_name
50 %td= sc[i].activated
50 %td= sc[i].activated
51 %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no'
51 %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no'
52 %td= sc[i].contests.collect {|c| c.name}.join(', ')
52 %td= sc[i].contests.collect {|c| c.name}.join(', ')
53 %td= sc[i].remark
53 %td= sc[i].remark
54 - else
54 - else
55 - %td= sc[i][0]
55 + %td.text-right= sc[i][0]
56 - total += sc[i][0]
56 - total += sc[i][0]
57 - num_passed += 1 if sc[i][1]
57 - num_passed += 1 if sc[i][1]
58 - %td= total
58 + %td.text-right= total
59 - %td= num_passed
59 + %td.text-right= num_passed
60 + :javascript
61 + $.bootstrapSortable(true,'reversed')
You need to be logged in to leave comments. Login now