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

r693:8edec20582c5 - - 7 files changed: 58 inserted, 30 deleted

@@ -1,91 +1,92
1 1 source 'https://rubygems.org'
2 2
3 3 #rails
4 4 gem 'rails', '~>4.2.0'
5 5 gem 'activerecord-session_store'
6 6
7 7
8 8 # Bundle edge Rails instead:
9 9 # gem 'rails', :git => 'git://github.com/rails/rails.git'
10 10
11 11 #---------------- database ---------------------
12 12 #the database
13 13 gem 'mysql2'
14 14 #for testing
15 15 gem 'sqlite3'
16 16 #for dumping database into yaml
17 17 gem 'yaml_db'
18 18
19 19 # Gems used only for assets and not required
20 20 # in production environments by default.
21 21 gem 'sass-rails'
22 22 gem 'coffee-rails'
23 23
24 24 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
25 25 # gem 'therubyracer', :platforms => :ruby
26 26
27 27 gem 'uglifier'
28 28
29 29 gem 'haml'
30 30 gem 'haml-rails'
31 31 # gem 'prototype-rails'
32 32
33 33 # To use ActiveModel has_secure_password
34 34 # gem 'bcrypt-ruby', '~> 3.0.0'
35 35
36 36 # To use Jbuilder templates for JSON
37 37 # gem 'jbuilder'
38 38
39 39 # Use unicorn as the app server
40 40 # gem 'unicorn'
41 41
42 42 # Deploy with Capistrano
43 43 # gem 'capistrano'
44 44
45 45 # To use debugger
46 46 # gem 'debugger'
47 47 #
48 48
49 49 #in-place editor
50 50 gem 'best_in_place', '~> 3.0.1'
51 51
52 52 # jquery addition
53 53 gem 'jquery-rails'
54 54 gem 'jquery-ui-rails'
55 55 gem 'jquery-timepicker-addon-rails'
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 67 gem 'momentjs-rails'
68 68 gem 'rails_bootstrap_sortable'
69 - gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
69 + gem 'bootstrap-datepicker-rails'
70 + gem 'bootstrap3-datetimepicker-rails'
70 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'
77 78 #paginator
78 79 gem 'will_paginate', '~> 3.0.7'
79 80
80 81 gem 'mail'
81 82 gem 'rdiscount'
82 83 gem 'dynamic_form'
83 84 gem 'in_place_editing'
84 85 gem 'verification', :git => 'https://github.com/sikachu/verification.git'
85 86
86 87
87 88 #---------------- testiing -----------------------
88 89 gem 'minitest-reporters'
89 90
90 91 #---------------- for console --------------------
91 92 gem 'fuzzy-string-match'
@@ -1,244 +1,247
1 1 GIT
2 2 remote: https://github.com/sikachu/verification.git
3 3 revision: ff31697b940d7b0e2ec65f08764215c96104e76d
4 4 specs:
5 5 verification (1.0.3)
6 6 actionpack (>= 3.0.0, < 5.1)
7 7 activesupport (>= 3.0.0, < 5.1)
8 8
9 9 GEM
10 10 remote: https://rubygems.org/
11 11 specs:
12 12 RubyInline (3.12.4)
13 13 ZenTest (~> 4.3)
14 14 ZenTest (4.11.1)
15 15 ace-rails-ap (4.1.1)
16 16 actionmailer (4.2.7.1)
17 17 actionpack (= 4.2.7.1)
18 18 actionview (= 4.2.7.1)
19 19 activejob (= 4.2.7.1)
20 20 mail (~> 2.5, >= 2.5.4)
21 21 rails-dom-testing (~> 1.0, >= 1.0.5)
22 22 actionpack (4.2.7.1)
23 23 actionview (= 4.2.7.1)
24 24 activesupport (= 4.2.7.1)
25 25 rack (~> 1.6)
26 26 rack-test (~> 0.6.2)
27 27 rails-dom-testing (~> 1.0, >= 1.0.5)
28 28 rails-html-sanitizer (~> 1.0, >= 1.0.2)
29 29 actionview (4.2.7.1)
30 30 activesupport (= 4.2.7.1)
31 31 builder (~> 3.1)
32 32 erubis (~> 2.7.0)
33 33 rails-dom-testing (~> 1.0, >= 1.0.5)
34 34 rails-html-sanitizer (~> 1.0, >= 1.0.2)
35 35 activejob (4.2.7.1)
36 36 activesupport (= 4.2.7.1)
37 37 globalid (>= 0.3.0)
38 38 activemodel (4.2.7.1)
39 39 activesupport (= 4.2.7.1)
40 40 builder (~> 3.1)
41 41 activerecord (4.2.7.1)
42 42 activemodel (= 4.2.7.1)
43 43 activesupport (= 4.2.7.1)
44 44 arel (~> 6.0)
45 45 activerecord-session_store (1.0.0)
46 46 actionpack (>= 4.0, < 5.1)
47 47 activerecord (>= 4.0, < 5.1)
48 48 multi_json (~> 1.11, >= 1.11.2)
49 49 rack (>= 1.5.2, < 3)
50 50 railties (>= 4.0, < 5.1)
51 51 activesupport (4.2.7.1)
52 52 i18n (~> 0.7)
53 53 json (~> 1.7, >= 1.7.7)
54 54 minitest (~> 5.1)
55 55 thread_safe (~> 0.3, >= 0.3.4)
56 56 tzinfo (~> 1.1)
57 57 ansi (1.5.0)
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)
68 70 bootstrap3-datetimepicker-rails (4.17.47)
69 71 momentjs-rails (>= 2.8.1)
70 72 builder (3.2.2)
71 73 coffee-rails (4.2.1)
72 74 coffee-script (>= 2.2.0)
73 75 railties (>= 4.0.0, < 5.2.x)
74 76 coffee-script (2.4.1)
75 77 coffee-script-source
76 78 execjs
77 79 coffee-script-source (1.12.2)
78 80 concurrent-ruby (1.0.4)
79 81 dynamic_form (1.1.4)
80 82 erubis (2.7.0)
81 83 execjs (2.7.0)
82 84 fuzzy-string-match (1.0.0)
83 85 RubyInline (>= 3.8.6)
84 86 globalid (0.3.7)
85 87 activesupport (>= 4.1.0)
86 88 haml (4.0.7)
87 89 tilt
88 90 haml-rails (0.9.0)
89 91 actionpack (>= 4.0.1)
90 92 activesupport (>= 4.0.1)
91 93 haml (>= 4.0.6, < 5.0)
92 94 html2haml (>= 1.0.1)
93 95 railties (>= 4.0.1)
94 96 html2haml (2.0.0)
95 97 erubis (~> 2.7.0)
96 98 haml (~> 4.0.0)
97 99 nokogiri (~> 1.6.0)
98 100 ruby_parser (~> 3.5)
99 101 i18n (0.7.0)
100 102 in_place_editing (1.2.0)
101 103 jquery-countdown-rails (2.0.2)
102 104 jquery-datatables-rails (3.4.0)
103 105 actionpack (>= 3.1)
104 106 jquery-rails
105 107 railties (>= 3.1)
106 108 sass-rails
107 109 jquery-rails (4.2.1)
108 110 rails-dom-testing (>= 1, < 3)
109 111 railties (>= 4.2.0)
110 112 thor (>= 0.14, < 2.0)
111 113 jquery-tablesorter (1.23.3)
112 114 railties (>= 3.2, < 6)
113 115 jquery-timepicker-addon-rails (1.4.1)
114 116 railties (>= 3.1)
115 117 jquery-ui-rails (6.0.1)
116 118 railties (>= 3.2.16)
117 119 json (1.8.3)
118 120 loofah (2.0.3)
119 121 nokogiri (>= 1.5.9)
120 122 mail (2.6.4)
121 123 mime-types (>= 1.16, < 4)
122 124 mime-types (3.1)
123 125 mime-types-data (~> 3.2015)
124 126 mime-types-data (3.2016.0521)
125 127 mini_portile2 (2.1.0)
126 128 minitest (5.10.1)
127 129 minitest-reporters (1.1.13)
128 130 ansi
129 131 builder
130 132 minitest (>= 5.0)
131 133 ruby-progressbar
132 134 momentjs-rails (2.15.1)
133 135 railties (>= 3.1)
134 136 multi_json (1.12.1)
135 137 mysql2 (0.4.5)
136 138 nokogiri (1.6.8.1)
137 139 mini_portile2 (~> 2.1.0)
138 140 rack (1.6.5)
139 141 rack-test (0.6.3)
140 142 rack (>= 1.0)
141 143 rails (4.2.7.1)
142 144 actionmailer (= 4.2.7.1)
143 145 actionpack (= 4.2.7.1)
144 146 actionview (= 4.2.7.1)
145 147 activejob (= 4.2.7.1)
146 148 activemodel (= 4.2.7.1)
147 149 activerecord (= 4.2.7.1)
148 150 activesupport (= 4.2.7.1)
149 151 bundler (>= 1.3.0, < 2.0)
150 152 railties (= 4.2.7.1)
151 153 sprockets-rails
152 154 rails-deprecated_sanitizer (1.0.3)
153 155 activesupport (>= 4.2.0.alpha)
154 156 rails-dom-testing (1.0.8)
155 157 activesupport (>= 4.2.0.beta, < 5.0)
156 158 nokogiri (~> 1.6)
157 159 rails-deprecated_sanitizer (>= 1.0.1)
158 160 rails-html-sanitizer (1.0.3)
159 161 loofah (~> 2.0)
160 162 rails_bootstrap_sortable (2.0.1)
161 163 momentjs-rails (>= 2.8.3)
162 164 railties (4.2.7.1)
163 165 actionpack (= 4.2.7.1)
164 166 activesupport (= 4.2.7.1)
165 167 rake (>= 0.8.7)
166 168 thor (>= 0.18.1, < 2.0)
167 169 rake (12.0.0)
168 170 rdiscount (2.2.0.1)
169 171 rouge (2.0.7)
170 172 ruby-progressbar (1.8.1)
171 173 ruby_parser (3.8.3)
172 174 sexp_processor (~> 4.1)
173 175 sass (3.4.23)
174 176 sass-rails (5.0.6)
175 177 railties (>= 4.0.0, < 6)
176 178 sass (~> 3.1)
177 179 sprockets (>= 2.8, < 4.0)
178 180 sprockets-rails (>= 2.0, < 4.0)
179 181 tilt (>= 1.1, < 3)
180 182 select2-rails (4.0.3)
181 183 thor (~> 0.14)
182 184 sexp_processor (4.7.0)
183 185 sprockets (3.7.1)
184 186 concurrent-ruby (~> 1.0)
185 187 rack (> 1, < 3)
186 188 sprockets-rails (3.2.0)
187 189 actionpack (>= 4.0)
188 190 activesupport (>= 4.0)
189 191 sprockets (>= 3.0.0)
190 192 sqlite3 (1.3.12)
191 193 thor (0.19.4)
192 194 thread_safe (0.3.5)
193 195 tilt (2.0.5)
194 196 tzinfo (1.2.2)
195 197 thread_safe (~> 0.1)
196 198 uglifier (3.0.4)
197 199 execjs (>= 0.3.0, < 3)
198 200 will_paginate (3.0.12)
199 201 yaml_db (0.4.2)
200 202 rails (>= 3.0, < 5.1)
201 203 rake (>= 0.8.7)
202 204
203 205 PLATFORMS
204 206 ruby
205 207
206 208 DEPENDENCIES
207 209 ace-rails-ap
208 210 activerecord-session_store
209 211 autoprefixer-rails
210 212 best_in_place (~> 3.0.1)
213 + bootstrap-datepicker-rails
211 214 bootstrap-sass (~> 3.2.0)
212 215 bootstrap-switch-rails
213 216 bootstrap-toggle-rails
214 - bootstrap3-datetimepicker-rails (~> 4.17.47)
217 + bootstrap3-datetimepicker-rails
215 218 coffee-rails
216 219 dynamic_form
217 220 fuzzy-string-match
218 221 haml
219 222 haml-rails
220 223 in_place_editing
221 224 jquery-countdown-rails
222 225 jquery-datatables-rails
223 226 jquery-rails
224 227 jquery-tablesorter
225 228 jquery-timepicker-addon-rails
226 229 jquery-ui-rails
227 230 mail
228 231 minitest-reporters
229 232 momentjs-rails
230 233 mysql2
231 234 rails (~> 4.2.0)
232 235 rails_bootstrap_sortable
233 236 rdiscount
234 237 rouge
235 238 sass-rails
236 239 select2-rails
237 240 sqlite3
238 241 uglifier
239 242 verification!
240 243 will_paginate (~> 3.0.7)
241 244 yaml_db
242 245
243 246 BUNDLED WITH
244 247 1.15.4
@@ -1,45 +1,47
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 dataTables/jquery.dataTables
16 16 //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
17 17 //= require jquery-ui
18 18 //= require bootstrap-sprockets
19 19 //= require moment
20 20 //= require moment/th
21 21 //= require bootstrap-sortable
22 22 //= require bootstrap-datetimepicker
23 23 //= require select2
24 24 //= require ace-rails-ap
25 25 //= require ace/mode-c_cpp
26 26 //= require ace/mode-python
27 27 //= require ace/mode-ruby
28 28 //= require ace/mode-pascal
29 29 //= require ace/mode-javascript
30 30 //= require ace/mode-java
31 31 //= require ace/theme-merbivore
32 32 //= require custom
33 33 //= require jquery.countdown
34 34 //-------------- addition from local_jquery -----------
35 35 //= require jquery-tablesorter
36 36 //= require best_in_place
37 37 //= require best_in_place.jquery-ui
38 38 //= require brython
39 + //= require bootstrap-datepicker
40 + //= require bootstrap-datetimepicker
39 41
40 42 // since this is after blank line, it is not downloaded
41 43 //x= require prototype
42 44 //x= require prototype_ujs
43 45 //x= require effects
44 46 //x= require dragdrop
45 47 //x= require controls
@@ -1,131 +1,132
1 1 /* This is a manifest file that'll be compiled into application.css, which will include all the files
2 2 * listed below.
3 3 *
4 4 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
5 5 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
6 6 *
7 7 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
8 8 * compiled file so the styles you add here take precedence over styles defined in any styles
9 9 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
10 10 * file per style scope.
11 11 *
12 12 * // bootstrap says that we should not do this, but @import each file instead
13 13 * # *= require_tree .
14 14 * # *= require_self
15 15 */
16 16
17 17 @import "jquery-ui";
18 18 //@import "jquery.ui.core";
19 19 //@import "jquery.ui.theme";
20 20 //@import "jquery.ui.datepicker";
21 21 //@import "jquery.ui.slider";
22 22 @import "jquery-ui-timepicker-addon";
23 23 @import "jquery-tablesorter/theme.metro-dark";
24 24 @import "jquery.countdown";
25 25 @import "tablesorter-theme.cafe";
26 26
27 27 //bootstrap
28 28 @import "bootstrap-sprockets";
29 29 @import "bootstrap";
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";
36 37 @import "bootstrap-datetimepicker";
37 38 @import "dataTables/bootstrap/3/jquery.dataTables.bootstrap";
38 39
39 40 //bootstrap navbar color (from)
40 41 $bgDefault: #19197b;
41 42 $bgHighlight: #06064b;
42 43 $colDefault: #8e8eb4;
43 44 $colHighlight: #ffffff;
44 45 $dropDown: false;
45 46
46 47 @font-face {
47 48 font-family: 'Glyphicons Halflings';
48 49 src: font-path('bootstrap/glyphicons-halflings-regular.eot');
49 50 src: font-path('bootstrap/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
50 51 font-path('bootstrap/glyphicons-halflings-regular.woff') format('woff'),
51 52 font-path('bootstrap/glyphicons-halflings-regular.ttf') format('truetype'),
52 53 font-path('bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
53 54 }
54 55
55 56
56 57 .navbar-default {
57 58 background-color: $bgDefault;
58 59 border-color: $bgHighlight;
59 60
60 61 .navbar-brand {
61 62 color: $colDefault;
62 63
63 64 &:hover, &:focus {
64 65 color: $colHighlight;
65 66 }
66 67 }
67 68
68 69 .navbar-text {
69 70 color: $colDefault;
70 71 }
71 72
72 73 .navbar-nav {
73 74 > li {
74 75 > a {
75 76 color: $colDefault;
76 77
77 78 &:hover, &:focus {
78 79 color: $colHighlight;
79 80 }
80 81 }
81 82
82 83 @if $dropDown {
83 84 > .dropdown-menu {
84 85 background-color: $bgDefault;
85 86
86 87 > li {
87 88 > a {
88 89 color: $colDefault;
89 90
90 91 &:hover, &:focus {
91 92 color: $colHighlight;
92 93 background-color: $bgHighlight;
93 94 }
94 95 }
95 96
96 97 > .divider {
97 98 background-color: $bgHighlight;
98 99 }
99 100 }
100 101 }
101 102 }
102 103 }
103 104
104 105 @if $dropDown {
105 106 .open .dropdown-menu > .active {
106 107 > a, > a:hover, > a:focus {
107 108 color: $colHighlight;
108 109 background-color: $bgHighlight;
109 110 }
110 111 }
111 112 }
112 113
113 114 > .active {
114 115 > a, > a:hover, > a:focus {
115 116 color: $colHighlight;
116 117 background-color: $bgHighlight;
117 118 }
118 119 }
119 120
120 121 > .open {
121 122 > a, > a:hover, > a:focus {
122 123 color: $colHighlight;
123 124 background-color: $bgHighlight;
124 125 }
125 126 }
126 127 }
127 128
128 129 .navbar-toggle {
129 130 border-color: $bgHighlight;
130 131
131 132 &:hover, &:focus {
@@ -165,145 +165,142
165 165 redirect_to :controller => 'main', :action => 'list'
166 166 return
167 167 end
168 168 @submissions = Submission.includes(:user).where(problem_id: params[:id]).order(:user_id,:id)
169 169
170 170 #stat summary
171 171 range =65
172 172 @histogram = { data: Array.new(range,0), summary: {} }
173 173 user = Hash.new(0)
174 174 @submissions.find_each do |sub|
175 175 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
176 176 @histogram[:data][d.to_i] += 1 if d < range
177 177 user[sub.user_id] = [user[sub.user_id], ((sub.try(:points) || 0) >= @problem.full_score) ? 1 : 0].max
178 178 end
179 179 @histogram[:summary][:max] = [@histogram[:data].max,1].max
180 180
181 181 @summary = { attempt: user.count, solve: 0 }
182 182 user.each_value { |v| @summary[:solve] += 1 if v == 1 }
183 183 end
184 184
185 185 def manage
186 186 @problems = Problem.order(date_added: :desc)
187 187 end
188 188
189 189 def do_manage
190 190 if params.has_key? 'change_date_added'
191 191 change_date_added
192 192 elsif params.has_key? 'add_to_contest'
193 193 add_to_contest
194 194 elsif params.has_key? 'enable_problem'
195 195 set_available(true)
196 196 elsif params.has_key? 'disable_problem'
197 197 set_available(false)
198 198 elsif params.has_key? 'add_group'
199 199 group = Group.find(params[:group_id])
200 200 ok = []
201 201 failed = []
202 202 get_problems_from_params.each do |p|
203 203 begin
204 204 group.problems << p
205 205 ok << p.full_name
206 206 rescue => e
207 207 failed << p.full_name
208 208 end
209 209 end
210 210 flash[:success] = "The following problems are added to the group #{group.name}: " + ok.join(', ') if ok.count > 0
211 211 flash[:alert] = "The following problems are already in the group #{group.name}: " + failed.join(', ') if failed.count > 0
212 212 end
213 213
214 214 redirect_to :action => 'manage'
215 215 end
216 216
217 217 def import
218 218 @allow_test_pair_import = allow_test_pair_import?
219 219 end
220 220
221 221 def do_import
222 222 old_problem = Problem.find_by_name(params[:name])
223 223 if !allow_test_pair_import? and params.has_key? :import_to_db
224 224 params.delete :import_to_db
225 225 end
226 226 @problem, import_log = Problem.create_from_import_form_params(params,
227 227 old_problem)
228 228
229 229 if !@problem.errors.empty?
230 230 render :action => 'import' and return
231 231 end
232 232
233 233 if old_problem!=nil
234 234 flash[:notice] = "The test data has been replaced for problem #{@problem.name}"
235 235 end
236 236 @log = import_log
237 237 end
238 238
239 239 def remove_contest
240 240 problem = Problem.find(params[:id])
241 241 contest = Contest.find(params[:contest_id])
242 242 if problem!=nil and contest!=nil
243 243 problem.contests.delete(contest)
244 244 end
245 245 redirect_to :action => 'manage'
246 246 end
247 247
248 248 ##################################
249 249 protected
250 250
251 251 def allow_test_pair_import?
252 252 if defined? ALLOW_TEST_PAIR_IMPORT
253 253 return ALLOW_TEST_PAIR_IMPORT
254 254 else
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 - year = params[:date_added][:year].to_i
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
271 268 def add_to_contest
272 269 problems = get_problems_from_params
273 270 contest = Contest.find(params[:contest][:id])
274 271 if contest!=nil and contest.enabled
275 272 problems.each do |p|
276 273 p.contests << contest
277 274 end
278 275 end
279 276 end
280 277
281 278 def set_available(avail)
282 279 problems = get_problems_from_params
283 280 problems.each do |p|
284 281 p.available = avail
285 282 p.save
286 283 end
287 284 end
288 285
289 286 def get_problems_from_params
290 287 problems = []
291 288 params.keys.each do |k|
292 289 if k.index('prob-')==0
293 290 name, id, order = k.split('-')
294 291 problems << Problem.find(id)
295 292 end
296 293 end
297 294 problems
298 295 end
299 296
300 297 def get_problems_stat
301 298 end
302 299
303 300 private
304 301
305 302 def problem_params
306 303 params.require(:problem).permit(:name, :full_name, :full_score, :date_added, :available, :test_allowed,:output_only, :url, :description)
307 304 end
308 305
309 306 end
@@ -1,94 +1,107
1 1 - content_for :head do
2 2 = stylesheet_link_tag 'problems'
3 3 = javascript_include_tag 'local_jquery'
4 4
5 5 :javascript
6 6 $(document).ready( function() {
7 7 function shiftclick(start,stop,value) {
8 8 $('tr input').each( function(id,input) {
9 9 var $input=$(input);
10 10 var iid=parseInt($input.attr('id').split('-')[2]);
11 11 if(iid>=start&&iid<=stop){
12 12 $input.prop('checked',value)
13 13 }
14 14 });
15 15 }
16 16
17 17 $('tr input').click( function(e) {
18 18 if (e.shiftKey) {
19 19 stop = parseInt($(this).attr('id').split('-')[2]);
20 20 var orig_stop = stop
21 21 if (typeof start !== 'undefined') {
22 22 if (start > stop) {
23 23 var tmp = start;
24 24 start = stop;
25 25 stop = tmp;
26 26 }
27 27 shiftclick(start,stop,$(this).is(':checked') )
28 28 }
29 29 start = orig_stop
30 30 } else {
31 31 start = parseInt($(this).attr('id').split('-')[2]);
32 32 }
33 33 });
34 34 });
35 35
36 36
37 37 %h1 Manage problems
38 38
39 39 %p= link_to '[Back to problem list]', problems_path
40 40
41 41 = form_tag :action=>'do_manage' do
42 42 .panel.panel-primary
43 43 .panel-heading
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 &nbsp;&nbsp;&nbsp;
55 - = submit_tag 'Change', :name => 'change_date_added', class: 'btn btn-default'
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-default'
59 - = submit_tag 'False', :name => 'disable_problem', class: 'btn btn-default'
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-default'
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
72 76 %table.table.table-hover
73 77 %tr{style: "text-align: left;"}
74 78 %th= check_box_tag 'select_all'
75 79 %th Name
76 80 %th Full name
77 81 %th Available
78 82 %th Date added
79 83 - if GraderConfiguration.multicontests?
80 84 %th Contests
81 85
82 86 - num = 0
83 87 - for problem in @problems
84 88 - num += 1
85 89 %tr{:id => "row-prob-#{problem.id}", :name=> "prob-#{problem.id}"}
86 90 %td= check_box_tag "prob-#{problem.id}-#{num}"
87 91 %td= problem.name
88 92 %td= problem.full_name
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 +
@@ -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 +
You need to be logged in to leave comments. Login now