Description:
redact user name on view submission
Commit status:
[Not Reviewed]
References:
merge algo
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r848:057622a7b534 - - 3 files changed: 8 inserted, 2 deleted

@@ -1,30 +1,32
1 1 - if submission.nil?
2 2 = "-"
3 3 - else
4 4 %strong= "Submission ID:"
5 5 = submission.id
6 6 %br
7 7 - unless submission.graded_at
8 8 %strong= t 'main.submitted_at:'
9 9 = format_full_time_ago(submission.submitted_at.localtime)
10 10 - else
11 11 %strong= t 'main.graded_at:'
12 12 = format_full_time_ago(submission.graded_at.localtime)
13 13 %br
14 14 - if GraderConfiguration['ui.show_score']
15 15 %strong=t 'main.score'
16 16 = "#{(submission.points*100/submission.problem.full_score).to_i} "
17 17 = " ["
18 18 %tt
19 19 = submission.grader_comment
20 20 = "]"
21 21 %br
22 22 %strong View:
23 23 - if GraderConfiguration.show_grading_result
24 24 = link_to '[detailed result]', :action => 'result', :id => submission.id
25 25 - if submission.graded_at
26 + = link_to "#{t 'main.cmp_msg'}", compiler_msg_submission_path(submission), {popup: true,remote: true,class: 'btn btn-xs btn-info'}
27 + -#
26 28 %button.btn.btn-info.btn-xs{type: 'button', data: {toggle: 'modal', target: '#compiler'}}
27 29 =t 'main.cmp_msg'
28 30 = link_to "#{t 'main.src_link'}", download_submission_path(submission.id), class: 'btn btn-xs btn-info'
29 31 = link_to "#{t 'main.submissions_link'}", problem_submissions_path(problem_id), class: 'btn btn-xs btn-info'
30 32
@@ -1,87 +1,88
1 1 %textarea#text_sourcecode{style: "display:none"}~ @source
2 2 .container
3 3 .row
4 4 .col-md-12
5 5 %h2 Live submit
6 6
7 7 .row
8 8 .col-md-12
9 9 .alert.alert-info
10 10 Write your code in the following box, choose language, and click submit button when finished
11 11 .row
12 12 .col-md-8
13 13 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
14 14 .col-md-4
15 15 - # submission form
16 16 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
17 17
18 18 = hidden_field_tag 'editor_text', @source
19 19 = hidden_field_tag 'submission[problem_id]', @problem.id
20 20 .form-group
21 21 = label_tag "Task:"
22 22 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
23 23 .form-group
24 24 = label_tag "Description:"
25 25 = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem
26 26
27 27 .form-group
28 28 = label_tag 'Language:'
29 29 = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || @current_user.default_language || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
30 30 .form-group
31 31 .input-group
32 32 %span.input-group-btn
33 33 %span.btn.btn-default.btn-file
34 34 Browse
35 35 = file_field_tag 'load_file'
36 36 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
37 37 .form-group
38 38 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
39 39 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
40 40 - # latest submission status
41 41 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
42 42 .panel-heading
43 43 Latest Submission Status
44 44 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
45 45 .panel-body
46 46 %div#latest_status
47 47 - if @submission
48 48 = render :partial => 'submission_short',
49 49 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
50 50
51 - - if @submission
52 51 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
53 52 .modal-dialog.modal-lg{role:'document'}
54 53 .modal-content
55 54 .modal-header
56 55 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
57 56 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
58 57 %h4 Compiler message
59 58 .modal-body
60 - %pre#compiler_msg= @submission.compiler_message
59 + %pre#compiler_msg
60 + - if @submission
61 + = @submission.compiler_message
61 62 .modal-footer
62 63 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
63 64
64 65 :javascript
65 66 $(document).ready(function() {
66 67 e = ace.edit("editor")
67 68 e.setValue($("#text_sourcecode").val());
68 69 e.gotoLine(1);
69 70 $("#language_id").trigger('change');
70 71
71 72 $("#load_file").on('change',function(evt) {
72 73 var file = evt.target.files[0];
73 74 var reader = new FileReader();
74 75 reader.onload = function(theFile) {
75 76 var e = ace.edit("editor")
76 77 e.setValue(theFile.target.result);
77 78 e.gotoLine(1);
78 79 };
79 80 reader.readAsText(file)
80 81 });
81 82
82 83 //brython();
83 84 });
84 85
85 86
86 87
87 88
@@ -1,113 +1,116
1 1 %h1= "Submission: #{@submission.id}"
2 2
3 3 %textarea#data{style: "display:none;"}
4 4 :preserve
5 5 #{@submission.source}
6 6
7 7 //%div.highlight{:style => "border: 1px solid black;"}
8 8 //=@formatted_code.html_safe
9 9
10 10
11 11 .containter
12 12 .row
13 13 .col-md-7
14 14 %h2 Source Code
15 15 .col-md-5
16 16 %h2 Stat
17 17 .row
18 18 .col-md-7
19 19 %div#editor{ style: "font-size: 14px; height: 400px; border-radius:5px;" }
20 20 :javascript
21 21 e = ace.edit("editor")
22 22 e.setOptions({ maxLines: Infinity })
23 23 e.setValue($("#data").text())
24 24 e.gotoLine(1)
25 25 e.getSession().setMode("#{get_ace_mode(@submission.language)}")
26 26 e.setReadOnly(true)
27 27 .col-md-5
28 28 %table.table.table-striped
29 29 %tr
30 30 %td.text-right
31 31 %strong User
32 32 %td
33 + - if @current_user.admin? ||@current_user == @submission.user
33 34 - if @submission.user
34 35 = link_to "#{@submission.user.login}", stat_user_path(@submission.user)
35 36 = @submission.user.full_name
36 37 - else
37 38 = "(n/a)"
39 + - else
40 + = '-- REDACTED --'
38 41 %tr
39 42 %td.text-right
40 43 %strong Task
41 44 %td
42 45 - if @submission.problem!=nil
43 46 = link_to "[#{@submission.problem.name}]", stat_problem_path(@submission.problem)
44 47 = @submission.problem.full_name
45 48 = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @submission.problem
46 49 - else
47 50 = "(n/a)"
48 51 %tr
49 52 %td.text-right
50 53 %strong Tries
51 54 %td= @submission.number
52 55 %tr
53 56 %td.text-right
54 57 %strong Language
55 58 %td= @submission.language.pretty_name
56 59 %tr
57 60 %td.text-right
58 61 %strong Submitted
59 62 %td #{time_ago_in_words(@submission.submitted_at)} ago (at #{@submission.submitted_at.to_formatted_s(:long)})
60 63 %tr
61 64 %td.text-right
62 65 %strong Graded
63 66 - if @submission.graded_at
64 67 %td #{time_ago_in_words(@submission.graded_at)} ago (at #{@submission.graded_at.to_formatted_s(:long)})
65 68 - else
66 69 %td -
67 70 %tr
68 71 %td.text-right
69 72 %strong Points
70 73 %td #{@submission.points}/#{@submission.try(:problem).try(:full_score)}
71 74 %tr
72 75 %td.text-right
73 76 %strong Comment
74 77 %td #{@submission.grader_comment}
75 78 %tr
76 79 %td.text-right
77 80 %strong Runtime (s)
78 81 %td #{@submission.max_runtime}
79 82 %tr
80 83 %td.text-right
81 84 %strong Memory (kb)
82 85 %td #{@submission.peak_memory}
83 86 %tr
84 87 %td.text-right
85 88 %strong Compiler result
86 89 %td
87 90 %button.btn.btn-info.btn-xs{type: 'button', data: {toggle: 'modal', target: '#compiler'}}
88 91 view
89 92 - if session[:admin]
90 93 %tr
91 94 %td.text-right
92 95 %strong IP
93 96 %td #{@submission.ip_address}
94 97 %tr
95 98 %td.text-right
96 99 %strong Grading Task Status
97 100 %td
98 101 = @task.status_str if @task
99 102 - if session[:admin]
100 103 = link_to "rejudge", rejudge_submission_path, data: {remote: true}, class: 'btn btn-info btn-xs'
101 104
102 105
103 106 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
104 107 .modal-dialog.modal-lg{role:'document'}
105 108 .modal-content
106 109 .modal-header
107 110 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
108 111 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
109 112 %h4 Compiler message
110 113 .modal-body
111 114 %pre#compiler_msg= @submission.compiler_message
112 115 .modal-footer
113 116 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
You need to be logged in to leave comments. Login now