Description:
- fix various ui issues
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r613:e3dfadbca639 - - 5 files changed: 13 inserted, 9 deleted
@@ -1,29 +1,30 | |||||
|
1 | class ConfigurationsController < ApplicationController |
|
1 | class ConfigurationsController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :authenticate |
|
3 | before_filter :authenticate |
|
4 | before_filter { |controller| controller.authorization_by_roles(['admin'])} |
|
4 | before_filter { |controller| controller.authorization_by_roles(['admin'])} |
|
5 |
|
5 | ||
|
6 |
|
6 | ||
|
7 | def index |
|
7 | def index |
|
8 | @configurations = GraderConfiguration.find(:all, |
|
8 | @configurations = GraderConfiguration.find(:all, |
|
9 | :order => '`key`') |
|
9 | :order => '`key`') |
|
|
10 | + @group = GraderConfiguration.pluck("grader_configurations.key").map{ |x| x[0...(x.index('.'))] }.uniq.sort | ||
|
10 | end |
|
11 | end |
|
11 |
|
12 | ||
|
12 | def reload |
|
13 | def reload |
|
13 | GraderConfiguration.reload |
|
14 | GraderConfiguration.reload |
|
14 | redirect_to :action => 'index' |
|
15 | redirect_to :action => 'index' |
|
15 | end |
|
16 | end |
|
16 |
|
17 | ||
|
17 | def update |
|
18 | def update |
|
18 | @config = GraderConfiguration.find(params[:id]) |
|
19 | @config = GraderConfiguration.find(params[:id]) |
|
19 | User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' |
|
20 | User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' |
|
20 | respond_to do |format| |
|
21 | respond_to do |format| |
|
21 | if @config.update_attributes(params[:grader_configuration]) |
|
22 | if @config.update_attributes(params[:grader_configuration]) |
|
22 | format.json { head :ok } |
|
23 | format.json { head :ok } |
|
23 | else |
|
24 | else |
|
24 | format.json { respond_with_bip(@config) } |
|
25 | format.json { respond_with_bip(@config) } |
|
25 | end |
|
26 | end |
|
26 | end |
|
27 | end |
|
27 | end |
|
28 | end |
|
28 |
|
29 | ||
|
29 | end |
|
30 | end |
@@ -1,26 +1,26 | |||||
|
1 |
|
1 | ||
|
2 | - if submission.nil? |
|
2 | - if submission.nil? |
|
3 | = "-" |
|
3 | = "-" |
|
4 | - else |
|
4 | - else |
|
5 |
- - |
|
5 | + - unless submission.graded_at |
|
6 | = t 'main.submitted_at' |
|
6 | = t 'main.submitted_at' |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
8 | - else |
|
8 | - else |
|
9 | = t 'main.graded_at' |
|
9 | = t 'main.graded_at' |
|
10 | = "#{format_short_time(submission.graded_at.localtime)}, " |
|
10 | = "#{format_short_time(submission.graded_at.localtime)}, " |
|
11 | - if GraderConfiguration['ui.show_score'] |
|
11 | - if GraderConfiguration['ui.show_score'] |
|
12 | = t 'main.score' |
|
12 | = t 'main.score' |
|
13 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
13 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
14 | = " [" |
|
14 | = " [" |
|
15 | %tt |
|
15 | %tt |
|
16 | = submission.grader_comment |
|
16 | = submission.grader_comment |
|
17 | = "]" |
|
17 | = "]" |
|
18 | - if GraderConfiguration.show_grading_result |
|
18 | - if GraderConfiguration.show_grading_result |
|
19 | = " | " |
|
19 | = " | " |
|
20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
21 | = " | " |
|
21 | = " | " |
|
22 | = link_to("[#{t 'main.cmp_msg'}]", {:action => 'compiler_msg', :id => submission.id}, {:popup => true}) |
|
22 | = link_to("[#{t 'main.cmp_msg'}]", {:action => 'compiler_msg', :id => submission.id}, {:popup => true}) |
|
23 | = " | " |
|
23 | = " | " |
|
24 | = link_to("[#{t 'main.src_link'}]",{:action => 'source', :id => submission.id}) |
|
24 | = link_to("[#{t 'main.src_link'}]",{:action => 'source', :id => submission.id}) |
|
25 | //= " | " |
|
25 | //= " | " |
|
26 | //= link_to "[#{t 'main.submissions_link'}]", main_submission_path(submission.problem.id) |
|
26 | //= link_to "[#{t 'main.submissions_link'}]", main_submission_path(submission.problem.id) |
@@ -1,34 +1,37 | |||||
|
1 | /- content_for :header do |
|
1 | /- content_for :header do |
|
2 | / = javascript_include_tag 'local_jquery' |
|
2 | / = javascript_include_tag 'local_jquery' |
|
3 |
|
3 | ||
|
4 | %h1 System configuration |
|
4 | %h1 System configuration |
|
5 |
|
5 | ||
|
6 | - %table.info |
|
6 | + - @group.each do |g| |
|
7 | - %tr.info-head |
|
7 | + %h2= g |
|
8 | - %th Key |
|
8 | + %table.table.table-striped |
|
9 |
- %th |
|
9 | + %thead |
|
10 | - %th Value |
|
10 | + %th{style: 'width: 25%'} Key |
|
|
11 | + %th{style: 'width: 10%'}Type | ||
|
|
12 | + %th{style: 'width: 15%'} Value | ||
|
11 | %th Description |
|
13 | %th Description |
|
12 | - @configurations.each do |conf| |
|
14 | - @configurations.each do |conf| |
|
|
15 | + - next if conf.key[0...(conf.key.index('.'))] != g | ||
|
13 | - @grader_configuration = conf |
|
16 | - @grader_configuration = conf |
|
14 | - %tr{:class => cycle("info-odd", "info-even")} |
|
17 | + %tr |
|
15 | %td |
|
18 | %td |
|
16 | /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
19 | /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
17 | = @grader_configuration.key |
|
20 | = @grader_configuration.key |
|
18 | %td |
|
21 | %td |
|
19 | /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
22 | /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
20 | = @grader_configuration.value_type |
|
23 | = @grader_configuration.value_type |
|
21 | %td |
|
24 | %td |
|
22 | = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" |
|
25 | = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" |
|
23 | %td= conf.description |
|
26 | %td= conf.description |
|
24 |
|
27 | ||
|
25 | - if GraderConfiguration.config_cached? |
|
28 | - if GraderConfiguration.config_cached? |
|
26 | %br/ |
|
29 | %br/ |
|
27 | Your config is saved, but it does not automatically take effect. |
|
30 | Your config is saved, but it does not automatically take effect. |
|
28 | %br/ |
|
31 | %br/ |
|
29 | If you have one mongrel process running, you can |
|
32 | If you have one mongrel process running, you can |
|
30 | = link_to '[click]', :action => 'reload' |
|
33 | = link_to '[click]', :action => 'reload' |
|
31 | here to reload. |
|
34 | here to reload. |
|
32 | %br/ |
|
35 | %br/ |
|
33 | If you have more than one process running, you should restart |
|
36 | If you have more than one process running, you should restart |
|
34 | them manually. |
|
37 | them manually. |
@@ -1,20 +1,20 | |||||
|
1 | = form_tag({:action => 'submit'}, :multipart => true, class: 'form') do |
|
1 | = form_tag({:action => 'submit'}, :multipart => true, class: 'form') do |
|
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 | .form-group |
|
10 | = label_tag :submission, 'Problem:' |
|
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' } |
|
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 |
|
12 | .form-group |
|
13 | = label_tag :file, 'File:' |
|
13 | = label_tag :file, 'File:' |
|
14 | .input-group |
|
14 | .input-group |
|
15 | %span.input-group-btn |
|
15 | %span.input-group-btn |
|
16 | %span.btn.btn-default.btn-file |
|
16 | %span.btn.btn-default.btn-file |
|
17 | Browse |
|
17 | Browse |
|
18 | = file_field_tag 'file' |
|
18 | = file_field_tag 'file' |
|
19 | = text_field_tag '' , nil, {readonly: true, class: 'form-control'} |
|
19 | = text_field_tag '' , nil, {readonly: true, class: 'form-control'} |
|
20 | = submit_tag 'Submit', class: 'btn btn-default' |
|
20 | = submit_tag 'Submit', class: 'btn btn-default' |
@@ -1,26 +1,26 | |||||
|
1 |
|
1 | ||
|
2 | - if submission.nil? |
|
2 | - if submission.nil? |
|
3 | = "-" |
|
3 | = "-" |
|
4 | - else |
|
4 | - else |
|
5 | - unless submission.graded_at |
|
5 | - unless submission.graded_at |
|
6 | =t 'main.submitted_at' |
|
6 | = t 'main.submitted_at' |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
8 | - else |
|
8 | - else |
|
9 | %strong= t 'main.graded_at' |
|
9 | %strong= t 'main.graded_at' |
|
10 | = "#{format_short_time(submission.graded_at.localtime)} " |
|
10 | = "#{format_short_time(submission.graded_at.localtime)} " |
|
11 | %br |
|
11 | %br |
|
12 | - if GraderConfiguration['ui.show_score'] |
|
12 | - if GraderConfiguration['ui.show_score'] |
|
13 | - =t 'main.score' |
|
13 | + %strong=t 'main.score' |
|
14 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
14 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
15 | = " [" |
|
15 | = " [" |
|
16 | %tt |
|
16 | %tt |
|
17 | = submission.grader_comment |
|
17 | = submission.grader_comment |
|
18 | = "]" |
|
18 | = "]" |
|
19 | %br |
|
19 | %br |
|
20 | %strong View: |
|
20 | %strong View: |
|
21 | - if GraderConfiguration.show_grading_result |
|
21 | - if GraderConfiguration.show_grading_result |
|
22 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
22 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
23 | = link_to "#{t 'main.cmp_msg'}", {:action => 'compiler_msg', :id => submission.id}, {popup: true,class: 'btn btn-xs btn-info'} |
|
23 | = link_to "#{t 'main.cmp_msg'}", {:action => 'compiler_msg', :id => submission.id}, {popup: true,class: 'btn btn-xs btn-info'} |
|
24 | = link_to "#{t 'main.src_link'}",{:action => 'source', :id => submission.id}, class: 'btn btn-xs btn-info' |
|
24 | = link_to "#{t 'main.src_link'}",{:action => 'source', :id => submission.id}, class: 'btn btn-xs btn-info' |
|
25 | = link_to "#{t 'main.submissions_link'}", problem_submissions_path(problem_id), class: 'btn btn-xs btn-info' |
|
25 | = link_to "#{t 'main.submissions_link'}", problem_submissions_path(problem_id), class: 'btn btn-xs btn-info' |
|
26 |
|
26 |
You need to be logged in to leave comments.
Login now