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: 46 inserted, 19 deleted
@@ -56,21 +56,21 | |||
|
56 | 56 | gem 'jquery-tablesorter' |
|
57 | 57 | gem 'jquery-countdown-rails' |
|
58 | 58 | |
|
59 | 59 | #syntax highlighter |
|
60 | 60 | gem 'rouge' |
|
61 | 61 | |
|
62 |
- # |
|
|
62 | + #bootstrap add-ons | |
|
63 | 63 | gem 'bootstrap-sass', '~> 3.2.0' |
|
64 | 64 | gem 'bootstrap-switch-rails' |
|
65 | 65 | gem 'bootstrap-toggle-rails' |
|
66 | 66 | gem 'autoprefixer-rails' |
|
67 | - | |
|
68 | - #bootstrap sortable | |
|
69 | 67 | gem 'momentjs-rails' |
|
70 | 68 | gem 'rails_bootstrap_sortable' |
|
69 | + gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47' | |
|
70 | + gem 'jquery-datatables-rails' | |
|
71 | 71 | |
|
72 | 72 | #----------- user interface ----------------- |
|
73 | 73 | #select 2 |
|
74 | 74 | gem 'select2-rails' |
|
75 | 75 | #ace editor |
|
76 | 76 | gem 'ace-rails-ap' |
@@ -62,12 +62,14 | |||
|
62 | 62 | actionpack (>= 3.2) |
|
63 | 63 | railties (>= 3.2) |
|
64 | 64 | bootstrap-sass (3.2.0.2) |
|
65 | 65 | sass (~> 3.2) |
|
66 | 66 | bootstrap-switch-rails (3.3.3) |
|
67 | 67 | bootstrap-toggle-rails (2.2.1.0) |
|
68 | + bootstrap3-datetimepicker-rails (4.17.47) | |
|
69 | + momentjs-rails (>= 2.8.1) | |
|
68 | 70 | builder (3.2.2) |
|
69 | 71 | coffee-rails (4.2.1) |
|
70 | 72 | coffee-script (>= 2.2.0) |
|
71 | 73 | railties (>= 4.0.0, < 5.2.x) |
|
72 | 74 | coffee-script (2.4.1) |
|
73 | 75 | coffee-script-source |
@@ -94,12 +96,17 | |||
|
94 | 96 | haml (~> 4.0.0) |
|
95 | 97 | nokogiri (~> 1.6.0) |
|
96 | 98 | ruby_parser (~> 3.5) |
|
97 | 99 | i18n (0.7.0) |
|
98 | 100 | in_place_editing (1.2.0) |
|
99 | 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 | 107 | jquery-rails (4.2.1) |
|
101 | 108 | rails-dom-testing (>= 1, < 3) |
|
102 | 109 | railties (>= 4.2.0) |
|
103 | 110 | thor (>= 0.14, < 2.0) |
|
104 | 111 | jquery-tablesorter (1.23.3) |
|
105 | 112 | railties (>= 3.2, < 6) |
@@ -201,19 +208,21 | |||
|
201 | 208 | activerecord-session_store |
|
202 | 209 | autoprefixer-rails |
|
203 | 210 | best_in_place (~> 3.0.1) |
|
204 | 211 | bootstrap-sass (~> 3.2.0) |
|
205 | 212 | bootstrap-switch-rails |
|
206 | 213 | bootstrap-toggle-rails |
|
214 | + bootstrap3-datetimepicker-rails (~> 4.17.47) | |
|
207 | 215 | coffee-rails |
|
208 | 216 | dynamic_form |
|
209 | 217 | fuzzy-string-match |
|
210 | 218 | haml |
|
211 | 219 | haml-rails |
|
212 | 220 | in_place_editing |
|
213 | 221 | jquery-countdown-rails |
|
222 | + jquery-datatables-rails | |
|
214 | 223 | jquery-rails |
|
215 | 224 | jquery-tablesorter |
|
216 | 225 | jquery-timepicker-addon-rails |
|
217 | 226 | jquery-ui-rails |
|
218 | 227 | |
|
219 | 228 | minitest-reporters |
@@ -229,7 +238,7 | |||
|
229 | 238 | uglifier |
|
230 | 239 | verification! |
|
231 | 240 | will_paginate (~> 3.0.7) |
|
232 | 241 | yaml_db |
|
233 | 242 | |
|
234 | 243 | BUNDLED WITH |
|
235 |
- 1.1 |
|
|
244 | + 1.15.4 |
@@ -9,16 +9,20 | |||
|
9 | 9 | // |
|
10 | 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD |
|
11 | 11 | // GO AFTER THE REQUIRES BELOW. |
|
12 | 12 | // |
|
13 | 13 | //= require jquery |
|
14 | 14 | //= require jquery_ujs |
|
15 | + //= require dataTables/jquery.dataTables | |
|
16 | + //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap | |
|
15 | 17 | //= require jquery-ui |
|
16 | 18 | //= require bootstrap-sprockets |
|
17 | 19 | //= require moment |
|
20 | + //= require moment/th | |
|
18 | 21 | //= require bootstrap-sortable |
|
22 | + //= require bootstrap-datetimepicker | |
|
19 | 23 | //= require select2 |
|
20 | 24 | //= require ace-rails-ap |
|
21 | 25 | //= require ace/mode-c_cpp |
|
22 | 26 | //= require ace/mode-python |
|
23 | 27 | //= require ace/mode-ruby |
|
24 | 28 | //= require ace/mode-pascal |
@@ -30,12 +30,14 | |||
|
30 | 30 | @import "select2"; |
|
31 | 31 | @import "select2-bootstrap"; |
|
32 | 32 | |
|
33 | 33 | //@import bootstrap3-switch |
|
34 | 34 | @import "bootstrap-toggle"; |
|
35 | 35 | @import "bootstrap-sortable"; |
|
36 | + @import "bootstrap-datetimepicker"; | |
|
37 | + @import "dataTables/bootstrap/3/jquery.dataTables.bootstrap"; | |
|
36 | 38 | |
|
37 | 39 | //bootstrap navbar color (from) |
|
38 | 40 | $bgDefault: #19197b; |
|
39 | 41 | $bgHighlight: #06064b; |
|
40 | 42 | $colDefault: #8e8eb4; |
|
41 | 43 | $colHighlight: #ffffff; |
@@ -4,16 +4,26 | |||
|
4 | 4 | # show login screen |
|
5 | 5 | reset_session |
|
6 | 6 | redirect_to :controller => 'main', :action => 'login' |
|
7 | 7 | end |
|
8 | 8 | |
|
9 | 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 | 18 | flash[:notice] = 'You must accept the agreement before logging in' |
|
12 | 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 | 24 |
|
|
15 | 25 |
|
|
16 | 26 | |
|
17 | 27 |
|
|
18 | 28 |
|
|
19 | 29 |
|
@@ -26,16 +36,12 | |||
|
26 | 36 |
|
|
27 | 37 | |
|
28 | 38 |
|
|
29 | 39 |
|
|
30 | 40 | |
|
31 | 41 |
|
|
32 | - else | |
|
33 | - flash[:notice] = 'Wrong password' | |
|
34 | - redirect_to :controller => 'main', :action => 'login' | |
|
35 | - end | |
|
36 | 42 | end |
|
37 | 43 | |
|
38 | 44 | def site_login |
|
39 | 45 | begin |
|
40 | 46 | site = Site.find(params[:login][:site_id]) |
|
41 | 47 | rescue ActiveRecord::RecordNotFound |
@@ -21,12 +21,13 | |||
|
21 | 21 | @users = User.all |
|
22 | 22 | @paginated = false |
|
23 | 23 | else |
|
24 | 24 | @users = User.paginate :page => params[:page] |
|
25 | 25 | @paginated = true |
|
26 | 26 | end |
|
27 | + @users = User.all | |
|
27 | 28 | @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at'] |
|
28 | 29 | @contests = Contest.enabled |
|
29 | 30 | end |
|
30 | 31 | |
|
31 | 32 | def active |
|
32 | 33 | sessions = ActiveRecord::SessionStore::Session.where("updated_at >= ?", 60.minutes.ago) |
@@ -53,23 +53,23 | |||
|
53 | 53 | = link_to '[Manage bulk users in contests]', :action => 'contest_management' |
|
54 | 54 | View users in: |
|
55 | 55 | - @contests.each do |contest| |
|
56 | 56 | = link_to "[#{contest.name}]", :action => 'contests', :id => contest.id |
|
57 | 57 | = link_to "[no contest]", :action => 'contests', :id => 'none' |
|
58 | 58 | |
|
59 | - Total #{@user_count} users | | |
|
60 | - - if !@paginated | |
|
61 |
- |
|
|
62 |
- |
|
|
63 | - - else | |
|
64 |
- |
|
|
65 |
- |
|
|
66 |
- |
|
|
59 | + -# Total #{@user_count} users | | |
|
60 | + -# - if !@paginated | |
|
61 | + -# Display all users. | |
|
62 | + -# \#{link_to '[show in pages]', :action => 'index', :page => '1'} | |
|
63 | + -# - else | |
|
64 | + -# Display in pages. | |
|
65 | + -# \#{link_to '[display all]', :action => 'index', :page => 'all'} | | |
|
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 | 70 | %thead |
|
71 | 71 | %th Login |
|
72 | 72 | %th Full name |
|
73 | 73 | %th email |
|
74 | 74 | %th Remark |
|
75 | 75 | %th |
@@ -96,6 +96,11 | |||
|
96 | 96 | %td= link_to 'Show', {:action => 'show', :id => user}, class: 'btn btn-default btn-xs btn-block' |
|
97 | 97 | %td= link_to 'Edit', {:action => 'edit', :id => user}, class: 'btn btn-default btn-xs btn-block' |
|
98 | 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 | 99 | %br/ |
|
100 | 100 | = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '} |
|
101 | 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