Description:
fix refresh button on submission edit page
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r699:dd5555537101 - - 2 files changed: 2 inserted, 1 deleted

@@ -1,82 +1,83
1 %h2 Live submit
1 %h2 Live submit
2 %br
2 %br
3
3
4 %textarea#text_sourcecode{style: "display:none"}~ @source
4 %textarea#text_sourcecode{style: "display:none"}~ @source
5 .container
5 .container
6 .row
6 .row
7 .col-md-12
7 .col-md-12
8 .alert.alert-info
8 .alert.alert-info
9 Write your code in the following box, choose language, and click submit button when finished
9 Write your code in the following box, choose language, and click submit button when finished
10 .row
10 .row
11 .col-md-8
11 .col-md-8
12 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
12 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
13 .col-md-4
13 .col-md-4
14 - # submission form
14 - # submission form
15 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
15 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
16
16
17 = hidden_field_tag 'editor_text', @source
17 = hidden_field_tag 'editor_text', @source
18 = hidden_field_tag 'submission[problem_id]', @problem.id
18 = hidden_field_tag 'submission[problem_id]', @problem.id
19 .form-group
19 .form-group
20 = label_tag "Task:"
20 = label_tag "Task:"
21 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
21 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
22
22
23 .form-group
23 .form-group
24 = label_tag 'Language'
24 = label_tag 'Language'
25 = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
25 = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
26 .form-group
26 .form-group
27 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
27 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
28 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
28 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
29 - # latest submission status
29 - # latest submission status
30 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
30 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
31 .panel-heading
31 .panel-heading
32 Latest Submission Status
32 Latest Submission Status
33 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
33 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
34 .panel-body
34 .panel-body
35 + %div#latest_status
35 - if @submission
36 - if @submission
36 = render :partial => 'submission_short',
37 = render :partial => 'submission_short',
37 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
38 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
38 .row
39 .row
39 .col-md-12
40 .col-md-12
40 %h2 Console
41 %h2 Console
41 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
42 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
42
43
43 :javascript
44 :javascript
44 $(document).ready(function() {
45 $(document).ready(function() {
45 e = ace.edit("editor")
46 e = ace.edit("editor")
46 e.setValue($("#text_sourcecode").val());
47 e.setValue($("#text_sourcecode").val());
47 e.gotoLine(1);
48 e.gotoLine(1);
48 $("#language_id").trigger('change');
49 $("#language_id").trigger('change');
49 brython();
50 brython();
50 });
51 });
51
52
52
53
53 %script#__main__{type:'text/python3'}
54 %script#__main__{type:'text/python3'}
54 :plain
55 :plain
55 import sys
56 import sys
56 import traceback
57 import traceback
57
58
58 from browser import document as doc
59 from browser import document as doc
59 from browser import window, alert, console
60 from browser import window, alert, console
60
61
61 _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
62 _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
62 for supporting Python development. See www.python.org for more information."""
63 for supporting Python development. See www.python.org for more information."""
63
64
64 _copyright = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
65 _copyright = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
65 All Rights Reserved.
66 All Rights Reserved.
66
67
67 Copyright (c) 2001-2013 Python Software Foundation.
68 Copyright (c) 2001-2013 Python Software Foundation.
68 All Rights Reserved.
69 All Rights Reserved.
69
70
70 Copyright (c) 2000 BeOpen.com.
71 Copyright (c) 2000 BeOpen.com.
71 All Rights Reserved.
72 All Rights Reserved.
72
73
73 Copyright (c) 1995-2001 Corporation for National Research Initiatives.
74 Copyright (c) 1995-2001 Corporation for National Research Initiatives.
74 All Rights Reserved.
75 All Rights Reserved.
75
76
76 Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
77 Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
77 All Rights Reserved."""
78 All Rights Reserved."""
78
79
79 _license = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
80 _license = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
80 All rights reserved.
81 All rights reserved.
81
82
82 Redistribution and use in source and binary forms, with or without
83 Redistribution and use in source and binary forms, with or without
@@ -1,2 +1,2
1 :plain
1 :plain
2 - $("#latest_status").html("#{j render({partial: 'submission_short', locals: {submission: @submission, problem_name: @problem.name}})}")
2 + $("#latest_status").html("#{j render({partial: 'submission_short', locals: {submission: @submission, problem_name: @problem.name, problem_id: @problem.id}})}")
You need to be logged in to leave comments. Login now