Show More
Commit Description:
merge
Commit Description:
merge
References:
File last commit:
Show/Diff file:
Action:
app/views/submissions/edit.html.haml
| 87 lines
| 3.3 KiB
| text/x-haml
| HamlLexer
|
| r650 | %textarea#text_sourcecode{style: "display:none"}~ @source | |||
| r597 | .container | |||
| .row | ||||
| .col-md-12 | ||||
| r764 | %h2 Live submit | |||
| .row | ||||
| .col-md-12 | ||||
| r597 | .alert.alert-info | |||
| Write your code in the following box, choose language, and click submit button when finished | ||||
| .row | ||||
| .col-md-8 | ||||
| %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'} | ||||
| .col-md-4 | ||||
| r682 | - # submission form | |||
| r597 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do | |||
| = hidden_field_tag 'editor_text', @source | ||||
| = hidden_field_tag 'submission[problem_id]', @problem.id | ||||
| .form-group | ||||
| = label_tag "Task:" | ||||
| = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true | ||||
| r710 | .form-group | |||
| = label_tag "Description:" | ||||
| = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem | ||||
| r597 | ||||
| .form-group | ||||
| r710 | = label_tag 'Language:' | |||
|
|
r805 | = 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" | ||
| r597 | .form-group | |||
| r711 | .input-group | |||
| %span.input-group-btn | ||||
| %span.btn.btn-default.btn-file | ||||
| Browse | ||||
| = file_field_tag 'load_file' | ||||
| = text_field_tag '' , nil, {readonly: true, class: 'form-control'} | ||||
| .form-group | ||||
| r597 | = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit', | |||
| data: {confirm: "Submitting this source code for task #{@problem.long_name}?"} | ||||
| r682 | - # latest submission status | |||
| r696 | .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"} | |||
| r597 | .panel-heading | |||
| Latest Submission Status | ||||
| r631 | = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission | |||
| r597 | .panel-body | |||
| r699 | %div#latest_status | |||
| - if @submission | ||||
| = render :partial => 'submission_short', | ||||
| :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id } | ||||
| r597 | ||||
| r753 | - if @submission | |||
| .modal.fade#compiler{tabindex: -1,role: 'dialog'} | ||||
| .modal-dialog.modal-lg{role:'document'} | ||||
| .modal-content | ||||
| .modal-header | ||||
| %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}} | ||||
| %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} × | ||||
| %h4 Compiler message | ||||
| .modal-body | ||||
| %pre#compiler_msg= @submission.compiler_message | ||||
| .modal-footer | ||||
| %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close | ||||
| r742 | ||||
| r597 | :javascript | |||
| $(document).ready(function() { | ||||
| e = ace.edit("editor") | ||||
| r650 | e.setValue($("#text_sourcecode").val()); | |||
| r597 | e.gotoLine(1); | |||
| $("#language_id").trigger('change'); | ||||
| r711 | ||||
| $("#load_file").on('change',function(evt) { | ||||
| var file = evt.target.files[0]; | ||||
| var reader = new FileReader(); | ||||
| reader.onload = function(theFile) { | ||||
| var e = ace.edit("editor") | ||||
| e.setValue(theFile.target.result); | ||||
| e.gotoLine(1); | ||||
| }; | ||||
| reader.readAsText(file) | ||||
| }); | ||||
| //brython(); | ||||
| r597 | }); | |||
| r711 | ||||
