diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb --- a/app/controllers/problems_controller.rb +++ b/app/controllers/problems_controller.rb @@ -75,7 +75,7 @@ end @problem.description = @description elsif @description - if !@description.update_attributes(description_params) + if !@description.update(description_params) flash[:notice] = 'Error saving description' render :action => 'edit' and return end @@ -84,7 +84,7 @@ flash[:notice] = 'Error: Uploaded file is not PDF' render :action => 'edit' and return end - if @problem.update_attributes(problem_params) + if @problem.update(problem_params) flash[:notice] = 'Problem was successfully updated.' unless params[:file] == nil or params[:file] == '' flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.' @@ -117,7 +117,7 @@ def toggle @problem = Problem.find(params[:id]) - @problem.update_attributes(available: !(@problem.available) ) + @problem.update(available: !(@problem.available) ) respond_to do |format| format.js { } end @@ -125,7 +125,7 @@ def toggle_test @problem = Problem.find(params[:id]) - @problem.update_attributes(test_allowed: !(@problem.test_allowed?) ) + @problem.update(test_allowed: !(@problem.test_allowed?) ) respond_to do |format| format.js { } end @@ -133,7 +133,7 @@ def toggle_view_testcase @problem = Problem.find(params[:id]) - @problem.update_attributes(view_testcase: !(@problem.view_testcase?) ) + @problem.update(view_testcase: !(@problem.view_testcase?) ) respond_to do |format| format.js { } end diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -10,7 +10,7 @@ %ul.navbar-nav.me-auto.mb-2.mb-lg-0 / submission - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user)) - %li.nav-item.dropdown + %li.nav-item.dropdown.mx-2 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"} = "#{I18n.t 'menu.submissions'}" %ul.dropdown-menu @@ -18,23 +18,23 @@ %li= link_to 'Self Test', test_index_path, class:'dropdown-item' / hall of fame - if GraderConfiguration['right.user_hall_of_fame'] - = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof', class: 'nav-item') + %li= link_to "#{I18n.t 'menu.hall_of_fame'}", problem_hof_report_path, class: 'nav-link mx-2' / display MODE button (with countdown in contest mode) - if GraderConfiguration.analysis_mode? - %div.navbar-btn.btn.btn-success#countdown= "ANALYSIS MODE" + %div.btn.btn-success#countdown= "ANALYSIS MODE" - elsif GraderConfiguration.time_limit_mode? - if @current_user.contest_finished? - %div.navbar-btn.btn.btn-danger#countdown= "Contest is over" + %div.btn.btn-danger#countdown= "Contest is over" - elsif !@current_user.contest_started? - %div.navbar-btn.btn.btn-primary#countdown= (t 'title_bar.contest_not_started') + %div.btn.btn-primary#countdown= (t 'title_bar.contest_not_started') - else - %div.navbar-btn.btn.btn-primary#countdown asdf + %div.btn.btn-primary#countdown asdf :javascript $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'}); / admin section - if (@current_user!=nil) and (session[:admin]) / management - %li.nav-item.dropdown + %li.nav-item.dropdown.mx-2 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} Manage %ul.dropdown-menu @@ -54,7 +54,7 @@ %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item' -# / report - %li.nav-item.dropdown + %li.nav-item.dropdown.mx-2 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} Report %ul.dropdown-menu diff --git a/app/views/main/_submission_box.html.haml b/app/views/main/_submission_box.html.haml --- a/app/views/main/_submission_box.html.haml +++ b/app/views/main/_submission_box.html.haml @@ -1,4 +1,4 @@ -= form_tag({:action => 'submit'}, :multipart => true, class: 'form') do += form_with url: submit_main_path, multipart: true, class: 'form' do |form| - if @submission and @submission.errors.any? #error_explanation .alert.alert-danger @@ -6,15 +6,14 @@ %ul - @submission.errors.full_messages.each do |msg| %li= msg - .form-group - = label_tag :submission, 'Problem:' - = 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%" } - .form-group - = label_tag :file, 'File:' - .input-group - %span.input-group-btn - %span.btn.btn-default.btn-file - Browse - = file_field_tag 'file' - = text_field_tag '' , nil, {readonly: true, class: 'form-control'} - = submit_tag 'Submit', class: 'btn btn-default' + .row.mb-2 + .col-sm-2 + = form.label :submission, 'Problem:', class: 'form-label' + .col-sm-10 + = 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%" } + .row.mb-2 + .col-sm-2 + = form.label :file, 'File:', class: 'form-label' + .col-sm-10 + = form.file_field :file, class: 'form-control' + = form.submit 'Submit', class: 'btn btn-primary' diff --git a/app/views/main/list.html.haml b/app/views/main/list.html.haml --- a/app/views/main/list.html.haml +++ b/app/views/main/list.html.haml @@ -13,11 +13,11 @@ .row .col-md-7 - if GraderConfiguration.show_submitbox_to?(@user) - .panel.panel-primary - .panel-heading + .card.border-primary + .card-header.text-bg-primary Submission - .panel-body - = render :partial => 'submission_box' + .card-body + = render 'submission_box' - if GraderConfiguration.show_tasks_to?(@user) - if not GraderConfiguration.multicontests? %table.table.table-striped.table-condensed diff --git a/app/views/report/_score_table.html.haml b/app/views/report/_score_table.html.haml --- a/app/views/report/_score_table.html.haml +++ b/app/views/report/_score_table.html.haml @@ -1,4 +1,4 @@ -%table.table.sortable.table-striped.table-bordered.table-condensed +%table#score-table.table.sortable.table-striped.table-bordered.table-condensed %thead %tr %th Login