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

r869:abb95edf0526 - - 5 files changed: 30 inserted, 31 deleted

@@ -66,34 +66,34
66 66
67 67 def update
68 68 @problem = Problem.find(params[:id])
69 69 @description = @problem.description
70 70 if @description.nil? and params[:description][:body]!=''
71 71 @description = Description.new(description_params)
72 72 if !@description.save
73 73 flash[:notice] = 'Error saving description'
74 74 render :action => 'edit' and return
75 75 end
76 76 @problem.description = @description
77 77 elsif @description
78 - if !@description.update_attributes(description_params)
78 + if !@description.update(description_params)
79 79 flash[:notice] = 'Error saving description'
80 80 render :action => 'edit' and return
81 81 end
82 82 end
83 83 if params[:file] and params[:file].content_type != 'application/pdf'
84 84 flash[:notice] = 'Error: Uploaded file is not PDF'
85 85 render :action => 'edit' and return
86 86 end
87 - if @problem.update_attributes(problem_params)
87 + if @problem.update(problem_params)
88 88 flash[:notice] = 'Problem was successfully updated.'
89 89 unless params[:file] == nil or params[:file] == ''
90 90 flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.'
91 91 out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
92 92 if not FileTest.exists? out_dirname
93 93 Dir.mkdir out_dirname
94 94 end
95 95
96 96 out_filename = "#{out_dirname}/#{@problem.name}.pdf"
97 97 if FileTest.exists? out_filename
98 98 File.delete out_filename
99 99 end
@@ -108,41 +108,41
108 108 else
109 109 render :action => 'edit'
110 110 end
111 111 end
112 112
113 113 def destroy
114 114 p = Problem.find(params[:id]).destroy
115 115 redirect_to action: :index
116 116 end
117 117
118 118 def toggle
119 119 @problem = Problem.find(params[:id])
120 - @problem.update_attributes(available: !(@problem.available) )
120 + @problem.update(available: !(@problem.available) )
121 121 respond_to do |format|
122 122 format.js { }
123 123 end
124 124 end
125 125
126 126 def toggle_test
127 127 @problem = Problem.find(params[:id])
128 - @problem.update_attributes(test_allowed: !(@problem.test_allowed?) )
128 + @problem.update(test_allowed: !(@problem.test_allowed?) )
129 129 respond_to do |format|
130 130 format.js { }
131 131 end
132 132 end
133 133
134 134 def toggle_view_testcase
135 135 @problem = Problem.find(params[:id])
136 - @problem.update_attributes(view_testcase: !(@problem.view_testcase?) )
136 + @problem.update(view_testcase: !(@problem.view_testcase?) )
137 137 respond_to do |format|
138 138 format.js { }
139 139 end
140 140 end
141 141
142 142 def turn_all_off
143 143 Problem.available.all.each do |problem|
144 144 problem.available = false
145 145 problem.save
146 146 end
147 147 redirect_to action: :index
148 148 end
@@ -1,69 +1,69
1 1 %header
2 2 %nav.navbar.fixed-top.navbar-dark.bg-primary.navbar-expand-lg
3 3 .container-fluid
4 4 %a.navbar-brand{href: list_main_path}
5 5 %span.glyphicon.glyphicon-home
6 6 MAIN
7 7 %button.navbar-toggler.collapsed{ type: :button, 'data-bs': {toggle: 'collapse', target: '#navbar-collapse'} }
8 8 %span.navbar-toggler-icon
9 9 .collapse.navbar-collapse#navbar-collapse
10 10 %ul.navbar-nav.me-auto.mb-2.mb-lg-0
11 11 / submission
12 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 14 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"}
15 15 = "#{I18n.t 'menu.submissions'}"
16 16 %ul.dropdown-menu
17 17 %li= link_to 'View', submissions_path, class:'dropdown-item'
18 18 %li= link_to 'Self Test', test_index_path, class:'dropdown-item'
19 19 / hall of fame
20 20 - if GraderConfiguration['right.user_hall_of_fame']
21 - = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof', class: 'nav-item')
21 + %li= link_to "#{I18n.t 'menu.hall_of_fame'}", problem_hof_report_path, class: 'nav-link mx-2'
22 22 / display MODE button (with countdown in contest mode)
23 23 - if GraderConfiguration.analysis_mode?
24 - %div.navbar-btn.btn.btn-success#countdown= "ANALYSIS MODE"
24 + %div.btn.btn-success#countdown= "ANALYSIS MODE"
25 25 - elsif GraderConfiguration.time_limit_mode?
26 26 - if @current_user.contest_finished?
27 - %div.navbar-btn.btn.btn-danger#countdown= "Contest is over"
27 + %div.btn.btn-danger#countdown= "Contest is over"
28 28 - elsif !@current_user.contest_started?
29 - %div.navbar-btn.btn.btn-primary#countdown= (t 'title_bar.contest_not_started')
29 + %div.btn.btn-primary#countdown= (t 'title_bar.contest_not_started')
30 30 - else
31 - %div.navbar-btn.btn.btn-primary#countdown asdf
31 + %div.btn.btn-primary#countdown asdf
32 32 :javascript
33 33 $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'});
34 34 / admin section
35 35 - if (@current_user!=nil) and (session[:admin])
36 36 / management
37 - %li.nav-item.dropdown
37 + %li.nav-item.dropdown.mx-2
38 38 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
39 39 Manage
40 40 %ul.dropdown-menu
41 41 %li= link_to 'Announcements', announcements_path, class: 'dropdown-item'
42 42 %li= link_to 'Problems', problems_path, class: 'dropdown-item'
43 43 %li= link_to 'Tags', tags_path, class: 'dropdown-item'
44 44 %li= link_to 'Users', user_admin_index_path, class: 'dropdown-item'
45 45 %li= link_to 'User Groups', groups_path, class: 'dropdown-item'
46 46 %li= link_to 'Graders', graders_list_path, class: 'dropdown-item'
47 47 %li= link_to 'Message ', console_messages_path, class: 'dropdown-item'
48 48 %li
49 49 %hr.dropdown-divider
50 50 %li= link_to 'System config', grader_configuration_index_path, class: 'dropdown-item'
51 51 %li
52 52 %hr.dropdown-divider
53 53 %li= link_to 'Sites', sites_path, class: 'dropdown-item'
54 54 %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item'
55 55 -#
56 56 / report
57 - %li.nav-item.dropdown
57 + %li.nav-item.dropdown.mx-2
58 58 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
59 59 Report
60 60 %ul.dropdown-menu
61 61 %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item'
62 62 %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item'
63 63 %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item'
64 64 %li= link_to 'Login Report', login_report_path, class: 'dropdown-item'
65 65 - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0
66 66 =link_to "#{ungraded} backlogs!",
67 67 graders_list_path,
68 68 class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission'
69 69 / announcement
@@ -1,20 +1,19
1 - = form_tag({:action => 'submit'}, :multipart => true, class: 'form') do
1 + = form_with url: submit_main_path, multipart: true, class: 'form' do |form|
2 2 - if @submission and @submission.errors.any?
3 3 #error_explanation
4 4 .alert.alert-danger
5 5 %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:"
6 6 %ul
7 7 - @submission.errors.full_messages.each do |msg|
8 8 %li= msg
9 - .form-group
10 - = label_tag :submission, 'Problem:'
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%" }
12 - .form-group
13 - = label_tag :file, 'File:'
14 - .input-group
15 - %span.input-group-btn
16 - %span.btn.btn-default.btn-file
17 - Browse
18 - = file_field_tag 'file'
19 - = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
20 - = submit_tag 'Submit', class: 'btn btn-default'
9 + .row.mb-2
10 + .col-sm-2
11 + = form.label :submission, 'Problem:', class: 'form-label'
12 + .col-sm-10
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 + .row.mb-2
15 + .col-sm-2
16 + = form.label :file, 'File:', class: 'form-label'
17 + .col-sm-10
18 + = form.file_field :file, class: 'form-control'
19 + = form.submit 'Submit', class: 'btn btn-primary'
@@ -4,29 +4,29
4 4 = user_title_bar(@user)
5 5 - if @user.section
6 6 passcode for CP Unofficial Logo voting is
7 7 %strong= @user.section
8 8 %br
9 9
10 10 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
11 11 %p=t 'main.start_soon'
12 12
13 13 .row
14 14 .col-md-7
15 15 - if GraderConfiguration.show_submitbox_to?(@user)
16 - .panel.panel-primary
17 - .panel-heading
16 + .card.border-primary
17 + .card-header.text-bg-primary
18 18 Submission
19 - .panel-body
20 - = render :partial => 'submission_box'
19 + .card-body
20 + = render 'submission_box'
21 21 - if GraderConfiguration.show_tasks_to?(@user)
22 22 - if not GraderConfiguration.multicontests?
23 23 %table.table.table-striped.table-condensed
24 24 %thead
25 25 %tr
26 26 %th Task name
27 27 %th Full name
28 28 %th # of sub(s)
29 29 %th Results
30 30 %th
31 31 %tbody
32 32 = render :partial => 'problem', :collection => @problems
@@ -1,13 +1,13
1 - %table.table.sortable.table-striped.table-bordered.table-condensed
1 + %table#score-table.table.sortable.table-striped.table-bordered.table-condensed
2 2 %thead
3 3 %tr
4 4 %th Login
5 5 %th Name
6 6 / %th Activated?
7 7 / %th Logged_in
8 8 / %th Contest(s)
9 9 %th Remark
10 10 - @problems.each do |p|
11 11 %th.text-right= p.name.gsub('_',' ')
12 12 %th.text-right Total
13 13 %th.text-right Passed
You need to be logged in to leave comments. Login now