Description:
- countdown timer
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r572:10160025d8ee - - 9 files changed: 61 inserted, 10 deleted

@@ -26,48 +26,49
26 26 # To use ActiveModel has_secure_password
27 27 # gem 'bcrypt-ruby', '~> 3.0.0'
28 28
29 29 # To use Jbuilder templates for JSON
30 30 # gem 'jbuilder'
31 31
32 32 # Use unicorn as the app server
33 33 # gem 'unicorn'
34 34
35 35 # Deploy with Capistrano
36 36 # gem 'capistrano'
37 37
38 38 # To use debugger
39 39 # gem 'debugger'
40 40 #
41 41
42 42 #in-place editor
43 43 gem 'best_in_place', '~> 3.0.1'
44 44
45 45 # jquery addition
46 46 gem 'jquery-rails'
47 47 gem 'jquery-ui-sass-rails'
48 48 gem 'jquery-timepicker-addon-rails'
49 49 gem 'jquery-tablesorter'
50 + gem 'jquery-countdown-rails'
50 51
51 52 #syntax highlighter
52 53 gem 'rouge'
53 54
54 55 #add bootstrap
55 56 gem 'bootstrap-sass', '~> 3.2.0'
56 57 gem 'bootstrap-switch-rails'
57 58 gem 'bootstrap-toggle-rails'
58 59 gem 'autoprefixer-rails'
59 60
60 61 #bootstrap sortable
61 62 gem 'momentjs-rails'
62 63 gem 'rails_bootstrap_sortable'
63 64
64 65 #ace editor
65 66 gem 'ace-rails-ap'
66 67
67 68 gem 'haml'
68 69 gem 'haml-rails'
69 70 gem 'mail'
70 71 gem 'rdiscount'
71 72 gem 'test-unit'
72 73 gem 'will_paginate', '~> 3.0.7'
73 74 gem 'dynamic_form'
@@ -50,48 +50,49
50 50 bootstrap-toggle-rails (2.2.1.0)
51 51 builder (3.0.4)
52 52 coffee-rails (3.2.2)
53 53 coffee-script (>= 2.2.0)
54 54 railties (~> 3.2.0)
55 55 coffee-script (2.3.0)
56 56 coffee-script-source
57 57 execjs
58 58 coffee-script-source (1.9.0)
59 59 diff-lcs (1.2.5)
60 60 dynamic_form (1.1.4)
61 61 erubis (2.7.0)
62 62 execjs (2.3.0)
63 63 haml (4.0.6)
64 64 tilt
65 65 haml-rails (0.4)
66 66 actionpack (>= 3.1, < 4.1)
67 67 activesupport (>= 3.1, < 4.1)
68 68 haml (>= 3.1, < 4.1)
69 69 railties (>= 3.1, < 4.1)
70 70 hike (1.2.3)
71 71 i18n (0.7.0)
72 72 in_place_editing (1.2.0)
73 73 journey (1.0.4)
74 + jquery-countdown-rails (2.0.2)
74 75 jquery-rails (3.1.2)
75 76 railties (>= 3.0, < 5.0)
76 77 thor (>= 0.14, < 2.0)
77 78 jquery-tablesorter (1.13.4)
78 79 railties (>= 3.1, < 5)
79 80 jquery-timepicker-addon-rails (1.4.1)
80 81 railties (>= 3.1)
81 82 jquery-ui-rails (4.0.3)
82 83 jquery-rails
83 84 railties (>= 3.1.0)
84 85 jquery-ui-sass-rails (4.0.3.0)
85 86 jquery-rails
86 87 jquery-ui-rails (= 4.0.3)
87 88 railties (>= 3.1.0)
88 89 json (1.8.2)
89 90 mail (2.5.4)
90 91 mime-types (~> 1.16)
91 92 treetop (~> 1.4.8)
92 93 mime-types (1.25.1)
93 94 momentjs-rails (2.11.1)
94 95 railties (>= 3.1)
95 96 multi_json (1.10.1)
96 97 mysql2 (0.3.20)
97 98 polyglot (0.3.5)
@@ -161,43 +162,44
161 162 treetop (1.4.15)
162 163 polyglot
163 164 polyglot (>= 0.3.1)
164 165 tzinfo (0.3.43)
165 166 uglifier (2.7.0)
166 167 execjs (>= 0.3.0)
167 168 json (>= 1.8.0)
168 169 will_paginate (3.0.7)
169 170
170 171 PLATFORMS
171 172 ruby
172 173
173 174 DEPENDENCIES
174 175 ace-rails-ap
175 176 autoprefixer-rails
176 177 best_in_place (~> 3.0.1)
177 178 bootstrap-sass (~> 3.2.0)
178 179 bootstrap-switch-rails
179 180 bootstrap-toggle-rails
180 181 coffee-rails (~> 3.2.2)
181 182 dynamic_form
182 183 haml
183 184 haml-rails
184 185 in_place_editing
186 + jquery-countdown-rails
185 187 jquery-rails
186 188 jquery-tablesorter
187 189 jquery-timepicker-addon-rails
188 190 jquery-ui-sass-rails
189 191 mail
190 192 momentjs-rails
191 193 mysql2
192 194 prototype-rails
193 195 rails (= 3.2.21)
194 196 rails_bootstrap_sortable
195 197 rdiscount
196 198 rouge
197 199 rspec-rails (~> 2.99.0)
198 200 sass-rails (~> 3.2.6)
199 201 select2-rails
200 202 test-unit
201 203 uglifier
202 204 verification!
203 205 will_paginate (~> 3.0.7)
@@ -1,35 +1,42
1 1 // This is a manifest file that'll be compiled into application.js, which will include all the files
2 2 // listed below.
3 3 //
4 4 // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 5 // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 6 //
7 7 // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 8 // the compiled file.
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 15 //= require jquery.ui.all
16 16 //= require bootstrap-sprockets
17 17 //= require moment
18 18 //= require bootstrap-sortable
19 19 //= require select2
20 - //= require custom
21 20 //= require ace-rails-ap
22 21 //= require ace/mode-c_cpp
23 22 //= require ace/mode-ruby
24 23 //= require ace/mode-pascal
25 24 //= require ace/mode-javascript
26 25 //= require ace/mode-java
27 26 //= require ace/theme-merbivore
28 -
27 + //= require custom
28 + //= require jquery.countdown
29 + //-------------- addition from local_jquery -----------
30 + //= require jquery.ui.datepicker
31 + //= require jquery.ui.slider
32 + //= require jquery-ui-timepicker-addon
33 + //= require jquery-tablesorter
34 + //= require best_in_place
35 + //= require best_in_place.jquery-ui
29 36
30 37 // since this is after blank line, it is not downloaded
31 38 //x= require prototype
32 39 //x= require prototype_ujs
33 40 //x= require effects
34 41 //x= require dragdrop
35 42 //x= require controls
@@ -1,47 +1,52
1 1 $(document).on 'change', '.btn-file :file', ->
2 2 input = $(this)
3 3 numFiles = if input.get(0).files then input.get(0).files.length else 1
4 4 label = input.val().replace(/\\/g, '/').replace(/.*\//, '')
5 5 input.trigger 'fileselect', [
6 6 numFiles
7 7 label
8 8 ]
9 9 return
10 10
11 11
12 12 # document ready
13 13
14 14 $ ->
15 15 $(".select2").select2()
16 16 #$(".bootstrap-switch").bootstrapSwitch()
17 - $(".bootstrap-toggle").bootstrapToggle()
17 + #$(".bootstrap-toggle").bootstrapToggle()
18 18 $('.btn-file :file').on 'fileselect', (event, numFiles, label) ->
19 19 input = $(this).parents('.input-group').find(':text')
20 20 log = if numFiles > 1 then numFiles + ' files selected' else label
21 21 if input.length
22 22 input.val log
23 23 else
24 24 if log
25 25 alert log
26 26 return
27 27 $(".go-button").on 'click', (event) ->
28 28 link = $(this).attr("data-source")
29 29 url = $(link).val()
30 30 if url
31 31 window.location.href = url
32 32 return
33 33 $('.ajax-toggle').on 'click', (event) ->
34 34 target = $(event.target)
35 35 target.removeClass 'btn-default'
36 36 target.removeClass 'btn-success'
37 37 target.addClass 'btn-warning'
38 38 target.text '...'
39 39 return
40 40
41 +
41 42 #ace editor
43 + if $("#editor").length > 0
42 44 e = ace.edit("editor")
43 45 e.setTheme('ace/theme/merbivore')
44 46 e.getSession().setTabSize(2)
45 47 e.getSession().setUseSoftTabs(true)
46 48
49 + #best in place
50 + jQuery(".best_in_place").best_in_place()
51 +
47 52 return
@@ -1,49 +1,49
1 1 /*
2 2 * This is a manifest file that'll be compiled into application.css, which will include all the files
3 3 * listed below.
4 4 *
5 5 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 6 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 7 *
8 8 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 9 * compiled file so the styles you add here take precedence over styles defined in any styles
10 10 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11 11 * file per style scope.
12 12 *
13 13 // bootstrap says that we should not do this, but @import each file instead
14 14 # *= require_tree .
15 15 # *= require_self
16 16 */
17 17
18 18 @import jquery.ui.all
19 19 @import jquery.ui.core
20 - @import jquery.ui.core
21 20 @import jquery.ui.theme
22 21 @import jquery.ui.datepicker
23 22 @import jquery.ui.slider
24 23 @import jquery-ui-timepicker-addon
25 24 @import jquery-tablesorter/theme.metro-dark
25 + @import jquery.countdown
26 26 @import tablesorter-theme.cafe
27 27
28 28 //bootstrap
29 29 @import bootstrap-sprockets
30 30 @import bootstrap
31 31 @import select2
32 32 @import select2-bootstrap
33 33 //@import bootstrap3-switch
34 34 @import bootstrap-toggle
35 35 @import bootstrap-sortable
36 36
37 37 //bootstrap navbar color (from)
38 38 $bgDefault : #19197b
39 39 $bgHighlight : #06064b
40 40 $colDefault : #8e8eb4
41 41 $colHighlight : #ffffff
42 42 $dropDown : false
43 43 .navbar-default
44 44 background-color: $bgDefault
45 45 border-color: $bgHighlight
46 46 .navbar-brand
47 47 color: $colDefault
48 48 &:hover, &:focus
49 49 color: $colHighlight
@@ -113,48 +113,49
113 113 {class: "btn btn-block #{btn_size} btn-#{on ? 'success' : 'default'} ajax-toggle",
114 114 id: id,
115 115 data: {remote: true, method: 'get'}}
116 116 end
117 117
118 118 def get_ace_mode(language)
119 119 # return ace mode string from Language
120 120
121 121 case language.pretty_name
122 122 when 'Pascal'
123 123 'ace/mode/pascal'
124 124 when 'C++','C'
125 125 'ace/mode/c_cpp'
126 126 when 'Ruby'
127 127 'ace/mode/ruby'
128 128 when 'Python'
129 129 'ace/mode/python'
130 130 when 'Java'
131 131 'ace/mode/java'
132 132 else
133 133 'ace/mode/c_cpp'
134 134 end
135 135 end
136 136
137 +
137 138 def user_title_bar(user)
138 139 header = ''
139 140 time_left = ''
140 141
141 142 #
142 143 # if the contest is over
143 144 if GraderConfiguration.time_limit_mode?
144 145 if user.contest_finished?
145 146 header = <<CONTEST_OVER
146 147 <tr><td colspan="2" align="center">
147 148 <span class="contest-over-msg">THE CONTEST IS OVER</span>
148 149 </td></tr>
149 150 CONTEST_OVER
150 151 end
151 152 if !user.contest_started?
152 153 time_left = "&nbsp;&nbsp;" + (t 'title_bar.contest_not_started')
153 154 else
154 155 time_left = "&nbsp;&nbsp;" + (t 'title_bar.remaining_time') +
155 156 " #{format_short_duration(user.contest_time_left)}"
156 157 end
157 158 end
158 159
159 160 #
160 161 # if the contest is in the anaysis mode
@@ -1,32 +1,34
1 - - content_for :header do
2 - = javascript_include_tag 'local_jquery'
1 + /- content_for :header do
2 + / = javascript_include_tag 'local_jquery'
3 3
4 4 %h1 System configuration
5 5
6 6 %table.info
7 7 %tr.info-head
8 8 %th Key
9 9 %th Type
10 10 %th Value
11 11 %th Description
12 12 - @configurations.each do |conf|
13 13 - @grader_configuration = conf
14 14 %tr{:class => cycle("info-odd", "info-even")}
15 15 %td
16 - = in_place_editor_field :grader_configuration, :key, {}, :rows=>1
16 + /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1
17 + = @grader_configuration.key
17 18 %td
18 - = in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1
19 + /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1
20 + = @grader_configuration.value_type
19 21 %td
20 22 = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel"
21 23 %td= conf.description
22 24
23 25 - if GraderConfiguration.config_cached?
24 26 %br/
25 27 Your config is saved, but it does not automatically take effect.
26 28 %br/
27 29 If you have one mongrel process running, you can
28 30 = link_to '[click]', :action => 'reload'
29 31 here to reload.
30 32 %br/
31 33 If you have more than one process running, you should restart
32 34 them manually.
@@ -1,73 +1,84
1 1 %header.navbar.navbar-default.navbar-fixed-top
2 2 %nav
3 3 .container-fluid
4 4 .navbar-header
5 5 %a.navbar-brand{href: main_list_path}
6 6 %span.glyphicon.glyphicon-home
7 7 MAIN
8 8 .collapse.navbar-collapse
9 9 %ul.nav.navbar-nav
10 10 - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user))
11 11 //= add_menu("#{I18n.t 'menu.tasks'}", 'tasks', 'list')
12 12 %li.dropdown
13 13 %a.dropdown-toggle{href: '#', data: {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
14 14 = "#{I18n.t 'menu.submissions'}"
15 15 %span.caret
16 16 %ul.dropdown-menu
17 17 = add_menu("View", 'main', 'submission')
18 18 = add_menu("Self Test", 'test', 'index')
19 19 - if GraderConfiguration['right.user_hall_of_fame']
20 20 = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof')
21 + / display MODE button (with countdown in contest mode)
22 + - if GraderConfiguration.analysis_mode?
23 + %div.navbar-btn.btn.btn-success#countdown= "ANALYSIS MODE"
24 + - elsif GraderConfiguration.time_limit_mode?
25 + - if @current_user.contest_finished?
26 + %div.navbar-btn.btn.btn-danger#countdown= "Contest is over"
27 + - elsif !@current_user.contest_started?
28 + %div.navbar-btn.btn.btn-primary#countdown= (t 'title_bar.contest_not_started')
29 + - else
30 + %div.navbar-btn.btn.btn-primary#countdown asdf
31 + :javascript
32 + $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'});
33 + / admin section
21 34 - if (@current_user!=nil) and (session[:admin])
22 35 %li.dropdown
23 36 %a.dropdown-toggle{href: '#', data: {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
24 37 Manage
25 38 %span.caret
26 39 %ul.dropdown-menu
27 40 = add_menu( 'Announcements', 'announcements', 'index')
28 41 = add_menu( 'Problems', 'problems', 'index')
29 42 = add_menu( 'Users', 'user_admin', 'index')
30 43 = add_menu( 'Graders', 'graders', 'list')
31 44 = add_menu( 'Message ', 'messages', 'console')
32 45 %li.divider{role: 'separator'}
33 46 = add_menu( 'System config', 'configurations', 'index')
34 47 %li.divider{role: 'separator'}
35 48 = add_menu( 'Sites', 'sites', 'index')
36 49 = add_menu( 'Contests', 'contest_management', 'index')
37 50 %li.dropdown
38 51 %a.dropdown-toggle{href: '#', data: {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
39 52 Report
40 53 %span.caret
41 54 %ul.dropdown-menu
42 55 = add_menu( 'Results', 'user_admin', 'user_stat')
43 56 = add_menu( 'Report', 'report', 'multiple_login')
44 57 - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0
45 58 =link_to "#{ungraded} backlogs!",
46 59 grader_list_path,
47 60 class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission'
48 - =link_to 'Contest Mode, time remain: 00:20:33',grader_list_path,
49 - class: 'navbar-btn btn btn-primary'
50 61
51 62 %ul.nav.navbar-nav.navbar-right
52 63 = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help')
53 64 = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}})
54 65 - if GraderConfiguration['system.user_setting_enabled']
55 66 = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}})
56 67 = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{@current_user.full_name}".html_safe, 'main', 'login', {title: I18n.t('menu.log_out'), data: {toggle: 'tooltip'}})
57 68
58 69 /
59 70 - if (@current_user!=nil) and (session[:admin])
60 71 %nav.navbar.navbar-fixed-top.navbar-inverse.secondnavbar
61 72 .container-fluid
62 73 .collapse.navbar-collapse
63 74 %ul.nav.navbar-nav
64 75 = add_menu( '[Announcements]', 'announcements', 'index')
65 76 = add_menu( '[Msg console]', 'messages', 'console')
66 77 = add_menu( '[Problems]', 'problems', 'index')
67 78 = add_menu( '[Users]', 'user_admin', 'index')
68 79 = add_menu( '[Results]', 'user_admin', 'user_stat')
69 80 = add_menu( '[Report]', 'report', 'multiple_login')
70 81 = add_menu( '[Graders]', 'graders', 'list')
71 82 = add_menu( '[Contests]', 'contest_management', 'index')
72 83 = add_menu( '[Sites]', 'sites', 'index')
73 84 = add_menu( '[System config]', 'configurations', 'index')
@@ -1,48 +1,70
1 1 %h1 Listing 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
8 8 .form-group
9 9 = label_tag 'user_login', 'Login'
10 10 = text_field 'user', 'login', :size => 10,class: 'form-control'
11 11 .form-group
12 12 = label_tag 'user_full_name', 'Full Name'
13 13 = text_field 'user', 'full_name', :size => 10,class: 'form-control'
14 14 .form-group
15 15 = label_tag 'user_password', 'Password'
16 16 = text_field 'user', 'password', :size => 10,class: 'form-control'
17 17 .form-group
18 18 = label_tag 'user_password_confirmation', 'Confirm'
19 19 = text_field 'user', 'password_confirmation', :size => 10,class: 'form-control'
20 20 .form-group
21 21 = label_tag 'user_email', 'email'
22 22 = text_field 'user', 'email', :size => 10,class: 'form-control'
23 23 =submit_tag "Create", class: 'btn btn-primary'
24 24
25 + .panel.panel-primary
26 + .panel-title.panel-heading
27 + Import from site management
28 + .panel-body
29 + = form_tag( {method: 'post',multipart: true, action: 'import'}, {class: 'form-inline'}) do
30 + .form-group
31 + = label_tag 'user_login', 'Login'
32 + = text_field 'user', 'login', :size => 10,class: 'form-control'
33 + .form-group
34 + = label_tag 'user_full_name', 'Full Name'
35 + = text_field 'user', 'full_name', :size => 10,class: 'form-control'
36 + .form-group
37 + = label_tag 'user_password', 'Password'
38 + = text_field 'user', 'password', :size => 10,class: 'form-control'
39 + .form-group
40 + = label_tag 'user_password_confirmation', 'Confirm'
41 + = text_field 'user', 'password_confirmation', :size => 10,class: 'form-control'
42 + .form-group
43 + = label_tag 'user_email', 'email'
44 + = text_field 'user', 'email', :size => 10,class: 'form-control'
45 + =submit_tag "Create", class: 'btn btn-primary'
46 +
25 47 .submitbox
26 48 %b Import from site management
27 49 = form_tag({:action => 'import'}, :multipart => true) do
28 50 File: #{file_field_tag 'file'} #{submit_tag 'Import'}
29 51 %br/
30 52 %b What else:
31 53 = link_to 'New user', {:action => 'new'}, { class: 'btn btn-default btn-sm'}
32 54 = link_to 'New list of users',{ :action => 'new_list'}, { class: 'btn btn-default btn-sm'}
33 55 = link_to 'View administrators',{ :action => 'admin'}, { class: 'btn btn-default btn-sm'}
34 56 = link_to 'Random passwords',{ :action => 'random_all_passwords'}, { class: 'btn btn-default btn-sm'}
35 57 = link_to 'View active users',{ :action => 'active'}, { class: 'btn btn-default btn-sm'}
36 58 = link_to 'Mass mailing',{ :action => 'mass_mailing'}, { class: 'btn btn-default btn-sm'}
37 59 - if GraderConfiguration.multicontests?
38 60 %br/
39 61 %b Multi-contest:
40 62 = link_to '[Manage bulk users in contests]', :action => 'contest_management'
41 63 View users in:
42 64 - @contests.each do |contest|
43 65 = link_to "[#{contest.name}]", :action => 'contests', :id => contest.id
44 66 = link_to "[no contest]", :action => 'contests', :id => 'none'
45 67 Total #{@user_count} users |
46 68 - if !@paginated
47 69 Display all users.
48 70 \#{link_to '[show in pages]', :action => 'index', :page => '1'}
You need to be logged in to leave comments. Login now