Description:
merge
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r695:55afb135c5f9 - - 12 files changed: 117 inserted, 54 deleted
@@ -56,21 +56,22 | |||
|
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 'bootstrap-datepicker-rails' | |
|
70 | + gem 'bootstrap3-datetimepicker-rails' | |
|
71 | + gem 'jquery-datatables-rails' | |
|
71 | 72 | |
|
72 | 73 | #----------- user interface ----------------- |
|
73 | 74 | #select 2 |
|
74 | 75 | gem 'select2-rails' |
|
75 | 76 | #ace editor |
|
76 | 77 | gem 'ace-rails-ap' |
@@ -58,16 +58,20 | |||
|
58 | 58 | arel (6.0.4) |
|
59 | 59 | autoprefixer-rails (6.6.0) |
|
60 | 60 | execjs |
|
61 | 61 | best_in_place (3.0.3) |
|
62 | 62 | actionpack (>= 3.2) |
|
63 | 63 | railties (>= 3.2) |
|
64 | + bootstrap-datepicker-rails (1.7.1.1) | |
|
65 | + railties (>= 3.0) | |
|
64 | 66 | bootstrap-sass (3.2.0.2) |
|
65 | 67 | sass (~> 3.2) |
|
66 | 68 | bootstrap-switch-rails (3.3.3) |
|
67 | 69 | bootstrap-toggle-rails (2.2.1.0) |
|
70 | + bootstrap3-datetimepicker-rails (4.17.47) | |
|
71 | + momentjs-rails (>= 2.8.1) | |
|
68 | 72 | builder (3.2.2) |
|
69 | 73 | coffee-rails (4.2.1) |
|
70 | 74 | coffee-script (>= 2.2.0) |
|
71 | 75 | railties (>= 4.0.0, < 5.2.x) |
|
72 | 76 | coffee-script (2.4.1) |
|
73 | 77 | coffee-script-source |
@@ -94,12 +98,17 | |||
|
94 | 98 | haml (~> 4.0.0) |
|
95 | 99 | nokogiri (~> 1.6.0) |
|
96 | 100 | ruby_parser (~> 3.5) |
|
97 | 101 | i18n (0.7.0) |
|
98 | 102 | in_place_editing (1.2.0) |
|
99 | 103 | jquery-countdown-rails (2.0.2) |
|
104 | + jquery-datatables-rails (3.4.0) | |
|
105 | + actionpack (>= 3.1) | |
|
106 | + jquery-rails | |
|
107 | + railties (>= 3.1) | |
|
108 | + sass-rails | |
|
100 | 109 | jquery-rails (4.2.1) |
|
101 | 110 | rails-dom-testing (>= 1, < 3) |
|
102 | 111 | railties (>= 4.2.0) |
|
103 | 112 | thor (>= 0.14, < 2.0) |
|
104 | 113 | jquery-tablesorter (1.23.3) |
|
105 | 114 | railties (>= 3.2, < 6) |
@@ -198,22 +207,25 | |||
|
198 | 207 | |
|
199 | 208 | DEPENDENCIES |
|
200 | 209 | ace-rails-ap |
|
201 | 210 | activerecord-session_store |
|
202 | 211 | autoprefixer-rails |
|
203 | 212 | best_in_place (~> 3.0.1) |
|
213 | + bootstrap-datepicker-rails | |
|
204 | 214 | bootstrap-sass (~> 3.2.0) |
|
205 | 215 | bootstrap-switch-rails |
|
206 | 216 | bootstrap-toggle-rails |
|
217 | + bootstrap3-datetimepicker-rails | |
|
207 | 218 | coffee-rails |
|
208 | 219 | dynamic_form |
|
209 | 220 | fuzzy-string-match |
|
210 | 221 | haml |
|
211 | 222 | haml-rails |
|
212 | 223 | in_place_editing |
|
213 | 224 | jquery-countdown-rails |
|
225 | + jquery-datatables-rails | |
|
214 | 226 | jquery-rails |
|
215 | 227 | jquery-tablesorter |
|
216 | 228 | jquery-timepicker-addon-rails |
|
217 | 229 | jquery-ui-rails |
|
218 | 230 | |
|
219 | 231 | minitest-reporters |
@@ -229,7 +241,7 | |||
|
229 | 241 | uglifier |
|
230 | 242 | verification! |
|
231 | 243 | will_paginate (~> 3.0.7) |
|
232 | 244 | yaml_db |
|
233 | 245 | |
|
234 | 246 | BUNDLED WITH |
|
235 |
- 1.1 |
|
|
247 | + 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 |
@@ -29,12 +33,14 | |||
|
29 | 33 | //= require jquery.countdown |
|
30 | 34 | //-------------- addition from local_jquery ----------- |
|
31 | 35 | //= require jquery-tablesorter |
|
32 | 36 | //= require best_in_place |
|
33 | 37 | //= require best_in_place.jquery-ui |
|
34 | 38 | //= require brython |
|
39 | + //= require bootstrap-datepicker | |
|
40 | + //= require bootstrap-datetimepicker | |
|
35 | 41 | |
|
36 | 42 | // since this is after blank line, it is not downloaded |
|
37 | 43 | //x= require prototype |
|
38 | 44 | //x= require prototype_ujs |
|
39 | 45 | //x= require effects |
|
40 | 46 | //x= require dragdrop |
@@ -30,12 +30,15 | |||
|
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-datepicker3"; | |
|
37 | + @import "bootstrap-datetimepicker"; | |
|
38 | + @import "dataTables/bootstrap/3/jquery.dataTables.bootstrap"; | |
|
36 | 39 | |
|
37 | 40 | //bootstrap navbar color (from) |
|
38 | 41 | $bgDefault: #19197b; |
|
39 | 42 | $bgHighlight: #06064b; |
|
40 | 43 | $colDefault: #8e8eb4; |
|
41 | 44 | $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 |
@@ -255,16 +255,13 | |||
|
255 | 255 | return false |
|
256 | 256 | end |
|
257 | 257 | end |
|
258 | 258 | |
|
259 | 259 | def change_date_added |
|
260 | 260 | problems = get_problems_from_params |
|
261 |
- |
|
|
262 | - month = params[:date_added][:month].to_i | |
|
263 | - day = params[:date_added][:day].to_i | |
|
264 | - date = Date.new(year,month,day) | |
|
261 | + date = Date.parse(params[:date_added]) | |
|
265 | 262 | problems.each do |p| |
|
266 | 263 | p.date_added = date |
|
267 | 264 | p.save |
|
268 | 265 | end |
|
269 | 266 | end |
|
270 | 267 |
@@ -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) |
@@ -44,28 +44,32 | |||
|
44 | 44 | Action |
|
45 | 45 | .panel-body |
|
46 | 46 | .submit-box |
|
47 | 47 | What do you want to do to the selected problem? |
|
48 | 48 | %br/ |
|
49 | 49 | (You can shift-click to select a range of problems) |
|
50 | - %ul | |
|
50 | + %ul.form-inline | |
|
51 | 51 | %li |
|
52 | 52 | Change date added to |
|
53 | - = select_date Date.current, :prefix => 'date_added' | |
|
53 | + .input-group.date | |
|
54 | + = text_field_tag :date_added, class: 'form-control' | |
|
55 | + %span.input-group-addon | |
|
56 | + %span.glyphicon.glyphicon-calendar | |
|
57 | + -# = select_date Date.current, :prefix => 'date_added' | |
|
54 | 58 | |
|
55 |
- = submit_tag 'Change', :name => 'change_date_added', class: 'btn btn- |
|
|
59 | + = submit_tag 'Change', :name => 'change_date_added', class: 'btn btn-primary btn-sm' | |
|
56 | 60 | %li |
|
57 | 61 | Set available to |
|
58 |
- = submit_tag 'True', :name => 'enable_problem', class: 'btn btn- |
|
|
59 |
- = submit_tag 'False', :name => 'disable_problem', class: 'btn btn- |
|
|
62 | + = submit_tag 'True', :name => 'enable_problem', class: 'btn btn-primary btn-sm' | |
|
63 | + = submit_tag 'False', :name => 'disable_problem', class: 'btn btn-primary btn-sm' | |
|
60 | 64 | |
|
61 | 65 | - if GraderConfiguration.multicontests? |
|
62 | 66 | %li |
|
63 | 67 | Add to |
|
64 | 68 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
|
65 |
- = submit_tag 'Add', :name => 'add_to_contest', class: 'btn btn- |
|
|
69 | + = submit_tag 'Add', :name => 'add_to_contest', class: 'btn btn-primary btn-sm' | |
|
66 | 70 | %li |
|
67 | 71 | Add problems to group |
|
68 | 72 | = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_name]), id: 'group_name',class: 'select2' |
|
69 | 73 | = submit_tag 'Add', name: 'add_group', class: 'btn btn-default' |
|
70 | 74 | |
|
71 | 75 | |
@@ -89,6 +93,15 | |||
|
89 | 93 | %td= problem.available |
|
90 | 94 | %td= problem.date_added |
|
91 | 95 | - if GraderConfiguration.multicontests? |
|
92 | 96 | %td |
|
93 | 97 | - problem.contests.each do |contest| |
|
94 | 98 | = "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])" |
|
99 | + | |
|
100 | + :javascript | |
|
101 | + $('.input-group.date').datetimepicker({ | |
|
102 | + format: 'DD/MMM/YYYY', | |
|
103 | + showTodayButton: true, | |
|
104 | + widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}, | |
|
105 | + | |
|
106 | + }); | |
|
107 | + |
@@ -22,32 +22,36 | |||
|
22 | 22 | |
|
23 | 23 | %h2 Submissions Count |
|
24 | 24 | = render partial: 'application/bar_graph', locals: { histogram: @histogram } |
|
25 | 25 | |
|
26 | 26 | %h2 Submissions |
|
27 | 27 | - if @submissions and @submissions.count > 0 |
|
28 | - %table.info#main_table | |
|
28 | + %table#main_table.table.table-condensed.table-striped | |
|
29 | 29 | %thead |
|
30 |
- %tr |
|
|
30 | + %tr | |
|
31 | 31 | %th ID |
|
32 | 32 | %th Login |
|
33 | 33 | %th Name |
|
34 | 34 | %th Submitted_at |
|
35 | 35 | %th Points |
|
36 | 36 | %th comment |
|
37 | 37 | %th IP |
|
38 | 38 | %tbody |
|
39 | 39 | - row_odd,curr = true,'' |
|
40 | 40 | - @submissions.each do |sub| |
|
41 | 41 | - next unless sub.user |
|
42 | 42 | - row_odd,curr = !row_odd, sub.user if curr != sub.user |
|
43 | - %tr{class: row_odd ? "info-odd" : "info-even"} | |
|
43 | + %tr | |
|
44 | 44 | %td= link_to sub.id, submission_path(sub) |
|
45 | 45 | %td= link_to sub.user.login, stat_user_path(sub.user) |
|
46 | 46 | %td= sub.user.full_name |
|
47 |
- %td |
|
|
47 | + %td{data: {order: sub.submitted_at}}= time_ago_in_words(sub.submitted_at) + " ago" | |
|
48 | 48 | %td= sub.points |
|
49 | 49 | %td.fix-width= sub.grader_comment |
|
50 | 50 | %td= sub.ip_address |
|
51 | 51 | - else |
|
52 | 52 | No submission |
|
53 | 53 | |
|
54 | + :javascript | |
|
55 | + $("#main_table").DataTable({ | |
|
56 | + paging: false | |
|
57 | + }); |
@@ -1,24 +1,35 | |||
|
1 | 1 | %h1 Editing site |
|
2 | 2 | = error_messages_for :site |
|
3 | 3 | = form_for(@site) do |f| |
|
4 | - %p | |
|
5 | - %b Name | |
|
6 | - %br/ | |
|
7 | - = f.text_field :name | |
|
8 | - %p | |
|
9 | - %b Password | |
|
10 | - %br/ | |
|
11 | - = f.text_field :password | |
|
12 | - %p | |
|
13 | - %b Started | |
|
14 | - %br/ | |
|
15 | - = f.check_box :started | |
|
16 | - %p | |
|
17 | - %b Start time | |
|
18 | - %br/ | |
|
19 | - = f.datetime_select :start_time, :include_blank => true | |
|
20 | - %p | |
|
21 | - = f.submit "Update" | |
|
4 | + .row | |
|
5 | + .col-md-4 | |
|
6 | + .form-group.field | |
|
7 | + = f.label :name, "Name" | |
|
8 | + = f.text_field :name, class: 'form-control' | |
|
9 | + .form-group.field | |
|
10 | + = f.label :password, "Password" | |
|
11 | + = f.text_field :password, class: 'form-control' | |
|
12 | + .form-group.field | |
|
13 | + = f.label :started, "Started" | |
|
14 | + = f.check_box :started, class: 'form-control' | |
|
15 | + .form-group.field | |
|
16 | + = f.label :start_time, "Start time" | |
|
17 | + -# = f.datetime_select :start_time, :include_blank => true | |
|
18 | + .input-group.date | |
|
19 | + = f.text_field :start_time, class:'form-control' , value: (@site.start_time ? @site.start_time.strftime('%d/%b/%Y %H:%M') : '') | |
|
20 | + %span.input-group-addon | |
|
21 | + %span.glyphicon.glyphicon-calendar | |
|
22 | + .actions | |
|
23 | + = f.submit "Update", class: 'btn btn-primary' | |
|
24 | + .col-md-8 | |
|
25 | + | |
|
22 | 26 | = link_to 'Show', @site |
|
23 | 27 | | |
|
24 | 28 | = link_to 'Back', sites_path |
|
29 | + | |
|
30 | + | |
|
31 | + :javascript | |
|
32 | + $('.input-group.date').datetimepicker({ | |
|
33 | + format: 'DD/MMM/YYYY HH:mm', | |
|
34 | + }); | |
|
35 | + |
@@ -1,7 +1,7 | |||
|
1 |
- %h1 |
|
|
1 | + %h1 Users | |
|
2 | 2 | |
|
3 | 3 | .panel.panel-primary |
|
4 | 4 | .panel-title.panel-heading |
|
5 | 5 | Quick Add |
|
6 | 6 | .panel-body |
|
7 | 7 | = form_tag( {method: 'post'}, {class: 'form-inline'}) do |
@@ -38,14 +38,14 | |||
|
38 | 38 | = submit_tag 'Submit', class: 'btn btn-default' |
|
39 | 39 | |
|
40 | 40 | |
|
41 | 41 | %p |
|
42 | 42 | = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '} |
|
43 | 43 | = link_to '+ New list of users', { :action => 'new_list' }, { class: 'btn btn-success '} |
|
44 | + = link_to 'Bulk Manage', bulk_manage_user_admin_path , { class: 'btn btn-default btn-info'} | |
|
44 | 45 | = link_to 'View administrators',{ :action => 'admin'}, { class: 'btn btn-default '} |
|
45 | - = link_to 'Bulk Manage', bulk_manage_user_admin_path , { class: 'btn btn-default '} | |
|
46 | 46 | = link_to 'Random passwords',{ :action => 'random_all_passwords'}, { class: 'btn btn-default '} |
|
47 | 47 | = link_to 'View active users',{ :action => 'active'}, { class: 'btn btn-default '} |
|
48 | 48 | = link_to 'Mass mailing',{ :action => 'mass_mailing'}, { class: 'btn btn-default '} |
|
49 | 49 | |
|
50 | 50 | - if GraderConfiguration.multicontests? |
|
51 | 51 | %br/ |
@@ -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 | + }); |
@@ -33,13 +33,13 | |||
|
33 | 33 | |
|
34 | 34 | %h2 Submission History |
|
35 | 35 | |
|
36 | 36 | =render partial: 'application/bar_graph', locals: {histogram: @histogram, param: {bar_width: 7}} |
|
37 | 37 | |
|
38 | 38 | |
|
39 | - %table.tablesorter-cafe#submission_table | |
|
39 | + %table#submission_table.table.table-striped | |
|
40 | 40 | %thead |
|
41 | 41 | %tr |
|
42 | 42 | %th ID |
|
43 | 43 | %th Problem code |
|
44 | 44 | %th Problem full name |
|
45 | 45 | %th Language |
@@ -61,6 +61,10 | |||
|
61 | 61 | %td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' ) |
|
62 | 62 | - if session[:admin] |
|
63 | 63 | %td= s.ip_address |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | |
|
67 | + :javascript | |
|
68 | + $("#submission_table").DataTable({ | |
|
69 | + paging: false | |
|
70 | + }); |
You need to be logged in to leave comments.
Login now