Description:
add datatable
- now admin can login without checking agreement
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r691:81655bc0fe60 - - 7 files changed: 60 inserted, 33 deleted
@@ -59,15 +59,15 | |||||
|
59 | #syntax highlighter |
|
59 | #syntax highlighter |
|
60 | gem 'rouge' |
|
60 | gem 'rouge' |
|
61 |
|
61 | ||
|
62 |
- # |
|
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 |
@@ -65,6 +65,8 | |||||
|
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) |
@@ -97,6 +99,11 | |||||
|
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) |
@@ -204,6 +211,7 | |||||
|
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 |
@@ -211,6 +219,7 | |||||
|
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 |
@@ -232,4 +241,4 | |||||
|
232 | yaml_db |
|
241 | yaml_db |
|
233 |
|
242 | ||
|
234 | BUNDLED WITH |
|
243 | BUNDLED WITH |
|
235 |
- 1.1 |
|
244 | + 1.15.4 |
@@ -12,10 +12,14 | |||||
|
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 |
@@ -33,6 +33,8 | |||||
|
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; |
@@ -7,32 +7,38 | |||||
|
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 |
|
14 | - session[:user_id] = user.id |
|
21 | + end |
|
15 | - session[:admin] = user.admin? |
|
22 | + |
|
|
23 | + #process logging in | ||
|
|
24 | + session[:user_id] = user.id | ||
|
|
25 | + session[:admin] = user.admin? | ||
|
16 |
|
26 | ||
|
17 |
- |
|
27 | + # clear forced logout flag for multicontests contest change |
|
18 |
- |
|
28 | + if GraderConfiguration.multicontests? |
|
19 |
- |
|
29 | + contest_stat = user.contest_stat |
|
20 |
- |
|
30 | + if contest_stat.respond_to? :forced_logout |
|
21 |
- |
|
31 | + if contest_stat.forced_logout |
|
22 |
- |
|
32 | + contest_stat.forced_logout = false |
|
23 |
- |
|
33 | + contest_stat.save |
|
24 | - end |
|
||
|
25 | end |
|
34 | end |
|
26 | end |
|
35 | end |
|
27 | - |
|
36 | + end |
|
28 | - #save login information |
|
||
|
29 | - Login.create(user_id: user.id, ip_address: request.remote_ip) |
|
||
|
30 |
|
37 | ||
|
31 | - redirect_to :controller => 'main', :action => 'list' |
|
38 | + #save login information |
|
32 | - else |
|
39 | + Login.create(user_id: user.id, ip_address: request.remote_ip) |
|
33 | - flash[:notice] = 'Wrong password' |
|
40 | + |
|
34 |
- |
|
41 | + redirect_to :controller => 'main', :action => 'list' |
|
35 | - end |
|
||
|
36 | end |
|
42 | end |
|
37 |
|
43 | ||
|
38 | def site_login |
|
44 | def site_login |
@@ -24,6 +24,7 | |||||
|
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 |
@@ -56,17 +56,17 | |||||
|
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 |
- |
|
61 | + -# Display all users. |
|
62 |
- |
|
62 | + -# \#{link_to '[show in pages]', :action => 'index', :page => '1'} |
|
63 | - - else |
|
63 | + -# - else |
|
64 |
- |
|
64 | + -# Display in pages. |
|
65 |
- |
|
65 | + -# \#{link_to '[display all]', :action => 'index', :page => 'all'} | |
|
66 |
- |
|
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 |
@@ -99,3 +99,8 | |||||
|
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