Description:
add datatable - now admin can login without checking agreement
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r691:81655bc0fe60 - - 7 files changed: 46 inserted, 19 deleted

@@ -1,91 +1,91
1 source 'https://rubygems.org'
1 source 'https://rubygems.org'
2
2
3 #rails
3 #rails
4 gem 'rails', '~>4.2.0'
4 gem 'rails', '~>4.2.0'
5 gem 'activerecord-session_store'
5 gem 'activerecord-session_store'
6
6
7
7
8 # Bundle edge Rails instead:
8 # Bundle edge Rails instead:
9 # gem 'rails', :git => 'git://github.com/rails/rails.git'
9 # gem 'rails', :git => 'git://github.com/rails/rails.git'
10
10
11 #---------------- database ---------------------
11 #---------------- database ---------------------
12 #the database
12 #the database
13 gem 'mysql2'
13 gem 'mysql2'
14 #for testing
14 #for testing
15 gem 'sqlite3'
15 gem 'sqlite3'
16 #for dumping database into yaml
16 #for dumping database into yaml
17 gem 'yaml_db'
17 gem 'yaml_db'
18
18
19 # Gems used only for assets and not required
19 # Gems used only for assets and not required
20 # in production environments by default.
20 # in production environments by default.
21 gem 'sass-rails'
21 gem 'sass-rails'
22 gem 'coffee-rails'
22 gem 'coffee-rails'
23
23
24 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
24 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
25 # gem 'therubyracer', :platforms => :ruby
25 # gem 'therubyracer', :platforms => :ruby
26
26
27 gem 'uglifier'
27 gem 'uglifier'
28
28
29 gem 'haml'
29 gem 'haml'
30 gem 'haml-rails'
30 gem 'haml-rails'
31 # gem 'prototype-rails'
31 # gem 'prototype-rails'
32
32
33 # To use ActiveModel has_secure_password
33 # To use ActiveModel has_secure_password
34 # gem 'bcrypt-ruby', '~> 3.0.0'
34 # gem 'bcrypt-ruby', '~> 3.0.0'
35
35
36 # To use Jbuilder templates for JSON
36 # To use Jbuilder templates for JSON
37 # gem 'jbuilder'
37 # gem 'jbuilder'
38
38
39 # Use unicorn as the app server
39 # Use unicorn as the app server
40 # gem 'unicorn'
40 # gem 'unicorn'
41
41
42 # Deploy with Capistrano
42 # Deploy with Capistrano
43 # gem 'capistrano'
43 # gem 'capistrano'
44
44
45 # To use debugger
45 # To use debugger
46 # gem 'debugger'
46 # gem 'debugger'
47 #
47 #
48
48
49 #in-place editor
49 #in-place editor
50 gem 'best_in_place', '~> 3.0.1'
50 gem 'best_in_place', '~> 3.0.1'
51
51
52 # jquery addition
52 # jquery addition
53 gem 'jquery-rails'
53 gem 'jquery-rails'
54 gem 'jquery-ui-rails'
54 gem 'jquery-ui-rails'
55 gem 'jquery-timepicker-addon-rails'
55 gem 'jquery-timepicker-addon-rails'
56 gem 'jquery-tablesorter'
56 gem 'jquery-tablesorter'
57 gem 'jquery-countdown-rails'
57 gem 'jquery-countdown-rails'
58
58
59 #syntax highlighter
59 #syntax highlighter
60 gem 'rouge'
60 gem 'rouge'
61
61
62 - #add bootstrap
62 + #bootstrap add-ons
63 gem 'bootstrap-sass', '~> 3.2.0'
63 gem 'bootstrap-sass', '~> 3.2.0'
64 gem 'bootstrap-switch-rails'
64 gem 'bootstrap-switch-rails'
65 gem 'bootstrap-toggle-rails'
65 gem 'bootstrap-toggle-rails'
66 gem 'autoprefixer-rails'
66 gem 'autoprefixer-rails'
67 -
68 - #bootstrap sortable
69 gem 'momentjs-rails'
67 gem 'momentjs-rails'
70 gem 'rails_bootstrap_sortable'
68 gem 'rails_bootstrap_sortable'
69 + gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
70 + gem 'jquery-datatables-rails'
71
71
72 #----------- user interface -----------------
72 #----------- user interface -----------------
73 #select 2
73 #select 2
74 gem 'select2-rails'
74 gem 'select2-rails'
75 #ace editor
75 #ace editor
76 gem 'ace-rails-ap'
76 gem 'ace-rails-ap'
77 #paginator
77 #paginator
78 gem 'will_paginate', '~> 3.0.7'
78 gem 'will_paginate', '~> 3.0.7'
79
79
80 gem 'mail'
80 gem 'mail'
81 gem 'rdiscount'
81 gem 'rdiscount'
82 gem 'dynamic_form'
82 gem 'dynamic_form'
83 gem 'in_place_editing'
83 gem 'in_place_editing'
84 gem 'verification', :git => 'https://github.com/sikachu/verification.git'
84 gem 'verification', :git => 'https://github.com/sikachu/verification.git'
85
85
86
86
87 #---------------- testiing -----------------------
87 #---------------- testiing -----------------------
88 gem 'minitest-reporters'
88 gem 'minitest-reporters'
89
89
90 #---------------- for console --------------------
90 #---------------- for console --------------------
91 gem 'fuzzy-string-match'
91 gem 'fuzzy-string-match'
@@ -1,235 +1,244
1 GIT
1 GIT
2 remote: https://github.com/sikachu/verification.git
2 remote: https://github.com/sikachu/verification.git
3 revision: ff31697b940d7b0e2ec65f08764215c96104e76d
3 revision: ff31697b940d7b0e2ec65f08764215c96104e76d
4 specs:
4 specs:
5 verification (1.0.3)
5 verification (1.0.3)
6 actionpack (>= 3.0.0, < 5.1)
6 actionpack (>= 3.0.0, < 5.1)
7 activesupport (>= 3.0.0, < 5.1)
7 activesupport (>= 3.0.0, < 5.1)
8
8
9 GEM
9 GEM
10 remote: https://rubygems.org/
10 remote: https://rubygems.org/
11 specs:
11 specs:
12 RubyInline (3.12.4)
12 RubyInline (3.12.4)
13 ZenTest (~> 4.3)
13 ZenTest (~> 4.3)
14 ZenTest (4.11.1)
14 ZenTest (4.11.1)
15 ace-rails-ap (4.1.1)
15 ace-rails-ap (4.1.1)
16 actionmailer (4.2.7.1)
16 actionmailer (4.2.7.1)
17 actionpack (= 4.2.7.1)
17 actionpack (= 4.2.7.1)
18 actionview (= 4.2.7.1)
18 actionview (= 4.2.7.1)
19 activejob (= 4.2.7.1)
19 activejob (= 4.2.7.1)
20 mail (~> 2.5, >= 2.5.4)
20 mail (~> 2.5, >= 2.5.4)
21 rails-dom-testing (~> 1.0, >= 1.0.5)
21 rails-dom-testing (~> 1.0, >= 1.0.5)
22 actionpack (4.2.7.1)
22 actionpack (4.2.7.1)
23 actionview (= 4.2.7.1)
23 actionview (= 4.2.7.1)
24 activesupport (= 4.2.7.1)
24 activesupport (= 4.2.7.1)
25 rack (~> 1.6)
25 rack (~> 1.6)
26 rack-test (~> 0.6.2)
26 rack-test (~> 0.6.2)
27 rails-dom-testing (~> 1.0, >= 1.0.5)
27 rails-dom-testing (~> 1.0, >= 1.0.5)
28 rails-html-sanitizer (~> 1.0, >= 1.0.2)
28 rails-html-sanitizer (~> 1.0, >= 1.0.2)
29 actionview (4.2.7.1)
29 actionview (4.2.7.1)
30 activesupport (= 4.2.7.1)
30 activesupport (= 4.2.7.1)
31 builder (~> 3.1)
31 builder (~> 3.1)
32 erubis (~> 2.7.0)
32 erubis (~> 2.7.0)
33 rails-dom-testing (~> 1.0, >= 1.0.5)
33 rails-dom-testing (~> 1.0, >= 1.0.5)
34 rails-html-sanitizer (~> 1.0, >= 1.0.2)
34 rails-html-sanitizer (~> 1.0, >= 1.0.2)
35 activejob (4.2.7.1)
35 activejob (4.2.7.1)
36 activesupport (= 4.2.7.1)
36 activesupport (= 4.2.7.1)
37 globalid (>= 0.3.0)
37 globalid (>= 0.3.0)
38 activemodel (4.2.7.1)
38 activemodel (4.2.7.1)
39 activesupport (= 4.2.7.1)
39 activesupport (= 4.2.7.1)
40 builder (~> 3.1)
40 builder (~> 3.1)
41 activerecord (4.2.7.1)
41 activerecord (4.2.7.1)
42 activemodel (= 4.2.7.1)
42 activemodel (= 4.2.7.1)
43 activesupport (= 4.2.7.1)
43 activesupport (= 4.2.7.1)
44 arel (~> 6.0)
44 arel (~> 6.0)
45 activerecord-session_store (1.0.0)
45 activerecord-session_store (1.0.0)
46 actionpack (>= 4.0, < 5.1)
46 actionpack (>= 4.0, < 5.1)
47 activerecord (>= 4.0, < 5.1)
47 activerecord (>= 4.0, < 5.1)
48 multi_json (~> 1.11, >= 1.11.2)
48 multi_json (~> 1.11, >= 1.11.2)
49 rack (>= 1.5.2, < 3)
49 rack (>= 1.5.2, < 3)
50 railties (>= 4.0, < 5.1)
50 railties (>= 4.0, < 5.1)
51 activesupport (4.2.7.1)
51 activesupport (4.2.7.1)
52 i18n (~> 0.7)
52 i18n (~> 0.7)
53 json (~> 1.7, >= 1.7.7)
53 json (~> 1.7, >= 1.7.7)
54 minitest (~> 5.1)
54 minitest (~> 5.1)
55 thread_safe (~> 0.3, >= 0.3.4)
55 thread_safe (~> 0.3, >= 0.3.4)
56 tzinfo (~> 1.1)
56 tzinfo (~> 1.1)
57 ansi (1.5.0)
57 ansi (1.5.0)
58 arel (6.0.4)
58 arel (6.0.4)
59 autoprefixer-rails (6.6.0)
59 autoprefixer-rails (6.6.0)
60 execjs
60 execjs
61 best_in_place (3.0.3)
61 best_in_place (3.0.3)
62 actionpack (>= 3.2)
62 actionpack (>= 3.2)
63 railties (>= 3.2)
63 railties (>= 3.2)
64 bootstrap-sass (3.2.0.2)
64 bootstrap-sass (3.2.0.2)
65 sass (~> 3.2)
65 sass (~> 3.2)
66 bootstrap-switch-rails (3.3.3)
66 bootstrap-switch-rails (3.3.3)
67 bootstrap-toggle-rails (2.2.1.0)
67 bootstrap-toggle-rails (2.2.1.0)
68 + bootstrap3-datetimepicker-rails (4.17.47)
69 + momentjs-rails (>= 2.8.1)
68 builder (3.2.2)
70 builder (3.2.2)
69 coffee-rails (4.2.1)
71 coffee-rails (4.2.1)
70 coffee-script (>= 2.2.0)
72 coffee-script (>= 2.2.0)
71 railties (>= 4.0.0, < 5.2.x)
73 railties (>= 4.0.0, < 5.2.x)
72 coffee-script (2.4.1)
74 coffee-script (2.4.1)
73 coffee-script-source
75 coffee-script-source
74 execjs
76 execjs
75 coffee-script-source (1.12.2)
77 coffee-script-source (1.12.2)
76 concurrent-ruby (1.0.4)
78 concurrent-ruby (1.0.4)
77 dynamic_form (1.1.4)
79 dynamic_form (1.1.4)
78 erubis (2.7.0)
80 erubis (2.7.0)
79 execjs (2.7.0)
81 execjs (2.7.0)
80 fuzzy-string-match (1.0.0)
82 fuzzy-string-match (1.0.0)
81 RubyInline (>= 3.8.6)
83 RubyInline (>= 3.8.6)
82 globalid (0.3.7)
84 globalid (0.3.7)
83 activesupport (>= 4.1.0)
85 activesupport (>= 4.1.0)
84 haml (4.0.7)
86 haml (4.0.7)
85 tilt
87 tilt
86 haml-rails (0.9.0)
88 haml-rails (0.9.0)
87 actionpack (>= 4.0.1)
89 actionpack (>= 4.0.1)
88 activesupport (>= 4.0.1)
90 activesupport (>= 4.0.1)
89 haml (>= 4.0.6, < 5.0)
91 haml (>= 4.0.6, < 5.0)
90 html2haml (>= 1.0.1)
92 html2haml (>= 1.0.1)
91 railties (>= 4.0.1)
93 railties (>= 4.0.1)
92 html2haml (2.0.0)
94 html2haml (2.0.0)
93 erubis (~> 2.7.0)
95 erubis (~> 2.7.0)
94 haml (~> 4.0.0)
96 haml (~> 4.0.0)
95 nokogiri (~> 1.6.0)
97 nokogiri (~> 1.6.0)
96 ruby_parser (~> 3.5)
98 ruby_parser (~> 3.5)
97 i18n (0.7.0)
99 i18n (0.7.0)
98 in_place_editing (1.2.0)
100 in_place_editing (1.2.0)
99 jquery-countdown-rails (2.0.2)
101 jquery-countdown-rails (2.0.2)
102 + jquery-datatables-rails (3.4.0)
103 + actionpack (>= 3.1)
104 + jquery-rails
105 + railties (>= 3.1)
106 + sass-rails
100 jquery-rails (4.2.1)
107 jquery-rails (4.2.1)
101 rails-dom-testing (>= 1, < 3)
108 rails-dom-testing (>= 1, < 3)
102 railties (>= 4.2.0)
109 railties (>= 4.2.0)
103 thor (>= 0.14, < 2.0)
110 thor (>= 0.14, < 2.0)
104 jquery-tablesorter (1.23.3)
111 jquery-tablesorter (1.23.3)
105 railties (>= 3.2, < 6)
112 railties (>= 3.2, < 6)
106 jquery-timepicker-addon-rails (1.4.1)
113 jquery-timepicker-addon-rails (1.4.1)
107 railties (>= 3.1)
114 railties (>= 3.1)
108 jquery-ui-rails (6.0.1)
115 jquery-ui-rails (6.0.1)
109 railties (>= 3.2.16)
116 railties (>= 3.2.16)
110 json (1.8.3)
117 json (1.8.3)
111 loofah (2.0.3)
118 loofah (2.0.3)
112 nokogiri (>= 1.5.9)
119 nokogiri (>= 1.5.9)
113 mail (2.6.4)
120 mail (2.6.4)
114 mime-types (>= 1.16, < 4)
121 mime-types (>= 1.16, < 4)
115 mime-types (3.1)
122 mime-types (3.1)
116 mime-types-data (~> 3.2015)
123 mime-types-data (~> 3.2015)
117 mime-types-data (3.2016.0521)
124 mime-types-data (3.2016.0521)
118 mini_portile2 (2.1.0)
125 mini_portile2 (2.1.0)
119 minitest (5.10.1)
126 minitest (5.10.1)
120 minitest-reporters (1.1.13)
127 minitest-reporters (1.1.13)
121 ansi
128 ansi
122 builder
129 builder
123 minitest (>= 5.0)
130 minitest (>= 5.0)
124 ruby-progressbar
131 ruby-progressbar
125 momentjs-rails (2.15.1)
132 momentjs-rails (2.15.1)
126 railties (>= 3.1)
133 railties (>= 3.1)
127 multi_json (1.12.1)
134 multi_json (1.12.1)
128 mysql2 (0.4.5)
135 mysql2 (0.4.5)
129 nokogiri (1.6.8.1)
136 nokogiri (1.6.8.1)
130 mini_portile2 (~> 2.1.0)
137 mini_portile2 (~> 2.1.0)
131 rack (1.6.5)
138 rack (1.6.5)
132 rack-test (0.6.3)
139 rack-test (0.6.3)
133 rack (>= 1.0)
140 rack (>= 1.0)
134 rails (4.2.7.1)
141 rails (4.2.7.1)
135 actionmailer (= 4.2.7.1)
142 actionmailer (= 4.2.7.1)
136 actionpack (= 4.2.7.1)
143 actionpack (= 4.2.7.1)
137 actionview (= 4.2.7.1)
144 actionview (= 4.2.7.1)
138 activejob (= 4.2.7.1)
145 activejob (= 4.2.7.1)
139 activemodel (= 4.2.7.1)
146 activemodel (= 4.2.7.1)
140 activerecord (= 4.2.7.1)
147 activerecord (= 4.2.7.1)
141 activesupport (= 4.2.7.1)
148 activesupport (= 4.2.7.1)
142 bundler (>= 1.3.0, < 2.0)
149 bundler (>= 1.3.0, < 2.0)
143 railties (= 4.2.7.1)
150 railties (= 4.2.7.1)
144 sprockets-rails
151 sprockets-rails
145 rails-deprecated_sanitizer (1.0.3)
152 rails-deprecated_sanitizer (1.0.3)
146 activesupport (>= 4.2.0.alpha)
153 activesupport (>= 4.2.0.alpha)
147 rails-dom-testing (1.0.8)
154 rails-dom-testing (1.0.8)
148 activesupport (>= 4.2.0.beta, < 5.0)
155 activesupport (>= 4.2.0.beta, < 5.0)
149 nokogiri (~> 1.6)
156 nokogiri (~> 1.6)
150 rails-deprecated_sanitizer (>= 1.0.1)
157 rails-deprecated_sanitizer (>= 1.0.1)
151 rails-html-sanitizer (1.0.3)
158 rails-html-sanitizer (1.0.3)
152 loofah (~> 2.0)
159 loofah (~> 2.0)
153 rails_bootstrap_sortable (2.0.1)
160 rails_bootstrap_sortable (2.0.1)
154 momentjs-rails (>= 2.8.3)
161 momentjs-rails (>= 2.8.3)
155 railties (4.2.7.1)
162 railties (4.2.7.1)
156 actionpack (= 4.2.7.1)
163 actionpack (= 4.2.7.1)
157 activesupport (= 4.2.7.1)
164 activesupport (= 4.2.7.1)
158 rake (>= 0.8.7)
165 rake (>= 0.8.7)
159 thor (>= 0.18.1, < 2.0)
166 thor (>= 0.18.1, < 2.0)
160 rake (12.0.0)
167 rake (12.0.0)
161 rdiscount (2.2.0.1)
168 rdiscount (2.2.0.1)
162 rouge (2.0.7)
169 rouge (2.0.7)
163 ruby-progressbar (1.8.1)
170 ruby-progressbar (1.8.1)
164 ruby_parser (3.8.3)
171 ruby_parser (3.8.3)
165 sexp_processor (~> 4.1)
172 sexp_processor (~> 4.1)
166 sass (3.4.23)
173 sass (3.4.23)
167 sass-rails (5.0.6)
174 sass-rails (5.0.6)
168 railties (>= 4.0.0, < 6)
175 railties (>= 4.0.0, < 6)
169 sass (~> 3.1)
176 sass (~> 3.1)
170 sprockets (>= 2.8, < 4.0)
177 sprockets (>= 2.8, < 4.0)
171 sprockets-rails (>= 2.0, < 4.0)
178 sprockets-rails (>= 2.0, < 4.0)
172 tilt (>= 1.1, < 3)
179 tilt (>= 1.1, < 3)
173 select2-rails (4.0.3)
180 select2-rails (4.0.3)
174 thor (~> 0.14)
181 thor (~> 0.14)
175 sexp_processor (4.7.0)
182 sexp_processor (4.7.0)
176 sprockets (3.7.1)
183 sprockets (3.7.1)
177 concurrent-ruby (~> 1.0)
184 concurrent-ruby (~> 1.0)
178 rack (> 1, < 3)
185 rack (> 1, < 3)
179 sprockets-rails (3.2.0)
186 sprockets-rails (3.2.0)
180 actionpack (>= 4.0)
187 actionpack (>= 4.0)
181 activesupport (>= 4.0)
188 activesupport (>= 4.0)
182 sprockets (>= 3.0.0)
189 sprockets (>= 3.0.0)
183 sqlite3 (1.3.12)
190 sqlite3 (1.3.12)
184 thor (0.19.4)
191 thor (0.19.4)
185 thread_safe (0.3.5)
192 thread_safe (0.3.5)
186 tilt (2.0.5)
193 tilt (2.0.5)
187 tzinfo (1.2.2)
194 tzinfo (1.2.2)
188 thread_safe (~> 0.1)
195 thread_safe (~> 0.1)
189 uglifier (3.0.4)
196 uglifier (3.0.4)
190 execjs (>= 0.3.0, < 3)
197 execjs (>= 0.3.0, < 3)
191 will_paginate (3.0.12)
198 will_paginate (3.0.12)
192 yaml_db (0.4.2)
199 yaml_db (0.4.2)
193 rails (>= 3.0, < 5.1)
200 rails (>= 3.0, < 5.1)
194 rake (>= 0.8.7)
201 rake (>= 0.8.7)
195
202
196 PLATFORMS
203 PLATFORMS
197 ruby
204 ruby
198
205
199 DEPENDENCIES
206 DEPENDENCIES
200 ace-rails-ap
207 ace-rails-ap
201 activerecord-session_store
208 activerecord-session_store
202 autoprefixer-rails
209 autoprefixer-rails
203 best_in_place (~> 3.0.1)
210 best_in_place (~> 3.0.1)
204 bootstrap-sass (~> 3.2.0)
211 bootstrap-sass (~> 3.2.0)
205 bootstrap-switch-rails
212 bootstrap-switch-rails
206 bootstrap-toggle-rails
213 bootstrap-toggle-rails
214 + bootstrap3-datetimepicker-rails (~> 4.17.47)
207 coffee-rails
215 coffee-rails
208 dynamic_form
216 dynamic_form
209 fuzzy-string-match
217 fuzzy-string-match
210 haml
218 haml
211 haml-rails
219 haml-rails
212 in_place_editing
220 in_place_editing
213 jquery-countdown-rails
221 jquery-countdown-rails
222 + jquery-datatables-rails
214 jquery-rails
223 jquery-rails
215 jquery-tablesorter
224 jquery-tablesorter
216 jquery-timepicker-addon-rails
225 jquery-timepicker-addon-rails
217 jquery-ui-rails
226 jquery-ui-rails
218 mail
227 mail
219 minitest-reporters
228 minitest-reporters
220 momentjs-rails
229 momentjs-rails
221 mysql2
230 mysql2
222 rails (~> 4.2.0)
231 rails (~> 4.2.0)
223 rails_bootstrap_sortable
232 rails_bootstrap_sortable
224 rdiscount
233 rdiscount
225 rouge
234 rouge
226 sass-rails
235 sass-rails
227 select2-rails
236 select2-rails
228 sqlite3
237 sqlite3
229 uglifier
238 uglifier
230 verification!
239 verification!
231 will_paginate (~> 3.0.7)
240 will_paginate (~> 3.0.7)
232 yaml_db
241 yaml_db
233
242
234 BUNDLED WITH
243 BUNDLED WITH
235 - 1.13.6
244 + 1.15.4
@@ -1,41 +1,45
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 dataTables/jquery.dataTables
16 + //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
15 //= require jquery-ui
17 //= require jquery-ui
16 //= require bootstrap-sprockets
18 //= require bootstrap-sprockets
17 //= require moment
19 //= require moment
20 + //= require moment/th
18 //= require bootstrap-sortable
21 //= require bootstrap-sortable
22 + //= require bootstrap-datetimepicker
19 //= require select2
23 //= require select2
20 //= require ace-rails-ap
24 //= require ace-rails-ap
21 //= require ace/mode-c_cpp
25 //= require ace/mode-c_cpp
22 //= require ace/mode-python
26 //= require ace/mode-python
23 //= require ace/mode-ruby
27 //= require ace/mode-ruby
24 //= require ace/mode-pascal
28 //= require ace/mode-pascal
25 //= require ace/mode-javascript
29 //= require ace/mode-javascript
26 //= require ace/mode-java
30 //= require ace/mode-java
27 //= require ace/theme-merbivore
31 //= require ace/theme-merbivore
28 //= require custom
32 //= require custom
29 //= require jquery.countdown
33 //= require jquery.countdown
30 //-------------- addition from local_jquery -----------
34 //-------------- addition from local_jquery -----------
31 //= require jquery-tablesorter
35 //= require jquery-tablesorter
32 //= require best_in_place
36 //= require best_in_place
33 //= require best_in_place.jquery-ui
37 //= require best_in_place.jquery-ui
34 //= require brython
38 //= require brython
35
39
36 // since this is after blank line, it is not downloaded
40 // since this is after blank line, it is not downloaded
37 //x= require prototype
41 //x= require prototype
38 //x= require prototype_ujs
42 //x= require prototype_ujs
39 //x= require effects
43 //x= require effects
40 //x= require dragdrop
44 //x= require dragdrop
41 //x= require controls
45 //x= require controls
@@ -1,227 +1,229
1 /* This is a manifest file that'll be compiled into application.css, which will include all the files
1 /* This is a manifest file that'll be compiled into application.css, which will include all the files
2 * listed below.
2 * listed below.
3 *
3 *
4 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
4 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
5 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
5 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
6 *
6 *
7 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
7 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
8 * compiled file so the styles you add here take precedence over styles defined in any styles
8 * compiled file so the styles you add here take precedence over styles defined in any styles
9 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
9 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
10 * file per style scope.
10 * file per style scope.
11 *
11 *
12 * // bootstrap says that we should not do this, but @import each file instead
12 * // bootstrap says that we should not do this, but @import each file instead
13 * # *= require_tree .
13 * # *= require_tree .
14 * # *= require_self
14 * # *= require_self
15 */
15 */
16
16
17 @import "jquery-ui";
17 @import "jquery-ui";
18 //@import "jquery.ui.core";
18 //@import "jquery.ui.core";
19 //@import "jquery.ui.theme";
19 //@import "jquery.ui.theme";
20 //@import "jquery.ui.datepicker";
20 //@import "jquery.ui.datepicker";
21 //@import "jquery.ui.slider";
21 //@import "jquery.ui.slider";
22 @import "jquery-ui-timepicker-addon";
22 @import "jquery-ui-timepicker-addon";
23 @import "jquery-tablesorter/theme.metro-dark";
23 @import "jquery-tablesorter/theme.metro-dark";
24 @import "jquery.countdown";
24 @import "jquery.countdown";
25 @import "tablesorter-theme.cafe";
25 @import "tablesorter-theme.cafe";
26
26
27 //bootstrap
27 //bootstrap
28 @import "bootstrap-sprockets";
28 @import "bootstrap-sprockets";
29 @import "bootstrap";
29 @import "bootstrap";
30 @import "select2";
30 @import "select2";
31 @import "select2-bootstrap";
31 @import "select2-bootstrap";
32
32
33 //@import bootstrap3-switch
33 //@import bootstrap3-switch
34 @import "bootstrap-toggle";
34 @import "bootstrap-toggle";
35 @import "bootstrap-sortable";
35 @import "bootstrap-sortable";
36 + @import "bootstrap-datetimepicker";
37 + @import "dataTables/bootstrap/3/jquery.dataTables.bootstrap";
36
38
37 //bootstrap navbar color (from)
39 //bootstrap navbar color (from)
38 $bgDefault: #19197b;
40 $bgDefault: #19197b;
39 $bgHighlight: #06064b;
41 $bgHighlight: #06064b;
40 $colDefault: #8e8eb4;
42 $colDefault: #8e8eb4;
41 $colHighlight: #ffffff;
43 $colHighlight: #ffffff;
42 $dropDown: false;
44 $dropDown: false;
43
45
44 @font-face {
46 @font-face {
45 font-family: 'Glyphicons Halflings';
47 font-family: 'Glyphicons Halflings';
46 src: font-path('bootstrap/glyphicons-halflings-regular.eot');
48 src: font-path('bootstrap/glyphicons-halflings-regular.eot');
47 src: font-path('bootstrap/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
49 src: font-path('bootstrap/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
48 font-path('bootstrap/glyphicons-halflings-regular.woff') format('woff'),
50 font-path('bootstrap/glyphicons-halflings-regular.woff') format('woff'),
49 font-path('bootstrap/glyphicons-halflings-regular.ttf') format('truetype'),
51 font-path('bootstrap/glyphicons-halflings-regular.ttf') format('truetype'),
50 font-path('bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
52 font-path('bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
51 }
53 }
52
54
53
55
54 .navbar-default {
56 .navbar-default {
55 background-color: $bgDefault;
57 background-color: $bgDefault;
56 border-color: $bgHighlight;
58 border-color: $bgHighlight;
57
59
58 .navbar-brand {
60 .navbar-brand {
59 color: $colDefault;
61 color: $colDefault;
60
62
61 &:hover, &:focus {
63 &:hover, &:focus {
62 color: $colHighlight;
64 color: $colHighlight;
63 }
65 }
64 }
66 }
65
67
66 .navbar-text {
68 .navbar-text {
67 color: $colDefault;
69 color: $colDefault;
68 }
70 }
69
71
70 .navbar-nav {
72 .navbar-nav {
71 > li {
73 > li {
72 > a {
74 > a {
73 color: $colDefault;
75 color: $colDefault;
74
76
75 &:hover, &:focus {
77 &:hover, &:focus {
76 color: $colHighlight;
78 color: $colHighlight;
77 }
79 }
78 }
80 }
79
81
80 @if $dropDown {
82 @if $dropDown {
81 > .dropdown-menu {
83 > .dropdown-menu {
82 background-color: $bgDefault;
84 background-color: $bgDefault;
83
85
84 > li {
86 > li {
85 > a {
87 > a {
86 color: $colDefault;
88 color: $colDefault;
87
89
88 &:hover, &:focus {
90 &:hover, &:focus {
89 color: $colHighlight;
91 color: $colHighlight;
90 background-color: $bgHighlight;
92 background-color: $bgHighlight;
91 }
93 }
92 }
94 }
93
95
94 > .divider {
96 > .divider {
95 background-color: $bgHighlight;
97 background-color: $bgHighlight;
96 }
98 }
97 }
99 }
98 }
100 }
99 }
101 }
100 }
102 }
101
103
102 @if $dropDown {
104 @if $dropDown {
103 .open .dropdown-menu > .active {
105 .open .dropdown-menu > .active {
104 > a, > a:hover, > a:focus {
106 > a, > a:hover, > a:focus {
105 color: $colHighlight;
107 color: $colHighlight;
106 background-color: $bgHighlight;
108 background-color: $bgHighlight;
107 }
109 }
108 }
110 }
109 }
111 }
110
112
111 > .active {
113 > .active {
112 > a, > a:hover, > a:focus {
114 > a, > a:hover, > a:focus {
113 color: $colHighlight;
115 color: $colHighlight;
114 background-color: $bgHighlight;
116 background-color: $bgHighlight;
115 }
117 }
116 }
118 }
117
119
118 > .open {
120 > .open {
119 > a, > a:hover, > a:focus {
121 > a, > a:hover, > a:focus {
120 color: $colHighlight;
122 color: $colHighlight;
121 background-color: $bgHighlight;
123 background-color: $bgHighlight;
122 }
124 }
123 }
125 }
124 }
126 }
125
127
126 .navbar-toggle {
128 .navbar-toggle {
127 border-color: $bgHighlight;
129 border-color: $bgHighlight;
128
130
129 &:hover, &:focus {
131 &:hover, &:focus {
130 background-color: $bgHighlight;
132 background-color: $bgHighlight;
131 }
133 }
132
134
133 .icon-bar {
135 .icon-bar {
134 background-color: $colDefault;
136 background-color: $colDefault;
135 }
137 }
136 }
138 }
137
139
138 .navbar-collapse,
140 .navbar-collapse,
139 .navbar-form {
141 .navbar-form {
140 border-color: $colDefault;
142 border-color: $colDefault;
141 }
143 }
142
144
143 .navbar-link {
145 .navbar-link {
144 color: $colDefault;
146 color: $colDefault;
145
147
146 &:hover {
148 &:hover {
147 color: $colHighlight;
149 color: $colHighlight;
148 }
150 }
149 }
151 }
150 }
152 }
151
153
152 @media (max-width: 767px) {
154 @media (max-width: 767px) {
153 .navbar-default .navbar-nav .open .dropdown-menu {
155 .navbar-default .navbar-nav .open .dropdown-menu {
154 > li > a {
156 > li > a {
155 color: $colDefault;
157 color: $colDefault;
156
158
157 &:hover, &:focus {
159 &:hover, &:focus {
158 color: $colHighlight;
160 color: $colHighlight;
159 }
161 }
160 }
162 }
161
163
162 > .active {
164 > .active {
163 > a, > a:hover, > a:focus {
165 > a, > a:hover, > a:focus {
164 color: $colHighlight;
166 color: $colHighlight;
165 background-color: $bgHighlight;
167 background-color: $bgHighlight;
166 }
168 }
167 }
169 }
168 }
170 }
169 }
171 }
170
172
171 .secondnavbar {
173 .secondnavbar {
172 top: 50px;
174 top: 50px;
173 }
175 }
174
176
175 // --------------- bootstrap file upload ----------------------
177 // --------------- bootstrap file upload ----------------------
176 .btn-file {
178 .btn-file {
177 position: relative;
179 position: relative;
178 overflow: hidden;
180 overflow: hidden;
179 }
181 }
180
182
181 .btn-file input[type=file] {
183 .btn-file input[type=file] {
182 position: absolute;
184 position: absolute;
183 top: 0;
185 top: 0;
184 right: 0;
186 right: 0;
185 min-width: 100%;
187 min-width: 100%;
186 min-height: 100%;
188 min-height: 100%;
187 font-size: 100px;
189 font-size: 100px;
188 text-align: right;
190 text-align: right;
189 filter: alpha(opacity = 0);
191 filter: alpha(opacity = 0);
190 opacity: 0;
192 opacity: 0;
191 outline: none;
193 outline: none;
192 background: white;
194 background: white;
193 cursor: inherit;
195 cursor: inherit;
194 display: block;
196 display: block;
195 }
197 }
196
198
197 body {
199 body {
198 background: white image-url("topbg.jpg") repeat-x top center;
200 background: white image-url("topbg.jpg") repeat-x top center;
199
201
200 //font-size: 13px
202 //font-size: 13px
201 //font-family: Tahoma, "sans-serif"
203 //font-family: Tahoma, "sans-serif"
202 margin: 10px;
204 margin: 10px;
203 padding: 10px;
205 padding: 10px;
204 padding-top: 60px;
206 padding-top: 60px;
205 }
207 }
206
208
207 // ------------------ bootstrap sortable --------------------
209 // ------------------ bootstrap sortable --------------------
208 table.sortable th {
210 table.sortable th {
209 padding-right: 20px !important;
211 padding-right: 20px !important;
210
212
211 span.sign {
213 span.sign {
212 right: (-15px) !important;
214 right: (-15px) !important;
213 }
215 }
214
216
215 &.text-right {
217 &.text-right {
216 padding-left: 20px !important;
218 padding-left: 20px !important;
217 padding-right: 8px !important;
219 padding-right: 8px !important;
218
220
219 &:after, span.sign {
221 &:after, span.sign {
220 left: (-15px) !important;
222 left: (-15px) !important;
221 }
223 }
222 }
224 }
223 }
225 }
224
226
225 input {
227 input {
226 font-family: Tahoma, "sans-serif";
228 font-family: Tahoma, "sans-serif";
227 }
229 }
@@ -1,57 +1,63
1 class LoginController < ApplicationController
1 class LoginController < ApplicationController
2
2
3 def index
3 def index
4 # show login screen
4 # show login screen
5 reset_session
5 reset_session
6 redirect_to :controller => 'main', :action => 'login'
6 redirect_to :controller => 'main', :action => 'login'
7 end
7 end
8
8
9 def login
9 def login
10 - if (!GraderConfiguration['right.bypass_agreement']) and (!params[:accept_agree])
10 + user = User.authenticate(params[:login], params[:password])
11 + unless user
12 + flash[:notice] = 'Wrong password'
13 + redirect_to :controller => 'main', :action => 'login'
14 + return
15 + end
16 +
17 + if (!GraderConfiguration['right.bypass_agreement']) and (!params[:accept_agree]) and !user.admin?
11 flash[:notice] = 'You must accept the agreement before logging in'
18 flash[:notice] = 'You must accept the agreement before logging in'
12 redirect_to :controller => 'main', :action => 'login'
19 redirect_to :controller => 'main', :action => 'login'
13 - elsif user = User.authenticate(params[:login], params[:password])
20 + return
21 + end
22 +
23 + #process logging in
14 session[:user_id] = user.id
24 session[:user_id] = user.id
15 session[:admin] = user.admin?
25 session[:admin] = user.admin?
16
26
17 # clear forced logout flag for multicontests contest change
27 # clear forced logout flag for multicontests contest change
18 if GraderConfiguration.multicontests?
28 if GraderConfiguration.multicontests?
19 contest_stat = user.contest_stat
29 contest_stat = user.contest_stat
20 if contest_stat.respond_to? :forced_logout
30 if contest_stat.respond_to? :forced_logout
21 if contest_stat.forced_logout
31 if contest_stat.forced_logout
22 contest_stat.forced_logout = false
32 contest_stat.forced_logout = false
23 contest_stat.save
33 contest_stat.save
24 end
34 end
25 end
35 end
26 end
36 end
27
37
28 #save login information
38 #save login information
29 Login.create(user_id: user.id, ip_address: request.remote_ip)
39 Login.create(user_id: user.id, ip_address: request.remote_ip)
30
40
31 redirect_to :controller => 'main', :action => 'list'
41 redirect_to :controller => 'main', :action => 'list'
32 - else
33 - flash[:notice] = 'Wrong password'
34 - redirect_to :controller => 'main', :action => 'login'
35 - end
36 end
42 end
37
43
38 def site_login
44 def site_login
39 begin
45 begin
40 site = Site.find(params[:login][:site_id])
46 site = Site.find(params[:login][:site_id])
41 rescue ActiveRecord::RecordNotFound
47 rescue ActiveRecord::RecordNotFound
42 site = nil
48 site = nil
43 end
49 end
44 if site==nil
50 if site==nil
45 flash[:notice] = 'Wrong site'
51 flash[:notice] = 'Wrong site'
46 redirect_to :controller => 'main', :action => 'login' and return
52 redirect_to :controller => 'main', :action => 'login' and return
47 end
53 end
48 if (site.password) and (site.password == params[:login][:password])
54 if (site.password) and (site.password == params[:login][:password])
49 session[:site_id] = site.id
55 session[:site_id] = site.id
50 redirect_to :controller => 'site', :action => 'index'
56 redirect_to :controller => 'site', :action => 'index'
51 else
57 else
52 flash[:notice] = 'Wrong site password'
58 flash[:notice] = 'Wrong site password'
53 redirect_to :controller => 'site', :action => 'login'
59 redirect_to :controller => 'site', :action => 'login'
54 end
60 end
55 end
61 end
56
62
57 end
63 end
@@ -1,218 +1,219
1 require 'csv'
1 require 'csv'
2
2
3 class UserAdminController < ApplicationController
3 class UserAdminController < ApplicationController
4
4
5 include MailHelperMethods
5 include MailHelperMethods
6
6
7 before_filter :admin_authorization
7 before_filter :admin_authorization
8
8
9 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
9 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
10 verify :method => :post, :only => [
10 verify :method => :post, :only => [
11 :create, :create_from_list,
11 :create, :create_from_list,
12 :update,
12 :update,
13 :manage_contest,
13 :manage_contest,
14 :bulk_mail
14 :bulk_mail
15 ],
15 ],
16 :redirect_to => { :action => :list }
16 :redirect_to => { :action => :list }
17
17
18 def index
18 def index
19 @user_count = User.count
19 @user_count = User.count
20 if params[:page] == 'all'
20 if params[:page] == 'all'
21 @users = User.all
21 @users = User.all
22 @paginated = false
22 @paginated = false
23 else
23 else
24 @users = User.paginate :page => params[:page]
24 @users = User.paginate :page => params[:page]
25 @paginated = true
25 @paginated = true
26 end
26 end
27 + @users = User.all
27 @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at']
28 @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at']
28 @contests = Contest.enabled
29 @contests = Contest.enabled
29 end
30 end
30
31
31 def active
32 def active
32 sessions = ActiveRecord::SessionStore::Session.where("updated_at >= ?", 60.minutes.ago)
33 sessions = ActiveRecord::SessionStore::Session.where("updated_at >= ?", 60.minutes.ago)
33 @users = []
34 @users = []
34 sessions.each do |session|
35 sessions.each do |session|
35 if session.data[:user_id]
36 if session.data[:user_id]
36 @users << User.find(session.data[:user_id])
37 @users << User.find(session.data[:user_id])
37 end
38 end
38 end
39 end
39 end
40 end
40
41
41 def show
42 def show
42 @user = User.find(params[:id])
43 @user = User.find(params[:id])
43 end
44 end
44
45
45 def new
46 def new
46 @user = User.new
47 @user = User.new
47 end
48 end
48
49
49 def create
50 def create
50 @user = User.new(user_params)
51 @user = User.new(user_params)
51 @user.activated = true
52 @user.activated = true
52 if @user.save
53 if @user.save
53 flash[:notice] = 'User was successfully created.'
54 flash[:notice] = 'User was successfully created.'
54 redirect_to :action => 'index'
55 redirect_to :action => 'index'
55 else
56 else
56 render :action => 'new'
57 render :action => 'new'
57 end
58 end
58 end
59 end
59
60
60 def clear_last_ip
61 def clear_last_ip
61 @user = User.find(params[:id])
62 @user = User.find(params[:id])
62 @user.last_ip = nil
63 @user.last_ip = nil
63 @user.save
64 @user.save
64 redirect_to action: 'index', page: params[:page]
65 redirect_to action: 'index', page: params[:page]
65 end
66 end
66
67
67 def create_from_list
68 def create_from_list
68 lines = params[:user_list]
69 lines = params[:user_list]
69
70
70 note = []
71 note = []
71
72
72 lines.split("\n").each do |line|
73 lines.split("\n").each do |line|
73 items = line.chomp.split(',')
74 items = line.chomp.split(',')
74 if items.length>=2
75 if items.length>=2
75 login = items[0]
76 login = items[0]
76 full_name = items[1]
77 full_name = items[1]
77 remark =''
78 remark =''
78 user_alias = ''
79 user_alias = ''
79
80
80 added_random_password = false
81 added_random_password = false
81 if items.length >= 3 and items[2].chomp(" ").length > 0;
82 if items.length >= 3 and items[2].chomp(" ").length > 0;
82 password = items[2].chomp(" ")
83 password = items[2].chomp(" ")
83 else
84 else
84 password = random_password
85 password = random_password
85 add_random_password=true;
86 add_random_password=true;
86 end
87 end
87
88
88 if items.length>= 4 and items[3].chomp(" ").length > 0;
89 if items.length>= 4 and items[3].chomp(" ").length > 0;
89 user_alias = items[3].chomp(" ")
90 user_alias = items[3].chomp(" ")
90 else
91 else
91 user_alias = login
92 user_alias = login
92 end
93 end
93
94
94 if items.length>=5
95 if items.length>=5
95 remark = items[4].strip;
96 remark = items[4].strip;
96 end
97 end
97
98
98 user = User.find_by_login(login)
99 user = User.find_by_login(login)
99 if (user)
100 if (user)
100 user.full_name = full_name
101 user.full_name = full_name
101 user.password = password
102 user.password = password
102 user.remark = remark
103 user.remark = remark
103 else
104 else
104 user = User.new({:login => login,
105 user = User.new({:login => login,
105 :full_name => full_name,
106 :full_name => full_name,
106 :password => password,
107 :password => password,
107 :password_confirmation => password,
108 :password_confirmation => password,
108 :alias => user_alias,
109 :alias => user_alias,
109 :remark => remark})
110 :remark => remark})
110 end
111 end
111 user.activated = true
112 user.activated = true
112 user.save
113 user.save
113
114
114 if added_random_password
115 if added_random_password
115 note << "'#{login}' (+)"
116 note << "'#{login}' (+)"
116 else
117 else
117 note << login
118 note << login
118 end
119 end
119 end
120 end
120 end
121 end
121 flash[:success] = 'User(s) ' + note.join(', ') +
122 flash[:success] = 'User(s) ' + note.join(', ') +
122 ' were successfully created. ' +
123 ' were successfully created. ' +
123 '( (+) - created with random passwords.)'
124 '( (+) - created with random passwords.)'
124 redirect_to :action => 'index'
125 redirect_to :action => 'index'
125 end
126 end
126
127
127 def edit
128 def edit
128 @user = User.find(params[:id])
129 @user = User.find(params[:id])
129 end
130 end
130
131
131 def update
132 def update
132 @user = User.find(params[:id])
133 @user = User.find(params[:id])
133 if @user.update_attributes(user_params)
134 if @user.update_attributes(user_params)
134 flash[:notice] = 'User was successfully updated.'
135 flash[:notice] = 'User was successfully updated.'
135 redirect_to :action => 'show', :id => @user
136 redirect_to :action => 'show', :id => @user
136 else
137 else
137 render :action => 'edit'
138 render :action => 'edit'
138 end
139 end
139 end
140 end
140
141
141 def destroy
142 def destroy
142 User.find(params[:id]).destroy
143 User.find(params[:id]).destroy
143 redirect_to :action => 'index'
144 redirect_to :action => 'index'
144 end
145 end
145
146
146 def user_stat
147 def user_stat
147 if params[:commit] == 'download csv'
148 if params[:commit] == 'download csv'
148 @problems = Problem.all
149 @problems = Problem.all
149 else
150 else
150 @problems = Problem.available_problems
151 @problems = Problem.available_problems
151 end
152 end
152 @users = User.includes(:contests, :contest_stat).where(enabled: true)
153 @users = User.includes(:contests, :contest_stat).where(enabled: true)
153 @scorearray = Array.new
154 @scorearray = Array.new
154 @users.each do |u|
155 @users.each do |u|
155 ustat = Array.new
156 ustat = Array.new
156 ustat[0] = u
157 ustat[0] = u
157 @problems.each do |p|
158 @problems.each do |p|
158 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
159 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
159 if (sub!=nil) and (sub.points!=nil) and p and p.full_score
160 if (sub!=nil) and (sub.points!=nil) and p and p.full_score
160 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
161 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
161 else
162 else
162 ustat << [0,false]
163 ustat << [0,false]
163 end
164 end
164 end
165 end
165 @scorearray << ustat
166 @scorearray << ustat
166 end
167 end
167 if params[:commit] == 'download csv' then
168 if params[:commit] == 'download csv' then
168 csv = gen_csv_from_scorearray(@scorearray,@problems)
169 csv = gen_csv_from_scorearray(@scorearray,@problems)
169 send_data csv, filename: 'last_score.csv'
170 send_data csv, filename: 'last_score.csv'
170 else
171 else
171 render template: 'user_admin/user_stat'
172 render template: 'user_admin/user_stat'
172 end
173 end
173 end
174 end
174
175
175 def user_stat_max
176 def user_stat_max
176 if params[:commit] == 'download csv'
177 if params[:commit] == 'download csv'
177 @problems = Problem.all
178 @problems = Problem.all
178 else
179 else
179 @problems = Problem.available_problems
180 @problems = Problem.available_problems
180 end
181 end
181 @users = User.includes(:contests).includes(:contest_stat).all
182 @users = User.includes(:contests).includes(:contest_stat).all
182 @scorearray = Array.new
183 @scorearray = Array.new
183 #set up range from param
184 #set up range from param
184 since_id = params.fetch(:since_id, 0).to_i
185 since_id = params.fetch(:since_id, 0).to_i
185 until_id = params.fetch(:until_id, 0).to_i
186 until_id = params.fetch(:until_id, 0).to_i
186 @users.each do |u|
187 @users.each do |u|
187 ustat = Array.new
188 ustat = Array.new
188 ustat[0] = u
189 ustat[0] = u
189 @problems.each do |p|
190 @problems.each do |p|
190 max_points = 0
191 max_points = 0
191 Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
192 Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
192 max_points = sub.points if sub and sub.points and (sub.points > max_points)
193 max_points = sub.points if sub and sub.points and (sub.points > max_points)
193 end
194 end
194 ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
195 ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
195 end
196 end
196 @scorearray << ustat
197 @scorearray << ustat
197 end
198 end
198
199
199 if params[:commit] == 'download csv' then
200 if params[:commit] == 'download csv' then
200 csv = gen_csv_from_scorearray(@scorearray,@problems)
201 csv = gen_csv_from_scorearray(@scorearray,@problems)
201 send_data csv, filename: 'max_score.csv'
202 send_data csv, filename: 'max_score.csv'
202 else
203 else
203 render template: 'user_admin/user_stat'
204 render template: 'user_admin/user_stat'
204 end
205 end
205 end
206 end
206
207
207 def import
208 def import
208 if params[:file]==''
209 if params[:file]==''
209 flash[:notice] = 'Error importing no file'
210 flash[:notice] = 'Error importing no file'
210 redirect_to :action => 'index' and return
211 redirect_to :action => 'index' and return
211 end
212 end
212 import_from_file(params[:file])
213 import_from_file(params[:file])
213 end
214 end
214
215
215 def random_all_passwords
216 def random_all_passwords
216 users = User.all
217 users = User.all
217 @prefix = params[:prefix] || ''
218 @prefix = params[:prefix] || ''
218 @non_admin_users = User.find_non_admin_with_prefix(@prefix)
219 @non_admin_users = User.find_non_admin_with_prefix(@prefix)
@@ -1,101 +1,106
1 %h1 Listing users
1 %h1 Listing users
2
2
3 .panel.panel-primary
3 .panel.panel-primary
4 .panel-title.panel-heading
4 .panel-title.panel-heading
5 Quick Add
5 Quick Add
6 .panel-body
6 .panel-body
7 = form_tag( {method: 'post'}, {class: 'form-inline'}) do
7 = form_tag( {method: 'post'}, {class: 'form-inline'}) do
8 .form-group
8 .form-group
9 = label_tag 'user_login', 'Login'
9 = label_tag 'user_login', 'Login'
10 = text_field 'user', 'login', :size => 10,class: 'form-control'
10 = text_field 'user', 'login', :size => 10,class: 'form-control'
11 .form-group
11 .form-group
12 = label_tag 'user_full_name', 'Full Name'
12 = label_tag 'user_full_name', 'Full Name'
13 = text_field 'user', 'full_name', :size => 10,class: 'form-control'
13 = text_field 'user', 'full_name', :size => 10,class: 'form-control'
14 .form-group
14 .form-group
15 = label_tag 'user_password', 'Password'
15 = label_tag 'user_password', 'Password'
16 = text_field 'user', 'password', :size => 10,class: 'form-control'
16 = text_field 'user', 'password', :size => 10,class: 'form-control'
17 .form-group
17 .form-group
18 = label_tag 'user_password_confirmation', 'Confirm'
18 = label_tag 'user_password_confirmation', 'Confirm'
19 = text_field 'user', 'password_confirmation', :size => 10,class: 'form-control'
19 = text_field 'user', 'password_confirmation', :size => 10,class: 'form-control'
20 .form-group
20 .form-group
21 = label_tag 'user_email', 'email'
21 = label_tag 'user_email', 'email'
22 = text_field 'user', 'email', :size => 10,class: 'form-control'
22 = text_field 'user', 'email', :size => 10,class: 'form-control'
23 =submit_tag "Create", class: 'btn btn-primary'
23 =submit_tag "Create", class: 'btn btn-primary'
24
24
25 .panel.panel-primary
25 .panel.panel-primary
26 .panel-title.panel-heading
26 .panel-title.panel-heading
27 Import from site management
27 Import from site management
28 .panel-body
28 .panel-body
29 = form_tag({:action => 'import'}, :multipart => true,class: 'form form-inline') do
29 = form_tag({:action => 'import'}, :multipart => true,class: 'form form-inline') do
30 .form-group
30 .form-group
31 = label_tag :file, 'File:'
31 = label_tag :file, 'File:'
32 .input-group
32 .input-group
33 %span.input-group-btn
33 %span.input-group-btn
34 %span.btn.btn-default.btn-file
34 %span.btn.btn-default.btn-file
35 Browse
35 Browse
36 = file_field_tag 'file'
36 = file_field_tag 'file'
37 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
37 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
38 = submit_tag 'Submit', class: 'btn btn-default'
38 = submit_tag 'Submit', class: 'btn btn-default'
39
39
40
40
41 %p
41 %p
42 = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '}
42 = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '}
43 = link_to '+ New list of users', { :action => 'new_list' }, { class: 'btn btn-success '}
43 = link_to '+ New list of users', { :action => 'new_list' }, { class: 'btn btn-success '}
44 = link_to 'View administrators',{ :action => 'admin'}, { class: 'btn btn-default '}
44 = link_to 'View administrators',{ :action => 'admin'}, { class: 'btn btn-default '}
45 = link_to 'Bulk Manage', bulk_manage_user_admin_path , { class: 'btn btn-default '}
45 = link_to 'Bulk Manage', bulk_manage_user_admin_path , { class: 'btn btn-default '}
46 = link_to 'Random passwords',{ :action => 'random_all_passwords'}, { class: 'btn btn-default '}
46 = link_to 'Random passwords',{ :action => 'random_all_passwords'}, { class: 'btn btn-default '}
47 = link_to 'View active users',{ :action => 'active'}, { class: 'btn btn-default '}
47 = link_to 'View active users',{ :action => 'active'}, { class: 'btn btn-default '}
48 = link_to 'Mass mailing',{ :action => 'mass_mailing'}, { class: 'btn btn-default '}
48 = link_to 'Mass mailing',{ :action => 'mass_mailing'}, { class: 'btn btn-default '}
49
49
50 - if GraderConfiguration.multicontests?
50 - if GraderConfiguration.multicontests?
51 %br/
51 %br/
52 %b Multi-contest:
52 %b Multi-contest:
53 = link_to '[Manage bulk users in contests]', :action => 'contest_management'
53 = link_to '[Manage bulk users in contests]', :action => 'contest_management'
54 View users in:
54 View users in:
55 - @contests.each do |contest|
55 - @contests.each do |contest|
56 = link_to "[#{contest.name}]", :action => 'contests', :id => contest.id
56 = link_to "[#{contest.name}]", :action => 'contests', :id => contest.id
57 = link_to "[no contest]", :action => 'contests', :id => 'none'
57 = link_to "[no contest]", :action => 'contests', :id => 'none'
58
58
59 - Total #{@user_count} users |
59 + -# Total #{@user_count} users |
60 - - if !@paginated
60 + -# - if !@paginated
61 - Display all users.
61 + -# Display all users.
62 - \#{link_to '[show in pages]', :action => 'index', :page => '1'}
62 + -# \#{link_to '[show in pages]', :action => 'index', :page => '1'}
63 - - else
63 + -# - else
64 - Display in pages.
64 + -# Display in pages.
65 - \#{link_to '[display all]', :action => 'index', :page => 'all'} |
65 + -# \#{link_to '[display all]', :action => 'index', :page => 'all'} |
66 - \#{will_paginate @users, :container => false}
66 + -# \#{will_paginate @users, :container => false}
67
67
68
68
69 - %table.table.table-hover.table-condense
69 + %table.table.table-hover.table-condense.datatable
70 %thead
70 %thead
71 %th Login
71 %th Login
72 %th Full name
72 %th Full name
73 %th email
73 %th email
74 %th Remark
74 %th Remark
75 %th
75 %th
76 Activated
76 Activated
77 %sup{class: 'text-primary',data: {toggle: 'tooltip', placement: 'top'}, title: 'User has already confirmed the email?' } [?]
77 %sup{class: 'text-primary',data: {toggle: 'tooltip', placement: 'top'}, title: 'User has already confirmed the email?' } [?]
78 %th
78 %th
79 Enabled
79 Enabled
80 %sup{class: 'text-primary',data: {toggle: 'tooltip', placement: 'top'}, title: 'Allow the user to login?' } [?]
80 %sup{class: 'text-primary',data: {toggle: 'tooltip', placement: 'top'}, title: 'Allow the user to login?' } [?]
81 %th Last IP
81 %th Last IP
82 %th
82 %th
83 %th
83 %th
84 %th
84 %th
85 %th
85 %th
86 - for user in @users
86 - for user in @users
87 %tr
87 %tr
88 %td= link_to user.login, stat_user_path(user)
88 %td= link_to user.login, stat_user_path(user)
89 %td= user.full_name
89 %td= user.full_name
90 %td= user.email
90 %td= user.email
91 %td= user.remark
91 %td= user.remark
92 %td= toggle_button(user.activated?, toggle_activate_user_path(user),"toggle_activate_user_#{user.id}")
92 %td= toggle_button(user.activated?, toggle_activate_user_path(user),"toggle_activate_user_#{user.id}")
93 %td= toggle_button(user.enabled?, toggle_enable_user_path(user),"toggle_enable_user_#{user.id}")
93 %td= toggle_button(user.enabled?, toggle_enable_user_path(user),"toggle_enable_user_#{user.id}")
94 %td= user.last_ip
94 %td= user.last_ip
95 %td= link_to 'Clear IP', {:action => 'clear_last_ip', :id => user, :page=>params[:page]}, :confirm => 'This will reset last logging in ip of the user, are you sure?', class: 'btn btn-default btn-xs btn-block'
95 %td= link_to 'Clear IP', {:action => 'clear_last_ip', :id => user, :page=>params[:page]}, :confirm => 'This will reset last logging in ip of the user, are you sure?', class: 'btn btn-default btn-xs btn-block'
96 %td= link_to 'Show', {:action => 'show', :id => user}, class: 'btn btn-default btn-xs btn-block'
96 %td= link_to 'Show', {:action => 'show', :id => user}, class: 'btn btn-default btn-xs btn-block'
97 %td= link_to 'Edit', {:action => 'edit', :id => user}, class: 'btn btn-default btn-xs btn-block'
97 %td= link_to 'Edit', {:action => 'edit', :id => user}, class: 'btn btn-default btn-xs btn-block'
98 %td= link_to 'Destroy', user_admin_destroy_path(user), data: {confirm: 'Are you sure?'}, method: :delete, class: 'btn btn-danger btn-xs btn-block'
98 %td= link_to 'Destroy', user_admin_destroy_path(user), data: {confirm: 'Are you sure?'}, method: :delete, class: 'btn btn-danger btn-xs btn-block'
99 %br/
99 %br/
100 = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '}
100 = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '}
101 = link_to '+ New list of users', { :action => 'new_list' }, { class: 'btn btn-success '}
101 = link_to '+ New list of users', { :action => 'new_list' }, { class: 'btn btn-success '}
102 +
103 + :javascript
104 + $('.datatable').DataTable({
105 + 'pageLength': 50
106 + });
You need to be logged in to leave comments. Login now