Description:
wip
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r869:abb95edf0526 - - 5 files changed: 30 inserted, 31 deleted
@@ -72,22 +72,22 | |||||
|
72 | if !@description.save |
|
72 | if !@description.save |
|
73 | flash[:notice] = 'Error saving description' |
|
73 | flash[:notice] = 'Error saving description' |
|
74 | render :action => 'edit' and return |
|
74 | render :action => 'edit' and return |
|
75 | end |
|
75 | end |
|
76 | @problem.description = @description |
|
76 | @problem.description = @description |
|
77 | elsif @description |
|
77 | elsif @description |
|
78 |
- if !@description.update |
|
78 | + if !@description.update(description_params) |
|
79 | flash[:notice] = 'Error saving description' |
|
79 | flash[:notice] = 'Error saving description' |
|
80 | render :action => 'edit' and return |
|
80 | render :action => 'edit' and return |
|
81 | end |
|
81 | end |
|
82 | end |
|
82 | end |
|
83 | if params[:file] and params[:file].content_type != 'application/pdf' |
|
83 | if params[:file] and params[:file].content_type != 'application/pdf' |
|
84 | flash[:notice] = 'Error: Uploaded file is not PDF' |
|
84 | flash[:notice] = 'Error: Uploaded file is not PDF' |
|
85 | render :action => 'edit' and return |
|
85 | render :action => 'edit' and return |
|
86 | end |
|
86 | end |
|
87 |
- if @problem.update |
|
87 | + if @problem.update(problem_params) |
|
88 | flash[:notice] = 'Problem was successfully updated.' |
|
88 | flash[:notice] = 'Problem was successfully updated.' |
|
89 | unless params[:file] == nil or params[:file] == '' |
|
89 | unless params[:file] == nil or params[:file] == '' |
|
90 | flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.' |
|
90 | flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.' |
|
91 | out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}" |
|
91 | out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}" |
|
92 | if not FileTest.exists? out_dirname |
|
92 | if not FileTest.exists? out_dirname |
|
93 | Dir.mkdir out_dirname |
|
93 | Dir.mkdir out_dirname |
@@ -114,29 +114,29 | |||||
|
114 | p = Problem.find(params[:id]).destroy |
|
114 | p = Problem.find(params[:id]).destroy |
|
115 | redirect_to action: :index |
|
115 | redirect_to action: :index |
|
116 | end |
|
116 | end |
|
117 |
|
117 | ||
|
118 | def toggle |
|
118 | def toggle |
|
119 | @problem = Problem.find(params[:id]) |
|
119 | @problem = Problem.find(params[:id]) |
|
120 |
- @problem.update |
|
120 | + @problem.update(available: !(@problem.available) ) |
|
121 | respond_to do |format| |
|
121 | respond_to do |format| |
|
122 | format.js { } |
|
122 | format.js { } |
|
123 | end |
|
123 | end |
|
124 | end |
|
124 | end |
|
125 |
|
125 | ||
|
126 | def toggle_test |
|
126 | def toggle_test |
|
127 | @problem = Problem.find(params[:id]) |
|
127 | @problem = Problem.find(params[:id]) |
|
128 |
- @problem.update |
|
128 | + @problem.update(test_allowed: !(@problem.test_allowed?) ) |
|
129 | respond_to do |format| |
|
129 | respond_to do |format| |
|
130 | format.js { } |
|
130 | format.js { } |
|
131 | end |
|
131 | end |
|
132 | end |
|
132 | end |
|
133 |
|
133 | ||
|
134 | def toggle_view_testcase |
|
134 | def toggle_view_testcase |
|
135 | @problem = Problem.find(params[:id]) |
|
135 | @problem = Problem.find(params[:id]) |
|
136 |
- @problem.update |
|
136 | + @problem.update(view_testcase: !(@problem.view_testcase?) ) |
|
137 | respond_to do |format| |
|
137 | respond_to do |format| |
|
138 | format.js { } |
|
138 | format.js { } |
|
139 | end |
|
139 | end |
|
140 | end |
|
140 | end |
|
141 |
|
141 | ||
|
142 | def turn_all_off |
|
142 | def turn_all_off |
@@ -7,37 +7,37 | |||||
|
7 | %button.navbar-toggler.collapsed{ type: :button, 'data-bs': {toggle: 'collapse', target: '#navbar-collapse'} } |
|
7 | %button.navbar-toggler.collapsed{ type: :button, 'data-bs': {toggle: 'collapse', target: '#navbar-collapse'} } |
|
8 | %span.navbar-toggler-icon |
|
8 | %span.navbar-toggler-icon |
|
9 | .collapse.navbar-collapse#navbar-collapse |
|
9 | .collapse.navbar-collapse#navbar-collapse |
|
10 | %ul.navbar-nav.me-auto.mb-2.mb-lg-0 |
|
10 | %ul.navbar-nav.me-auto.mb-2.mb-lg-0 |
|
11 | / submission |
|
11 | / submission |
|
12 | - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user)) |
|
12 | - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user)) |
|
13 | - %li.nav-item.dropdown |
|
13 | + %li.nav-item.dropdown.mx-2 |
|
14 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"} |
|
14 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"} |
|
15 | = "#{I18n.t 'menu.submissions'}" |
|
15 | = "#{I18n.t 'menu.submissions'}" |
|
16 | %ul.dropdown-menu |
|
16 | %ul.dropdown-menu |
|
17 | %li= link_to 'View', submissions_path, class:'dropdown-item' |
|
17 | %li= link_to 'View', submissions_path, class:'dropdown-item' |
|
18 | %li= link_to 'Self Test', test_index_path, class:'dropdown-item' |
|
18 | %li= link_to 'Self Test', test_index_path, class:'dropdown-item' |
|
19 | / hall of fame |
|
19 | / hall of fame |
|
20 | - if GraderConfiguration['right.user_hall_of_fame'] |
|
20 | - if GraderConfiguration['right.user_hall_of_fame'] |
|
21 |
- = |
|
21 | + %li= link_to "#{I18n.t 'menu.hall_of_fame'}", problem_hof_report_path, class: 'nav-link mx-2' |
|
22 | / display MODE button (with countdown in contest mode) |
|
22 | / display MODE button (with countdown in contest mode) |
|
23 | - if GraderConfiguration.analysis_mode? |
|
23 | - if GraderConfiguration.analysis_mode? |
|
24 |
- %div |
|
24 | + %div.btn.btn-success#countdown= "ANALYSIS MODE" |
|
25 | - elsif GraderConfiguration.time_limit_mode? |
|
25 | - elsif GraderConfiguration.time_limit_mode? |
|
26 | - if @current_user.contest_finished? |
|
26 | - if @current_user.contest_finished? |
|
27 |
- %div |
|
27 | + %div.btn.btn-danger#countdown= "Contest is over" |
|
28 | - elsif !@current_user.contest_started? |
|
28 | - elsif !@current_user.contest_started? |
|
29 |
- %div |
|
29 | + %div.btn.btn-primary#countdown= (t 'title_bar.contest_not_started') |
|
30 | - else |
|
30 | - else |
|
31 |
- %div |
|
31 | + %div.btn.btn-primary#countdown asdf |
|
32 | :javascript |
|
32 | :javascript |
|
33 | $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'}); |
|
33 | $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'}); |
|
34 | / admin section |
|
34 | / admin section |
|
35 | - if (@current_user!=nil) and (session[:admin]) |
|
35 | - if (@current_user!=nil) and (session[:admin]) |
|
36 | / management |
|
36 | / management |
|
37 | - %li.nav-item.dropdown |
|
37 | + %li.nav-item.dropdown.mx-2 |
|
38 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
38 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
39 | Manage |
|
39 | Manage |
|
40 | %ul.dropdown-menu |
|
40 | %ul.dropdown-menu |
|
41 | %li= link_to 'Announcements', announcements_path, class: 'dropdown-item' |
|
41 | %li= link_to 'Announcements', announcements_path, class: 'dropdown-item' |
|
42 | %li= link_to 'Problems', problems_path, class: 'dropdown-item' |
|
42 | %li= link_to 'Problems', problems_path, class: 'dropdown-item' |
|
43 | %li= link_to 'Tags', tags_path, class: 'dropdown-item' |
|
43 | %li= link_to 'Tags', tags_path, class: 'dropdown-item' |
@@ -51,13 +51,13 | |||||
|
51 | %li |
|
51 | %li |
|
52 | %hr.dropdown-divider |
|
52 | %hr.dropdown-divider |
|
53 | %li= link_to 'Sites', sites_path, class: 'dropdown-item' |
|
53 | %li= link_to 'Sites', sites_path, class: 'dropdown-item' |
|
54 | %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item' |
|
54 | %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item' |
|
55 | -# |
|
55 | -# |
|
56 | / report |
|
56 | / report |
|
57 | - %li.nav-item.dropdown |
|
57 | + %li.nav-item.dropdown.mx-2 |
|
58 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
58 | %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
59 | Report |
|
59 | Report |
|
60 | %ul.dropdown-menu |
|
60 | %ul.dropdown-menu |
|
61 | %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item' |
|
61 | %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item' |
|
62 | %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item' |
|
62 | %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item' |
|
63 | %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item' |
|
63 | %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item' |
@@ -1,20 +1,19 | |||||
|
1 |
- = form_ |
|
1 | + = form_with url: submit_main_path, multipart: true, class: 'form' do |form| |
|
2 | - if @submission and @submission.errors.any? |
|
2 | - if @submission and @submission.errors.any? |
|
3 | #error_explanation |
|
3 | #error_explanation |
|
4 | .alert.alert-danger |
|
4 | .alert.alert-danger |
|
5 | %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:" |
|
5 | %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:" |
|
6 | %ul |
|
6 | %ul |
|
7 | - @submission.errors.full_messages.each do |msg| |
|
7 | - @submission.errors.full_messages.each do |msg| |
|
8 | %li= msg |
|
8 | %li= msg |
|
9 | - .form-group |
|
9 | + .row.mb-2 |
|
10 | - = label_tag :submission, 'Problem:' |
|
10 | + .col-sm-2 |
|
11 | - = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, {:selected => '-1'}, { class: 'select2 form-control', style: "width: 100%" } |
|
11 | + = form.label :submission, 'Problem:', class: 'form-label' |
|
12 | - .form-group |
|
12 | + .col-sm-10 |
|
13 | - = label_tag :file, 'File:' |
|
13 | + = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, {:selected => '-1'}, { class: 'select2 form-control', style: "width: 100%" } |
|
14 | - .input-group |
|
14 | + .row.mb-2 |
|
15 | - %span.input-group-btn |
|
15 | + .col-sm-2 |
|
16 | - %span.btn.btn-default.btn-file |
|
16 | + = form.label :file, 'File:', class: 'form-label' |
|
17 | - Browse |
|
17 | + .col-sm-10 |
|
18 | - = file_field_tag 'file' |
|
18 | + = form.file_field :file, class: 'form-control' |
|
19 | - = text_field_tag '' , nil, {readonly: true, class: 'form-control'} |
|
19 | + = form.submit 'Submit', class: 'btn btn-primary' |
|
20 | - = submit_tag 'Submit', class: 'btn btn-default' |
|
@@ -10,17 +10,17 | |||||
|
10 | - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
10 | - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
11 | %p=t 'main.start_soon' |
|
11 | %p=t 'main.start_soon' |
|
12 |
|
12 | ||
|
13 | .row |
|
13 | .row |
|
14 | .col-md-7 |
|
14 | .col-md-7 |
|
15 | - if GraderConfiguration.show_submitbox_to?(@user) |
|
15 | - if GraderConfiguration.show_submitbox_to?(@user) |
|
16 |
- . |
|
16 | + .card.border-primary |
|
17 | - .panel-heading |
|
17 | + .card-header.text-bg-primary |
|
18 | Submission |
|
18 | Submission |
|
19 |
- . |
|
19 | + .card-body |
|
20 |
- = render |
|
20 | + = render 'submission_box' |
|
21 | - if GraderConfiguration.show_tasks_to?(@user) |
|
21 | - if GraderConfiguration.show_tasks_to?(@user) |
|
22 | - if not GraderConfiguration.multicontests? |
|
22 | - if not GraderConfiguration.multicontests? |
|
23 | %table.table.table-striped.table-condensed |
|
23 | %table.table.table-striped.table-condensed |
|
24 | %thead |
|
24 | %thead |
|
25 | %tr |
|
25 | %tr |
|
26 | %th Task name |
|
26 | %th Task name |
@@ -1,7 +1,7 | |||||
|
1 | - %table.table.sortable.table-striped.table-bordered.table-condensed |
|
1 | + %table#score-table.table.sortable.table-striped.table-bordered.table-condensed |
|
2 | %thead |
|
2 | %thead |
|
3 | %tr |
|
3 | %tr |
|
4 | %th Login |
|
4 | %th Login |
|
5 | %th Name |
|
5 | %th Name |
|
6 | / %th Activated? |
|
6 | / %th Activated? |
|
7 | / %th Logged_in |
|
7 | / %th Logged_in |
You need to be logged in to leave comments.
Login now