diff --git a/app/controllers/configurations_controller.rb b/app/controllers/configurations_controller.rb --- a/app/controllers/configurations_controller.rb +++ b/app/controllers/configurations_controller.rb @@ -7,6 +7,7 @@ def index @configurations = GraderConfiguration.find(:all, :order => '`key`') + @group = GraderConfiguration.pluck("grader_configurations.key").map{ |x| x[0...(x.index('.'))] }.uniq.sort end def reload diff --git a/app/views/application/_submission_short.html.haml b/app/views/application/_submission_short.html.haml --- a/app/views/application/_submission_short.html.haml +++ b/app/views/application/_submission_short.html.haml @@ -2,7 +2,7 @@ - if submission.nil? = "-" - else - - if submission.graded_at.nil? + - unless submission.graded_at = t 'main.submitted_at' = format_short_time(submission.submitted_at.localtime) - else diff --git a/app/views/configurations/index.html.haml b/app/views/configurations/index.html.haml --- a/app/views/configurations/index.html.haml +++ b/app/views/configurations/index.html.haml @@ -3,24 +3,27 @@ %h1 System configuration -%table.info - %tr.info-head - %th Key - %th Type - %th Value - %th Description - - @configurations.each do |conf| - - @grader_configuration = conf - %tr{:class => cycle("info-odd", "info-even")} - %td - /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 - = @grader_configuration.key - %td - /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 - = @grader_configuration.value_type - %td - = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" - %td= conf.description +- @group.each do |g| + %h2= g + %table.table.table-striped + %thead + %th{style: 'width: 25%'} Key + %th{style: 'width: 10%'}Type + %th{style: 'width: 15%'} Value + %th Description + - @configurations.each do |conf| + - next if conf.key[0...(conf.key.index('.'))] != g + - @grader_configuration = conf + %tr + %td + /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 + = @grader_configuration.key + %td + /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 + = @grader_configuration.value_type + %td + = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" + %td= conf.description - if GraderConfiguration.config_cached? %br/ 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 @@ -8,7 +8,7 @@ %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' } + = 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 diff --git a/app/views/main/_submission_short.html.haml b/app/views/main/_submission_short.html.haml --- a/app/views/main/_submission_short.html.haml +++ b/app/views/main/_submission_short.html.haml @@ -3,14 +3,14 @@ = "-" - else - unless submission.graded_at - =t 'main.submitted_at' + = t 'main.submitted_at' = format_short_time(submission.submitted_at.localtime) - else %strong= t 'main.graded_at' = "#{format_short_time(submission.graded_at.localtime)} " %br - if GraderConfiguration['ui.show_score'] - =t 'main.score' + %strong=t 'main.score' = "#{(submission.points*100/submission.problem.full_score).to_i} " = " [" %tt