Description:
change datetime picker widget
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r692:57c9378ff75a - - 7 files changed: 62 inserted, 29 deleted
@@ -1,91 +1,93 | |||
|
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 | #add bootstrap |
|
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 | |
|
68 | - #bootstrap sortable | |
|
68 | + #more bootstrp add-on | |
|
69 | 69 | gem 'momentjs-rails' |
|
70 | 70 | gem 'rails_bootstrap_sortable' |
|
71 | + gem 'bootstrap-datepicker-rails' | |
|
72 | + gem 'bootstrap3-datetimepicker-rails' | |
|
71 | 73 | |
|
72 | 74 | #----------- user interface ----------------- |
|
73 | 75 | #select 2 |
|
74 | 76 | gem 'select2-rails' |
|
75 | 77 | #ace editor |
|
76 | 78 | gem 'ace-rails-ap' |
|
77 | 79 | #paginator |
|
78 | 80 | gem 'will_paginate', '~> 3.0.7' |
|
79 | 81 | |
|
80 | 82 | gem 'mail' |
|
81 | 83 | gem 'rdiscount' |
|
82 | 84 | gem 'dynamic_form' |
|
83 | 85 | gem 'in_place_editing' |
|
84 | 86 | gem 'verification', :git => 'https://github.com/sikachu/verification.git' |
|
85 | 87 | |
|
86 | 88 | |
|
87 | 89 | #---------------- testiing ----------------------- |
|
88 | 90 | gem 'minitest-reporters' |
|
89 | 91 | |
|
90 | 92 | #---------------- for console -------------------- |
|
91 | 93 | gem 'fuzzy-string-match' |
@@ -1,235 +1,241 | |||
|
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) |
|
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 |
|
74 | 78 | execjs |
|
75 | 79 | coffee-script-source (1.12.2) |
|
76 | 80 | concurrent-ruby (1.0.4) |
|
77 | 81 | dynamic_form (1.1.4) |
|
78 | 82 | erubis (2.7.0) |
|
79 | 83 | execjs (2.7.0) |
|
80 | 84 | fuzzy-string-match (1.0.0) |
|
81 | 85 | RubyInline (>= 3.8.6) |
|
82 | 86 | globalid (0.3.7) |
|
83 | 87 | activesupport (>= 4.1.0) |
|
84 | 88 | haml (4.0.7) |
|
85 | 89 | tilt |
|
86 | 90 | haml-rails (0.9.0) |
|
87 | 91 | actionpack (>= 4.0.1) |
|
88 | 92 | activesupport (>= 4.0.1) |
|
89 | 93 | haml (>= 4.0.6, < 5.0) |
|
90 | 94 | html2haml (>= 1.0.1) |
|
91 | 95 | railties (>= 4.0.1) |
|
92 | 96 | html2haml (2.0.0) |
|
93 | 97 | erubis (~> 2.7.0) |
|
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) |
|
100 | 104 | jquery-rails (4.2.1) |
|
101 | 105 | rails-dom-testing (>= 1, < 3) |
|
102 | 106 | railties (>= 4.2.0) |
|
103 | 107 | thor (>= 0.14, < 2.0) |
|
104 | 108 | jquery-tablesorter (1.23.3) |
|
105 | 109 | railties (>= 3.2, < 6) |
|
106 | 110 | jquery-timepicker-addon-rails (1.4.1) |
|
107 | 111 | railties (>= 3.1) |
|
108 | 112 | jquery-ui-rails (6.0.1) |
|
109 | 113 | railties (>= 3.2.16) |
|
110 | 114 | json (1.8.3) |
|
111 | 115 | loofah (2.0.3) |
|
112 | 116 | nokogiri (>= 1.5.9) |
|
113 | 117 | mail (2.6.4) |
|
114 | 118 | mime-types (>= 1.16, < 4) |
|
115 | 119 | mime-types (3.1) |
|
116 | 120 | mime-types-data (~> 3.2015) |
|
117 | 121 | mime-types-data (3.2016.0521) |
|
118 | 122 | mini_portile2 (2.1.0) |
|
119 | 123 | minitest (5.10.1) |
|
120 | 124 | minitest-reporters (1.1.13) |
|
121 | 125 | ansi |
|
122 | 126 | builder |
|
123 | 127 | minitest (>= 5.0) |
|
124 | 128 | ruby-progressbar |
|
125 | 129 | momentjs-rails (2.15.1) |
|
126 | 130 | railties (>= 3.1) |
|
127 | 131 | multi_json (1.12.1) |
|
128 | 132 | mysql2 (0.4.5) |
|
129 | 133 | nokogiri (1.6.8.1) |
|
130 | 134 | mini_portile2 (~> 2.1.0) |
|
131 | 135 | rack (1.6.5) |
|
132 | 136 | rack-test (0.6.3) |
|
133 | 137 | rack (>= 1.0) |
|
134 | 138 | rails (4.2.7.1) |
|
135 | 139 | actionmailer (= 4.2.7.1) |
|
136 | 140 | actionpack (= 4.2.7.1) |
|
137 | 141 | actionview (= 4.2.7.1) |
|
138 | 142 | activejob (= 4.2.7.1) |
|
139 | 143 | activemodel (= 4.2.7.1) |
|
140 | 144 | activerecord (= 4.2.7.1) |
|
141 | 145 | activesupport (= 4.2.7.1) |
|
142 | 146 | bundler (>= 1.3.0, < 2.0) |
|
143 | 147 | railties (= 4.2.7.1) |
|
144 | 148 | sprockets-rails |
|
145 | 149 | rails-deprecated_sanitizer (1.0.3) |
|
146 | 150 | activesupport (>= 4.2.0.alpha) |
|
147 | 151 | rails-dom-testing (1.0.8) |
|
148 | 152 | activesupport (>= 4.2.0.beta, < 5.0) |
|
149 | 153 | nokogiri (~> 1.6) |
|
150 | 154 | rails-deprecated_sanitizer (>= 1.0.1) |
|
151 | 155 | rails-html-sanitizer (1.0.3) |
|
152 | 156 | loofah (~> 2.0) |
|
153 | 157 | rails_bootstrap_sortable (2.0.1) |
|
154 | 158 | momentjs-rails (>= 2.8.3) |
|
155 | 159 | railties (4.2.7.1) |
|
156 | 160 | actionpack (= 4.2.7.1) |
|
157 | 161 | activesupport (= 4.2.7.1) |
|
158 | 162 | rake (>= 0.8.7) |
|
159 | 163 | thor (>= 0.18.1, < 2.0) |
|
160 | 164 | rake (12.0.0) |
|
161 | 165 | rdiscount (2.2.0.1) |
|
162 | 166 | rouge (2.0.7) |
|
163 | 167 | ruby-progressbar (1.8.1) |
|
164 | 168 | ruby_parser (3.8.3) |
|
165 | 169 | sexp_processor (~> 4.1) |
|
166 | 170 | sass (3.4.23) |
|
167 | 171 | sass-rails (5.0.6) |
|
168 | 172 | railties (>= 4.0.0, < 6) |
|
169 | 173 | sass (~> 3.1) |
|
170 | 174 | sprockets (>= 2.8, < 4.0) |
|
171 | 175 | sprockets-rails (>= 2.0, < 4.0) |
|
172 | 176 | tilt (>= 1.1, < 3) |
|
173 | 177 | select2-rails (4.0.3) |
|
174 | 178 | thor (~> 0.14) |
|
175 | 179 | sexp_processor (4.7.0) |
|
176 | 180 | sprockets (3.7.1) |
|
177 | 181 | concurrent-ruby (~> 1.0) |
|
178 | 182 | rack (> 1, < 3) |
|
179 | 183 | sprockets-rails (3.2.0) |
|
180 | 184 | actionpack (>= 4.0) |
|
181 | 185 | activesupport (>= 4.0) |
|
182 | 186 | sprockets (>= 3.0.0) |
|
183 | 187 | sqlite3 (1.3.12) |
|
184 | 188 | thor (0.19.4) |
|
185 | 189 | thread_safe (0.3.5) |
|
186 | 190 | tilt (2.0.5) |
|
187 | 191 | tzinfo (1.2.2) |
|
188 | 192 | thread_safe (~> 0.1) |
|
189 | 193 | uglifier (3.0.4) |
|
190 | 194 | execjs (>= 0.3.0, < 3) |
|
191 | 195 | will_paginate (3.0.12) |
|
192 | 196 | yaml_db (0.4.2) |
|
193 | 197 | rails (>= 3.0, < 5.1) |
|
194 | 198 | rake (>= 0.8.7) |
|
195 | 199 | |
|
196 | 200 | PLATFORMS |
|
197 | 201 | ruby |
|
198 | 202 | |
|
199 | 203 | DEPENDENCIES |
|
200 | 204 | ace-rails-ap |
|
201 | 205 | activerecord-session_store |
|
202 | 206 | autoprefixer-rails |
|
203 | 207 | best_in_place (~> 3.0.1) |
|
208 | + bootstrap-datepicker-rails | |
|
204 | 209 | bootstrap-sass (~> 3.2.0) |
|
205 | 210 | bootstrap-switch-rails |
|
206 | 211 | bootstrap-toggle-rails |
|
212 | + bootstrap3-datetimepicker-rails | |
|
207 | 213 | coffee-rails |
|
208 | 214 | dynamic_form |
|
209 | 215 | fuzzy-string-match |
|
210 | 216 | haml |
|
211 | 217 | haml-rails |
|
212 | 218 | in_place_editing |
|
213 | 219 | jquery-countdown-rails |
|
214 | 220 | jquery-rails |
|
215 | 221 | jquery-tablesorter |
|
216 | 222 | jquery-timepicker-addon-rails |
|
217 | 223 | jquery-ui-rails |
|
218 | 224 | |
|
219 | 225 | minitest-reporters |
|
220 | 226 | momentjs-rails |
|
221 | 227 | mysql2 |
|
222 | 228 | rails (~> 4.2.0) |
|
223 | 229 | rails_bootstrap_sortable |
|
224 | 230 | rdiscount |
|
225 | 231 | rouge |
|
226 | 232 | sass-rails |
|
227 | 233 | select2-rails |
|
228 | 234 | sqlite3 |
|
229 | 235 | uglifier |
|
230 | 236 | verification! |
|
231 | 237 | will_paginate (~> 3.0.7) |
|
232 | 238 | yaml_db |
|
233 | 239 | |
|
234 | 240 | BUNDLED WITH |
|
235 | 241 | 1.13.6 |
@@ -1,41 +1,43 | |||
|
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 |
|
16 | 16 | //= require bootstrap-sprockets |
|
17 | 17 | //= require moment |
|
18 | 18 | //= require bootstrap-sortable |
|
19 | 19 | //= require select2 |
|
20 | 20 | //= require ace-rails-ap |
|
21 | 21 | //= require ace/mode-c_cpp |
|
22 | 22 | //= require ace/mode-python |
|
23 | 23 | //= require ace/mode-ruby |
|
24 | 24 | //= require ace/mode-pascal |
|
25 | 25 | //= require ace/mode-javascript |
|
26 | 26 | //= require ace/mode-java |
|
27 | 27 | //= require ace/theme-merbivore |
|
28 | 28 | //= require custom |
|
29 | 29 | //= require jquery.countdown |
|
30 | 30 | //-------------- addition from local_jquery ----------- |
|
31 | 31 | //= require jquery-tablesorter |
|
32 | 32 | //= require best_in_place |
|
33 | 33 | //= require best_in_place.jquery-ui |
|
34 | 34 | //= require brython |
|
35 | + //= require bootstrap-datepicker | |
|
36 | + //= require bootstrap-datetimepicker | |
|
35 | 37 | |
|
36 | 38 | // since this is after blank line, it is not downloaded |
|
37 | 39 | //x= require prototype |
|
38 | 40 | //x= require prototype_ujs |
|
39 | 41 | //x= require effects |
|
40 | 42 | //x= require dragdrop |
|
41 | 43 | //x= require controls |
@@ -1,554 +1,556 | |||
|
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"; | |
|
37 | + @import "bootstrap-datetimepicker"; | |
|
36 | 38 | |
|
37 | 39 | //bootstrap navbar color (from) |
|
38 | 40 | $bgDefault: #19197b; |
|
39 | 41 | $bgHighlight: #06064b; |
|
40 | 42 | $colDefault: #8e8eb4; |
|
41 | 43 | $colHighlight: #ffffff; |
|
42 | 44 | $dropDown: false; |
|
43 | 45 | |
|
44 | 46 | @font-face { |
|
45 | 47 | font-family: 'Glyphicons Halflings'; |
|
46 | 48 | src: font-path('bootstrap/glyphicons-halflings-regular.eot'); |
|
47 | 49 | src: font-path('bootstrap/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), |
|
48 | 50 | font-path('bootstrap/glyphicons-halflings-regular.woff') format('woff'), |
|
49 | 51 | font-path('bootstrap/glyphicons-halflings-regular.ttf') format('truetype'), |
|
50 | 52 | font-path('bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg'); |
|
51 | 53 | } |
|
52 | 54 | |
|
53 | 55 | |
|
54 | 56 | .navbar-default { |
|
55 | 57 | background-color: $bgDefault; |
|
56 | 58 | border-color: $bgHighlight; |
|
57 | 59 | |
|
58 | 60 | .navbar-brand { |
|
59 | 61 | color: $colDefault; |
|
60 | 62 | |
|
61 | 63 | &:hover, &:focus { |
|
62 | 64 | color: $colHighlight; |
|
63 | 65 | } |
|
64 | 66 | } |
|
65 | 67 | |
|
66 | 68 | .navbar-text { |
|
67 | 69 | color: $colDefault; |
|
68 | 70 | } |
|
69 | 71 | |
|
70 | 72 | .navbar-nav { |
|
71 | 73 | > li { |
|
72 | 74 | > a { |
|
73 | 75 | color: $colDefault; |
|
74 | 76 | |
|
75 | 77 | &:hover, &:focus { |
|
76 | 78 | color: $colHighlight; |
|
77 | 79 | } |
|
78 | 80 | } |
|
79 | 81 | |
|
80 | 82 | @if $dropDown { |
|
81 | 83 | > .dropdown-menu { |
|
82 | 84 | background-color: $bgDefault; |
|
83 | 85 | |
|
84 | 86 | > li { |
|
85 | 87 | > a { |
|
86 | 88 | color: $colDefault; |
|
87 | 89 | |
|
88 | 90 | &:hover, &:focus { |
|
89 | 91 | color: $colHighlight; |
|
90 | 92 | background-color: $bgHighlight; |
|
91 | 93 | } |
|
92 | 94 | } |
|
93 | 95 | |
|
94 | 96 | > .divider { |
|
95 | 97 | background-color: $bgHighlight; |
|
96 | 98 | } |
|
97 | 99 | } |
|
98 | 100 | } |
|
99 | 101 | } |
|
100 | 102 | } |
|
101 | 103 | |
|
102 | 104 | @if $dropDown { |
|
103 | 105 | .open .dropdown-menu > .active { |
|
104 | 106 | > a, > a:hover, > a:focus { |
|
105 | 107 | color: $colHighlight; |
|
106 | 108 | background-color: $bgHighlight; |
|
107 | 109 | } |
|
108 | 110 | } |
|
109 | 111 | } |
|
110 | 112 | |
|
111 | 113 | > .active { |
|
112 | 114 | > a, > a:hover, > a:focus { |
|
113 | 115 | color: $colHighlight; |
|
114 | 116 | background-color: $bgHighlight; |
|
115 | 117 | } |
|
116 | 118 | } |
|
117 | 119 | |
|
118 | 120 | > .open { |
|
119 | 121 | > a, > a:hover, > a:focus { |
|
120 | 122 | color: $colHighlight; |
|
121 | 123 | background-color: $bgHighlight; |
|
122 | 124 | } |
|
123 | 125 | } |
|
124 | 126 | } |
|
125 | 127 | |
|
126 | 128 | .navbar-toggle { |
|
127 | 129 | border-color: $bgHighlight; |
|
128 | 130 | |
|
129 | 131 | &:hover, &:focus { |
|
130 | 132 | background-color: $bgHighlight; |
|
131 | 133 | } |
|
132 | 134 | |
|
133 | 135 | .icon-bar { |
|
134 | 136 | background-color: $colDefault; |
|
135 | 137 | } |
|
136 | 138 | } |
|
137 | 139 | |
|
138 | 140 | .navbar-collapse, |
|
139 | 141 | .navbar-form { |
|
140 | 142 | border-color: $colDefault; |
|
141 | 143 | } |
|
142 | 144 | |
|
143 | 145 | .navbar-link { |
|
144 | 146 | color: $colDefault; |
|
145 | 147 | |
|
146 | 148 | &:hover { |
|
147 | 149 | color: $colHighlight; |
|
148 | 150 | } |
|
149 | 151 | } |
|
150 | 152 | } |
|
151 | 153 | |
|
152 | 154 | @media (max-width: 767px) { |
|
153 | 155 | .navbar-default .navbar-nav .open .dropdown-menu { |
|
154 | 156 | > li > a { |
|
155 | 157 | color: $colDefault; |
|
156 | 158 | |
|
157 | 159 | &:hover, &:focus { |
|
158 | 160 | color: $colHighlight; |
|
159 | 161 | } |
|
160 | 162 | } |
|
161 | 163 | |
|
162 | 164 | > .active { |
|
163 | 165 | > a, > a:hover, > a:focus { |
|
164 | 166 | color: $colHighlight; |
|
165 | 167 | background-color: $bgHighlight; |
|
166 | 168 | } |
|
167 | 169 | } |
|
168 | 170 | } |
|
169 | 171 | } |
|
170 | 172 | |
|
171 | 173 | .secondnavbar { |
|
172 | 174 | top: 50px; |
|
173 | 175 | } |
|
174 | 176 | |
|
175 | 177 | // --------------- bootstrap file upload ---------------------- |
|
176 | 178 | .btn-file { |
|
177 | 179 | position: relative; |
|
178 | 180 | overflow: hidden; |
|
179 | 181 | } |
|
180 | 182 | |
|
181 | 183 | .btn-file input[type=file] { |
|
182 | 184 | position: absolute; |
|
183 | 185 | top: 0; |
|
184 | 186 | right: 0; |
|
185 | 187 | min-width: 100%; |
|
186 | 188 | min-height: 100%; |
|
187 | 189 | font-size: 100px; |
|
188 | 190 | text-align: right; |
|
189 | 191 | filter: alpha(opacity = 0); |
|
190 | 192 | opacity: 0; |
|
191 | 193 | outline: none; |
|
192 | 194 | background: white; |
|
193 | 195 | cursor: inherit; |
|
194 | 196 | display: block; |
|
195 | 197 | } |
|
196 | 198 | |
|
197 | 199 | body { |
|
198 | 200 | background: white image-url("topbg.jpg") repeat-x top center; |
|
199 | 201 | |
|
200 | 202 | //font-size: 13px |
|
201 | 203 | //font-family: Tahoma, "sans-serif" |
|
202 | 204 | margin: 10px; |
|
203 | 205 | padding: 10px; |
|
204 | 206 | padding-top: 60px; |
|
205 | 207 | } |
|
206 | 208 | |
|
207 | 209 | // ------------------ bootstrap sortable -------------------- |
|
208 | 210 | table.sortable th { |
|
209 | 211 | padding-right: 20px !important; |
|
210 | 212 | |
|
211 | 213 | span.sign { |
|
212 | 214 | right: (-15px) !important; |
|
213 | 215 | } |
|
214 | 216 | |
|
215 | 217 | &.text-right { |
|
216 | 218 | padding-left: 20px !important; |
|
217 | 219 | padding-right: 8px !important; |
|
218 | 220 | |
|
219 | 221 | &:after, span.sign { |
|
220 | 222 | left: (-15px) !important; |
|
221 | 223 | } |
|
222 | 224 | } |
|
223 | 225 | } |
|
224 | 226 | |
|
225 | 227 | input { |
|
226 | 228 | font-family: Tahoma, "sans-serif"; |
|
227 | 229 | } |
|
228 | 230 | |
|
229 | 231 | h1 { |
|
230 | 232 | font-size: 24px; |
|
231 | 233 | color: #334488; |
|
232 | 234 | line-height: 2em; |
|
233 | 235 | } |
|
234 | 236 | |
|
235 | 237 | h2 { |
|
236 | 238 | font-size: 18px; |
|
237 | 239 | color: #5566bb; |
|
238 | 240 | line-height: 1.5em; |
|
239 | 241 | } |
|
240 | 242 | |
|
241 | 243 | hr { |
|
242 | 244 | border-top: 1px solid #dddddd; |
|
243 | 245 | border-bottom: 1px solid #eeeeee; |
|
244 | 246 | } |
|
245 | 247 | |
|
246 | 248 | //#a |
|
247 | 249 | // color: #6666cc |
|
248 | 250 | // text-decoration: none |
|
249 | 251 | // |
|
250 | 252 | // &:link, &:visited |
|
251 | 253 | // color: #6666cc |
|
252 | 254 | // text-decoration: none |
|
253 | 255 | // |
|
254 | 256 | // &:hover, &:focus |
|
255 | 257 | // color: #111166 |
|
256 | 258 | // text-decoration: none |
|
257 | 259 | |
|
258 | 260 | div { |
|
259 | 261 | &.userbar { |
|
260 | 262 | line-height: 1.5em; |
|
261 | 263 | text-align: right; |
|
262 | 264 | font-size: 12px; |
|
263 | 265 | } |
|
264 | 266 | |
|
265 | 267 | &.title { |
|
266 | 268 | padding: 10px 0px; |
|
267 | 269 | line-height: 1.5em; |
|
268 | 270 | font-size: 13px; |
|
269 | 271 | |
|
270 | 272 | span.contest-over-msg { |
|
271 | 273 | font-size: 15px; |
|
272 | 274 | color: red; |
|
273 | 275 | } |
|
274 | 276 | |
|
275 | 277 | table { |
|
276 | 278 | width: 100%; |
|
277 | 279 | font-weight: bold; |
|
278 | 280 | } |
|
279 | 281 | |
|
280 | 282 | td { |
|
281 | 283 | &.left-col { |
|
282 | 284 | text-align: left; |
|
283 | 285 | vertical-align: top; |
|
284 | 286 | color: #444444; |
|
285 | 287 | } |
|
286 | 288 | |
|
287 | 289 | &.right-col { |
|
288 | 290 | text-align: right; |
|
289 | 291 | vertical-align: top; |
|
290 | 292 | font-size: 18px; |
|
291 | 293 | color: #116699; |
|
292 | 294 | } |
|
293 | 295 | } |
|
294 | 296 | } |
|
295 | 297 | } |
|
296 | 298 | |
|
297 | 299 | table.info { |
|
298 | 300 | margin: 10px 0; |
|
299 | 301 | border: 1px solid #666666; |
|
300 | 302 | border-collapse: collapse; |
|
301 | 303 | font-size: 12px; |
|
302 | 304 | |
|
303 | 305 | th { |
|
304 | 306 | border: 1px solid #666666; |
|
305 | 307 | line-height: 1.5em; |
|
306 | 308 | padding: 0 0.5em; |
|
307 | 309 | } |
|
308 | 310 | |
|
309 | 311 | td { |
|
310 | 312 | border-left: 1px solid #666666; |
|
311 | 313 | border-right: 1px solid #666666; |
|
312 | 314 | line-height: 1.5em; |
|
313 | 315 | padding: 0 0.5em; |
|
314 | 316 | } |
|
315 | 317 | } |
|
316 | 318 | |
|
317 | 319 | tr { |
|
318 | 320 | &.info-head { |
|
319 | 321 | background: #777777; |
|
320 | 322 | color: white; |
|
321 | 323 | } |
|
322 | 324 | |
|
323 | 325 | &.info-odd { |
|
324 | 326 | background: #eeeeee; |
|
325 | 327 | } |
|
326 | 328 | |
|
327 | 329 | &.info-even { |
|
328 | 330 | background: #fcfcfc; |
|
329 | 331 | } |
|
330 | 332 | } |
|
331 | 333 | |
|
332 | 334 | @mixin basicbox { |
|
333 | 335 | background: #eeeeff; |
|
334 | 336 | border: 1px dotted #99aaee; |
|
335 | 337 | padding: 5px; |
|
336 | 338 | margin: 10px 0px; |
|
337 | 339 | color: black; |
|
338 | 340 | font-size: 13px; |
|
339 | 341 | } |
|
340 | 342 | |
|
341 | 343 | .infobox { |
|
342 | 344 | @include basicbox; |
|
343 | 345 | } |
|
344 | 346 | |
|
345 | 347 | .submitbox { |
|
346 | 348 | @include basicbox; |
|
347 | 349 | } |
|
348 | 350 | |
|
349 | 351 | .errorExplanation { |
|
350 | 352 | border: 1px dotted gray; |
|
351 | 353 | color: #bb2222; |
|
352 | 354 | padding: 5px 15px 5px 15px; |
|
353 | 355 | margin-bottom: 5px; |
|
354 | 356 | background-color: white; |
|
355 | 357 | font-weight: normal; |
|
356 | 358 | |
|
357 | 359 | h2 { |
|
358 | 360 | color: #cc1111; |
|
359 | 361 | font-weight: bold; |
|
360 | 362 | } |
|
361 | 363 | } |
|
362 | 364 | |
|
363 | 365 | table.uinfo { |
|
364 | 366 | border-collapse: collapse; |
|
365 | 367 | border: 1px solid black; |
|
366 | 368 | font-size: 13px; |
|
367 | 369 | } |
|
368 | 370 | |
|
369 | 371 | td.uinfo { |
|
370 | 372 | vertical-align: top; |
|
371 | 373 | border: 1px solid black; |
|
372 | 374 | padding: 5px; |
|
373 | 375 | } |
|
374 | 376 | |
|
375 | 377 | th.uinfo { |
|
376 | 378 | background: lightgreen; |
|
377 | 379 | vertical-align: top; |
|
378 | 380 | text-align: right; |
|
379 | 381 | border: 1px solid black; |
|
380 | 382 | padding: 5px; |
|
381 | 383 | } |
|
382 | 384 | |
|
383 | 385 | div { |
|
384 | 386 | &.compilermsgbody { |
|
385 | 387 | font-family: monospace; |
|
386 | 388 | } |
|
387 | 389 | |
|
388 | 390 | &.task-menu { |
|
389 | 391 | text-align: center; |
|
390 | 392 | font-size: 13px; |
|
391 | 393 | line-height: 1.75em; |
|
392 | 394 | font-weight: bold; |
|
393 | 395 | border-top: 1px dashed gray; |
|
394 | 396 | border-bottom: 1px dashed gray; |
|
395 | 397 | margin-top: 2px; |
|
396 | 398 | margin-bottom: 4px; |
|
397 | 399 | } |
|
398 | 400 | } |
|
399 | 401 | |
|
400 | 402 | table.taskdesc { |
|
401 | 403 | border: 2px solid #dddddd; |
|
402 | 404 | border-collapse: collapse; |
|
403 | 405 | margin: 10px auto; |
|
404 | 406 | width: 90%; |
|
405 | 407 | font-size: 13px; |
|
406 | 408 | |
|
407 | 409 | p { |
|
408 | 410 | font-size: 13px; |
|
409 | 411 | } |
|
410 | 412 | |
|
411 | 413 | tr.name { |
|
412 | 414 | border: 2px solid #dddddd; |
|
413 | 415 | background: #dddddd; |
|
414 | 416 | color: #333333; |
|
415 | 417 | font-weight: bold; |
|
416 | 418 | font-size: 14px; |
|
417 | 419 | line-height: 1.5em; |
|
418 | 420 | text-align: center; |
|
419 | 421 | } |
|
420 | 422 | |
|
421 | 423 | td { |
|
422 | 424 | &.desc-odd { |
|
423 | 425 | padding: 5px; |
|
424 | 426 | padding-left: 20px; |
|
425 | 427 | background: #fefeee; |
|
426 | 428 | } |
|
427 | 429 | |
|
428 | 430 | &.desc-even { |
|
429 | 431 | padding: 5px; |
|
430 | 432 | padding-left: 20px; |
|
431 | 433 | background: #feeefe; |
|
432 | 434 | } |
|
433 | 435 | } |
|
434 | 436 | } |
|
435 | 437 | |
|
436 | 438 | .announcementbox { |
|
437 | 439 | margin: 10px 0px; |
|
438 | 440 | background: #bbddee; |
|
439 | 441 | padding: 1px; |
|
440 | 442 | |
|
441 | 443 | span.title { |
|
442 | 444 | font-weight: bold; |
|
443 | 445 | color: #224455; |
|
444 | 446 | padding-left: 10px; |
|
445 | 447 | line-height: 1.6em; |
|
446 | 448 | } |
|
447 | 449 | } |
|
448 | 450 | |
|
449 | 451 | .announcement { |
|
450 | 452 | margin: 2px; |
|
451 | 453 | background: white; |
|
452 | 454 | padding: 1px; |
|
453 | 455 | padding-left: 10px; |
|
454 | 456 | padding-right: 10px; |
|
455 | 457 | padding-top: 5px; |
|
456 | 458 | padding-bottom: 5px; |
|
457 | 459 | } |
|
458 | 460 | |
|
459 | 461 | .announcement p { |
|
460 | 462 | font-size: 12px; |
|
461 | 463 | margin: 2px; |
|
462 | 464 | } |
|
463 | 465 | |
|
464 | 466 | .pub-info { |
|
465 | 467 | text-align: right; |
|
466 | 468 | font-style: italic; |
|
467 | 469 | font-size: 9px; |
|
468 | 470 | |
|
469 | 471 | p { |
|
470 | 472 | text-align: right; |
|
471 | 473 | font-style: italic; |
|
472 | 474 | font-size: 9px; |
|
473 | 475 | } |
|
474 | 476 | } |
|
475 | 477 | |
|
476 | 478 | .announcement { |
|
477 | 479 | .toggles { |
|
478 | 480 | font-weight: normal; |
|
479 | 481 | float: right; |
|
480 | 482 | font-size: 80%; |
|
481 | 483 | } |
|
482 | 484 | |
|
483 | 485 | .announcement-title { |
|
484 | 486 | font-weight: bold; |
|
485 | 487 | } |
|
486 | 488 | } |
|
487 | 489 | |
|
488 | 490 | div { |
|
489 | 491 | &.message { |
|
490 | 492 | margin: 10px 0 0; |
|
491 | 493 | |
|
492 | 494 | div { |
|
493 | 495 | &.message { |
|
494 | 496 | margin: 0 0 0 30px; |
|
495 | 497 | } |
|
496 | 498 | |
|
497 | 499 | &.body { |
|
498 | 500 | border: 2px solid #dddddd; |
|
499 | 501 | background: #fff8f8; |
|
500 | 502 | padding-left: 5px; |
|
501 | 503 | } |
|
502 | 504 | |
|
503 | 505 | &.reply-body { |
|
504 | 506 | border: 2px solid #bbbbbb; |
|
505 | 507 | background: #fffff8; |
|
506 | 508 | padding-left: 5px; |
|
507 | 509 | } |
|
508 | 510 | |
|
509 | 511 | &.stat { |
|
510 | 512 | font-size: 10px; |
|
511 | 513 | line-height: 1.75em; |
|
512 | 514 | padding: 0 5px; |
|
513 | 515 | color: #333333; |
|
514 | 516 | background: #dddddd; |
|
515 | 517 | font-weight: bold; |
|
516 | 518 | } |
|
517 | 519 | |
|
518 | 520 | &.message div.stat { |
|
519 | 521 | font-size: 10px; |
|
520 | 522 | line-height: 1.75em; |
|
521 | 523 | padding: 0 5px; |
|
522 | 524 | color: #444444; |
|
523 | 525 | background: #bbbbbb; |
|
524 | 526 | font-weight: bold; |
|
525 | 527 | } |
|
526 | 528 | } |
|
527 | 529 | } |
|
528 | 530 | |
|
529 | 531 | &.contest-title { |
|
530 | 532 | color: white; |
|
531 | 533 | text-align: center; |
|
532 | 534 | line-height: 2em; |
|
533 | 535 | } |
|
534 | 536 | |
|
535 | 537 | &.registration-desc, &.test-desc { |
|
536 | 538 | border: 1px dotted gray; |
|
537 | 539 | background: #f5f5f5; |
|
538 | 540 | padding: 5px; |
|
539 | 541 | margin: 10px 0; |
|
540 | 542 | font-size: 12px; |
|
541 | 543 | line-height: 1.5em; |
|
542 | 544 | } |
|
543 | 545 | } |
|
544 | 546 | |
|
545 | 547 | h2.contest-title { |
|
546 | 548 | margin-top: 5px; |
|
547 | 549 | margin-bottom: 5px; |
|
548 | 550 | } |
|
549 | 551 | |
|
550 | 552 | |
|
551 | 553 | |
|
552 | 554 | .grader-comment { |
|
553 | 555 | word-wrap: break-word; |
|
554 | 556 | } |
@@ -1,309 +1,306 | |||
|
1 | 1 | class ProblemsController < ApplicationController |
|
2 | 2 | |
|
3 | 3 | before_action :authenticate, :authorization |
|
4 | 4 | before_action :testcase_authorization, only: [:show_testcase] |
|
5 | 5 | |
|
6 | 6 | in_place_edit_for :problem, :name |
|
7 | 7 | in_place_edit_for :problem, :full_name |
|
8 | 8 | in_place_edit_for :problem, :full_score |
|
9 | 9 | |
|
10 | 10 | def index |
|
11 | 11 | @problems = Problem.order(date_added: :desc) |
|
12 | 12 | end |
|
13 | 13 | |
|
14 | 14 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
15 | 15 | verify :method => :post, :only => [ :create, :quick_create, |
|
16 | 16 | :do_manage, |
|
17 | 17 | :do_import, |
|
18 | 18 | ], |
|
19 | 19 | :redirect_to => { :action => :index } |
|
20 | 20 | |
|
21 | 21 | def show |
|
22 | 22 | @problem = Problem.find(params[:id]) |
|
23 | 23 | end |
|
24 | 24 | |
|
25 | 25 | def new |
|
26 | 26 | @problem = Problem.new |
|
27 | 27 | @description = nil |
|
28 | 28 | end |
|
29 | 29 | |
|
30 | 30 | def create |
|
31 | 31 | @problem = Problem.new(problem_params) |
|
32 | 32 | @description = Description.new(params[:description]) |
|
33 | 33 | if @description.body!='' |
|
34 | 34 | if !@description.save |
|
35 | 35 | render :action => new and return |
|
36 | 36 | end |
|
37 | 37 | else |
|
38 | 38 | @description = nil |
|
39 | 39 | end |
|
40 | 40 | @problem.description = @description |
|
41 | 41 | if @problem.save |
|
42 | 42 | flash[:notice] = 'Problem was successfully created.' |
|
43 | 43 | redirect_to action: :index |
|
44 | 44 | else |
|
45 | 45 | render :action => 'new' |
|
46 | 46 | end |
|
47 | 47 | end |
|
48 | 48 | |
|
49 | 49 | def quick_create |
|
50 | 50 | @problem = Problem.new(problem_params) |
|
51 | 51 | @problem.full_name = @problem.name if @problem.full_name == '' |
|
52 | 52 | @problem.full_score = 100 |
|
53 | 53 | @problem.available = false |
|
54 | 54 | @problem.test_allowed = true |
|
55 | 55 | @problem.output_only = false |
|
56 | 56 | @problem.date_added = Time.new |
|
57 | 57 | if @problem.save |
|
58 | 58 | flash[:notice] = 'Problem was successfully created.' |
|
59 | 59 | redirect_to action: :index |
|
60 | 60 | else |
|
61 | 61 | flash[:notice] = 'Error saving problem' |
|
62 | 62 | redirect_to action: :index |
|
63 | 63 | end |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | def edit |
|
67 | 67 | @problem = Problem.find(params[:id]) |
|
68 | 68 | @description = @problem.description |
|
69 | 69 | end |
|
70 | 70 | |
|
71 | 71 | def update |
|
72 | 72 | @problem = Problem.find(params[:id]) |
|
73 | 73 | @description = @problem.description |
|
74 | 74 | if @description.nil? and params[:description][:body]!='' |
|
75 | 75 | @description = Description.new(params[:description]) |
|
76 | 76 | if !@description.save |
|
77 | 77 | flash[:notice] = 'Error saving description' |
|
78 | 78 | render :action => 'edit' and return |
|
79 | 79 | end |
|
80 | 80 | @problem.description = @description |
|
81 | 81 | elsif @description |
|
82 | 82 | if !@description.update_attributes(params[:description]) |
|
83 | 83 | flash[:notice] = 'Error saving description' |
|
84 | 84 | render :action => 'edit' and return |
|
85 | 85 | end |
|
86 | 86 | end |
|
87 | 87 | if params[:file] and params[:file].content_type != 'application/pdf' |
|
88 | 88 | flash[:notice] = 'Error: Uploaded file is not PDF' |
|
89 | 89 | render :action => 'edit' and return |
|
90 | 90 | end |
|
91 | 91 | if @problem.update_attributes(problem_params) |
|
92 | 92 | flash[:notice] = 'Problem was successfully updated.' |
|
93 | 93 | unless params[:file] == nil or params[:file] == '' |
|
94 | 94 | flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.' |
|
95 | 95 | out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}" |
|
96 | 96 | if not FileTest.exists? out_dirname |
|
97 | 97 | Dir.mkdir out_dirname |
|
98 | 98 | end |
|
99 | 99 | |
|
100 | 100 | out_filename = "#{out_dirname}/#{@problem.name}.pdf" |
|
101 | 101 | if FileTest.exists? out_filename |
|
102 | 102 | File.delete out_filename |
|
103 | 103 | end |
|
104 | 104 | |
|
105 | 105 | File.open(out_filename,"wb") do |file| |
|
106 | 106 | file.write(params[:file].read) |
|
107 | 107 | end |
|
108 | 108 | @problem.description_filename = "#{@problem.name}.pdf" |
|
109 | 109 | @problem.save |
|
110 | 110 | end |
|
111 | 111 | redirect_to :action => 'show', :id => @problem |
|
112 | 112 | else |
|
113 | 113 | render :action => 'edit' |
|
114 | 114 | end |
|
115 | 115 | end |
|
116 | 116 | |
|
117 | 117 | def destroy |
|
118 | 118 | p = Problem.find(params[:id]).destroy |
|
119 | 119 | redirect_to action: :index |
|
120 | 120 | end |
|
121 | 121 | |
|
122 | 122 | def toggle |
|
123 | 123 | @problem = Problem.find(params[:id]) |
|
124 | 124 | @problem.update_attributes(available: !(@problem.available) ) |
|
125 | 125 | respond_to do |format| |
|
126 | 126 | format.js { } |
|
127 | 127 | end |
|
128 | 128 | end |
|
129 | 129 | |
|
130 | 130 | def toggle_test |
|
131 | 131 | @problem = Problem.find(params[:id]) |
|
132 | 132 | @problem.update_attributes(test_allowed: !(@problem.test_allowed?) ) |
|
133 | 133 | respond_to do |format| |
|
134 | 134 | format.js { } |
|
135 | 135 | end |
|
136 | 136 | end |
|
137 | 137 | |
|
138 | 138 | def toggle_view_testcase |
|
139 | 139 | @problem = Problem.find(params[:id]) |
|
140 | 140 | @problem.update_attributes(view_testcase: !(@problem.view_testcase?) ) |
|
141 | 141 | respond_to do |format| |
|
142 | 142 | format.js { } |
|
143 | 143 | end |
|
144 | 144 | end |
|
145 | 145 | |
|
146 | 146 | def turn_all_off |
|
147 | 147 | Problem.available.all.each do |problem| |
|
148 | 148 | problem.available = false |
|
149 | 149 | problem.save |
|
150 | 150 | end |
|
151 | 151 | redirect_to action: :index |
|
152 | 152 | end |
|
153 | 153 | |
|
154 | 154 | def turn_all_on |
|
155 | 155 | Problem.where.not(available: true).each do |problem| |
|
156 | 156 | problem.available = true |
|
157 | 157 | problem.save |
|
158 | 158 | end |
|
159 | 159 | redirect_to action: :index |
|
160 | 160 | end |
|
161 | 161 | |
|
162 | 162 | def stat |
|
163 | 163 | @problem = Problem.find(params[:id]) |
|
164 | 164 | unless @problem.available or session[:admin] |
|
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 |
- |
|
|
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 | |
|
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 | |
|
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