Description:
add description
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r710:08159fa838b8 - - 1 file changed: 4 inserted, 1 deleted

@@ -1,120 +1,123
1 1 %h2 Live submit
2 2 %br
3 3
4 4 %textarea#text_sourcecode{style: "display:none"}~ @source
5 5 .container
6 6 .row
7 7 .col-md-12
8 8 .alert.alert-info
9 9 Write your code in the following box, choose language, and click submit button when finished
10 10 .row
11 11 .col-md-8
12 12 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
13 13 .col-md-4
14 14 - # submission form
15 15 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
16 16
17 17 = hidden_field_tag 'editor_text', @source
18 18 = hidden_field_tag 'submission[problem_id]', @problem.id
19 19 .form-group
20 20 = label_tag "Task:"
21 21 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
22 + .form-group
23 + = label_tag "Description:"
24 + = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem
22 25
23 26 .form-group
24 - = label_tag 'Language'
27 + = label_tag 'Language:'
25 28 = 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 29 .form-group
27 30 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
28 31 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
29 32 - # latest submission status
30 33 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
31 34 .panel-heading
32 35 Latest Submission Status
33 36 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
34 37 .panel-body
35 38 %div#latest_status
36 39 - if @submission
37 40 = render :partial => 'submission_short',
38 41 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
39 42 .row
40 43 .col-md-12
41 44 %h2 Console
42 45 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
43 46
44 47 :javascript
45 48 $(document).ready(function() {
46 49 e = ace.edit("editor")
47 50 e.setValue($("#text_sourcecode").val());
48 51 e.gotoLine(1);
49 52 $("#language_id").trigger('change');
50 53 brython();
51 54 });
52 55
53 56
54 57 %script#__main__{type:'text/python3'}
55 58 :plain
56 59 import sys
57 60 import traceback
58 61
59 62 from browser import document as doc
60 63 from browser import window, alert, console
61 64
62 65 _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
63 66 for supporting Python development. See www.python.org for more information."""
64 67
65 68 _copyright = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
66 69 All Rights Reserved.
67 70
68 71 Copyright (c) 2001-2013 Python Software Foundation.
69 72 All Rights Reserved.
70 73
71 74 Copyright (c) 2000 BeOpen.com.
72 75 All Rights Reserved.
73 76
74 77 Copyright (c) 1995-2001 Corporation for National Research Initiatives.
75 78 All Rights Reserved.
76 79
77 80 Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
78 81 All Rights Reserved."""
79 82
80 83 _license = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
81 84 All rights reserved.
82 85
83 86 Redistribution and use in source and binary forms, with or without
84 87 modification, are permitted provided that the following conditions are met:
85 88
86 89 Redistributions of source code must retain the above copyright notice, this
87 90 list of conditions and the following disclaimer. Redistributions in binary
88 91 form must reproduce the above copyright notice, this list of conditions and
89 92 the following disclaimer in the documentation and/or other materials provided
90 93 with the distribution.
91 94 Neither the name of the <ORGANIZATION> nor the names of its contributors may
92 95 be used to endorse or promote products derived from this software without
93 96 specific prior written permission.
94 97
95 98 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
96 99 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97 100 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
98 101 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
99 102 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
100 103 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
101 104 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
102 105 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
103 106 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
104 107 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
105 108 POSSIBILITY OF SUCH DAMAGE.
106 109 """
107 110
108 111 def credits():
109 112 print(_credits)
110 113 credits.__repr__ = lambda:_credits
111 114
112 115 def copyright():
113 116 print(_copyright)
114 117 copyright.__repr__ = lambda:_copyright
115 118
116 119 def license():
117 120 print(_license)
118 121 license.__repr__ = lambda:_license
119 122
120 123 def write(data):
You need to be logged in to leave comments. Login now