Description:
revert simple_form_for to form_tag
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r758:d23edd5adc06 - - 5 files changed: 11 inserted, 30 deleted
@@ -85,25 +85,24 | |||
|
85 | 85 | xpath (~> 3.2) |
|
86 | 86 | childprocess (1.0.1) |
|
87 | 87 | rake (< 13.0) |
|
88 | 88 | coffee-rails (4.2.2) |
|
89 | 89 | coffee-script (>= 2.2.0) |
|
90 | 90 | railties (>= 4.0.0) |
|
91 | 91 | coffee-script (2.4.1) |
|
92 | 92 | coffee-script-source |
|
93 | 93 | execjs |
|
94 | 94 | coffee-script-source (1.12.2) |
|
95 | 95 | concurrent-ruby (1.1.5) |
|
96 | 96 | crass (1.0.4) |
|
97 | - diff-lcs (1.3) | |
|
98 | 97 | dynamic_form (1.1.4) |
|
99 | 98 | erubi (1.8.0) |
|
100 | 99 | erubis (2.7.0) |
|
101 | 100 | execjs (2.7.0) |
|
102 | 101 | ffi (1.11.1) |
|
103 | 102 | fuzzy-string-match (1.0.1) |
|
104 | 103 | RubyInline (>= 3.8.6) |
|
105 | 104 | globalid (0.4.2) |
|
106 | 105 | activesupport (>= 4.2.0) |
|
107 | 106 | haml (5.1.0) |
|
108 | 107 | temple (>= 0.8.0) |
|
109 | 108 | tilt |
@@ -202,41 +201,24 | |||
|
202 | 201 | actionpack (= 5.2.3) |
|
203 | 202 | activesupport (= 5.2.3) |
|
204 | 203 | method_source |
|
205 | 204 | rake (>= 0.8.7) |
|
206 | 205 | thor (>= 0.19.0, < 2.0) |
|
207 | 206 | rake (12.3.2) |
|
208 | 207 | rb-fsevent (0.10.3) |
|
209 | 208 | rb-inotify (0.10.0) |
|
210 | 209 | ffi (~> 1.0) |
|
211 | 210 | rdiscount (2.2.0.1) |
|
212 | 211 | regexp_parser (1.5.1) |
|
213 | 212 | rouge (3.3.0) |
|
214 | - rspec-core (3.8.2) | |
|
215 | - rspec-support (~> 3.8.0) | |
|
216 | - rspec-expectations (3.8.4) | |
|
217 | - diff-lcs (>= 1.2.0, < 2.0) | |
|
218 | - rspec-support (~> 3.8.0) | |
|
219 | - rspec-mocks (3.8.1) | |
|
220 | - diff-lcs (>= 1.2.0, < 2.0) | |
|
221 | - rspec-support (~> 3.8.0) | |
|
222 | - rspec-rails (3.8.2) | |
|
223 | - actionpack (>= 3.0) | |
|
224 | - activesupport (>= 3.0) | |
|
225 | - railties (>= 3.0) | |
|
226 | - rspec-core (~> 3.8.0) | |
|
227 | - rspec-expectations (~> 3.8.0) | |
|
228 | - rspec-mocks (~> 3.8.0) | |
|
229 | - rspec-support (~> 3.8.0) | |
|
230 | - rspec-support (3.8.2) | |
|
231 | 213 | ruby-progressbar (1.10.0) |
|
232 | 214 | ruby_dep (1.5.0) |
|
233 | 215 | ruby_parser (3.13.1) |
|
234 | 216 | sexp_processor (~> 4.9) |
|
235 | 217 | rubyzip (1.2.3) |
|
236 | 218 | sass (3.7.4) |
|
237 | 219 | sass-listen (~> 4.0.0) |
|
238 | 220 | sass-listen (4.0.0) |
|
239 | 221 | rb-fsevent (~> 0.9, >= 0.9.4) |
|
240 | 222 | rb-inotify (~> 0.9, >= 0.9.7) |
|
241 | 223 | sass-rails (5.0.7) |
|
242 | 224 | railties (>= 4.0.0, < 6) |
@@ -329,25 +311,24 | |||
|
329 | 311 | jquery-ui-rails |
|
330 | 312 | listen (>= 3.0.5, < 3.2) |
|
331 | 313 | |
|
332 | 314 | minitest-reporters |
|
333 | 315 | momentjs-rails |
|
334 | 316 | mysql2 |
|
335 | 317 | puma |
|
336 | 318 | rails (~> 5.2) |
|
337 | 319 | rails-controller-testing |
|
338 | 320 | rails_bootstrap_sortable |
|
339 | 321 | rdiscount |
|
340 | 322 | rouge |
|
341 | - rspec-rails | |
|
342 | 323 | sassc-rails |
|
343 | 324 | select2-rails |
|
344 | 325 | selenium-webdriver |
|
345 | 326 | simple_form |
|
346 | 327 | spring |
|
347 | 328 | spring-watcher-listen (~> 2.0.0) |
|
348 | 329 | sqlite3 |
|
349 | 330 | uglifier |
|
350 | 331 | web-console (>= 3.3.0) |
|
351 | 332 | webdriver |
|
352 | 333 | will_paginate (~> 3.0.7) |
|
353 | 334 | yaml_db |
@@ -22,47 +22,47 | |||
|
22 | 22 | scope :available, -> { where(available: true) } |
|
23 | 23 | |
|
24 | 24 | DEFAULT_TIME_LIMIT = 1 |
|
25 | 25 | DEFAULT_MEMORY_LIMIT = 32 |
|
26 | 26 | |
|
27 | 27 | def self.available_problems |
|
28 | 28 | available.order(date_added: :desc).order(:name) |
|
29 | 29 | #Problem.available.all(:order => "date_added DESC, name ASC") |
|
30 | 30 | end |
|
31 | 31 | |
|
32 | 32 | def self.create_from_import_form_params(params, old_problem=nil) |
|
33 | 33 | org_problem = old_problem || Problem.new |
|
34 |
- import_params, problem = Problem.extract_params_and_check(params, |
|
|
34 | + import_params, problem = Problem.extract_params_and_check(params, | |
|
35 | 35 | org_problem) |
|
36 | 36 | |
|
37 | 37 | if !problem.errors.empty? |
|
38 | 38 | return problem, 'Error importing' |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | problem.full_score = 100 |
|
42 | 42 | problem.date_added = Time.new |
|
43 | 43 | problem.test_allowed = true |
|
44 | 44 | problem.output_only = false |
|
45 | 45 | problem.available = false |
|
46 | 46 | |
|
47 | 47 | if not problem.save |
|
48 | 48 | return problem, 'Error importing' |
|
49 | 49 | end |
|
50 | 50 | |
|
51 | 51 | import_to_db = params.has_key? :import_to_db |
|
52 | 52 | |
|
53 | 53 | importer = TestdataImporter.new(problem) |
|
54 | 54 | |
|
55 |
- if not importer.import_from_file(import_params[:file], |
|
|
56 |
- import_params[:time_limit], |
|
|
55 | + if not importer.import_from_file(import_params[:file], | |
|
56 | + import_params[:time_limit], | |
|
57 | 57 | import_params[:memory_limit], |
|
58 | 58 | import_params[:checker_name], |
|
59 | 59 | import_to_db) |
|
60 | 60 | problem.errors.add(:base,'Import error.') |
|
61 | 61 | end |
|
62 | 62 | |
|
63 | 63 | return problem, importer.log_msg |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | def self.download_file_basedir |
|
67 | 67 | return "#{Rails.root}/data/tasks" |
|
68 | 68 | end |
@@ -1,23 +1,23 | |||
|
1 | 1 | - content_for :head do |
|
2 | 2 | = stylesheet_link_tag 'problems' |
|
3 | 3 | |
|
4 | 4 | %h1 Import problems |
|
5 | 5 | |
|
6 | 6 | %p= link_to '[Back to problem list]', problems_path |
|
7 | 7 | |
|
8 | 8 | - if @problem and @problem.errors |
|
9 | 9 | =error_messages_for 'problem' |
|
10 | 10 | |
|
11 |
- = |
|
|
11 | + = form_tag do_import_problems_path, :multipart => true do |f| | |
|
12 | 12 | |
|
13 | 13 | .submitbox |
|
14 | 14 | %table |
|
15 | 15 | %tr |
|
16 | 16 | %td Name: |
|
17 | 17 | %td= text_field_tag 'name' |
|
18 | 18 | %tr |
|
19 | 19 | %td Full name: |
|
20 | 20 | %td |
|
21 | 21 | = text_field_tag 'full_name' |
|
22 | 22 | %span{:class => 'help'} Leave blank to use the same value as the name above. |
|
23 | 23 | %tr |
@@ -258,23 +258,23 | |||
|
258 | 258 | |
|
259 | 259 | root.activated = true |
|
260 | 260 | root.save |
|
261 | 261 | end |
|
262 | 262 | |
|
263 | 263 | def seed_users_and_roles |
|
264 | 264 | seed_roles |
|
265 | 265 | seed_root |
|
266 | 266 | end |
|
267 | 267 | |
|
268 | 268 | def seed_more_languages |
|
269 | 269 | Language.delete_all |
|
270 | - Language.create( name: 'c', pretty_name: 'C', ext: 'c', common_ext: 'c' ) | |
|
271 | - Language.create( name: 'cpp', pretty_name: 'C++', ext: 'cpp', common_ext: 'cpp,cc' ) | |
|
272 | - Language.create( name: 'pas', pretty_name: 'Pascal', ext: 'pas', common_ext: 'pas' ) | |
|
273 | - Language.create( name: 'ruby', pretty_name: 'Ruby', ext: 'rb', common_ext: 'rb' ) | |
|
274 | - Language.create( name: 'python', pretty_name: 'Python', ext: 'py', common_ext: 'py' ) | |
|
275 | - Language.create( name: 'java', pretty_name: 'Java', ext: 'java', common_ext: 'java' ) | |
|
270 | + Language.find_or_create_by( name: 'c', pretty_name: 'C', ext: 'c', common_ext: 'c' ) | |
|
271 | + Language.find_or_create_by( name: 'cpp', pretty_name: 'C++', ext: 'cpp', common_ext: 'cpp,cc' ) | |
|
272 | + Language.find_or_create_by( name: 'pas', pretty_name: 'Pascal', ext: 'pas', common_ext: 'pas' ) | |
|
273 | + Language.find_or_create_by( name: 'ruby', pretty_name: 'Ruby', ext: 'rb', common_ext: 'rb' ) | |
|
274 | + Language.find_or_create_by( name: 'python', pretty_name: 'Python', ext: 'py', common_ext: 'py' ) | |
|
275 | + Language.find_or_create_by( name: 'java', pretty_name: 'Java', ext: 'java', common_ext: 'java' ) | |
|
276 | 276 | end |
|
277 | 277 | |
|
278 | 278 | seed_config |
|
279 | 279 | seed_users_and_roles |
|
280 | 280 | seed_more_languages |
@@ -85,25 +85,25 | |||
|
85 | 85 | return nil if files.length==0 |
|
86 | 86 | |
|
87 | 87 | File.delete(testdata_filename) |
|
88 | 88 | |
|
89 | 89 | return File.dirname(files[0]) |
|
90 | 90 | end |
|
91 | 91 | |
|
92 | 92 | def save_testdata_file(tempfile) |
|
93 | 93 | ext = TestdataImporter.long_ext(tempfile.original_filename) |
|
94 | 94 | testdata_filename = File.join(Dir.tmpdir,"#{@problem.name}#{ext}") |
|
95 | 95 | |
|
96 | 96 | return nil if tempfile=="" |
|
97 | - | |
|
97 | + | |
|
98 | 98 | if tempfile.instance_of?(Tempfile) |
|
99 | 99 | tempfile.close |
|
100 | 100 | FileUtils.move(tempfile.path,testdata_filename) |
|
101 | 101 | else |
|
102 | 102 | File.open(testdata_filename, "wb") do |f| |
|
103 | 103 | f.write(tempfile.read) |
|
104 | 104 | end |
|
105 | 105 | end |
|
106 | 106 | |
|
107 | 107 | return testdata_filename |
|
108 | 108 | end |
|
109 | 109 |
You need to be logged in to leave comments.
Login now