From 85c438ae7ab7b7621f9ccedc129ed2c4226d8c8b Mon Sep 17 00:00:00 2001 From: Ahmed Akram Date: Tue, 13 May 2014 12:38:25 +0200 Subject: [PATCH] Issue #491, modifying scripts --- .../assets/javascripts/solutions.js.coffee | 57 ++++++++++++++++++- tutor/app/assets/stylesheets/solutions.css | 6 +- 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/tutor/app/assets/javascripts/solutions.js.coffee b/tutor/app/assets/javascripts/solutions.js.coffee index 910eeb33..bd78f65d 100644 --- a/tutor/app/assets/javascripts/solutions.js.coffee +++ b/tutor/app/assets/javascripts/solutions.js.coffee @@ -49,6 +49,7 @@ index_number = 0 # Author: Ahmed Akram @compile = (problem_id) -> input = $('#solution_code').val() + alert(input) if input.length is 0 alert "You didn't write any code" return @@ -59,6 +60,7 @@ index_number = 0 url: '/solutions/compile_solution' data: {code : input, problem_id : problem_id} datatype: 'json' + success: (unique) -> clear_console() stop_spin() @@ -353,6 +355,57 @@ debug_console = -> content = "" content = '' + @var = "xxxx" + content += "" + for i in data + if i['success'] + content += "" + content += "" + else + content += "" + content += "" + out.html(content) + return + error: (data) -> + clear_console() + stop_spin() + toggle_code_area() + return + return + + +@validate_contest_code = (problem_id) -> + code = $('#solution_code').val() + mins = parseInt($('#mins').text()) + secs = parseInt($('#secs').text()) + time = (mins * 60) + secs + if code.length is 0 + alert 'Blank submissions are not allowed' + return + toggle_code_area() + start_spin() + $.ajax + type: "POST" + url: '/cproblem/' + problem_id + data: {problem_id: problem_id, code: code, time: time} + datatype: 'json' + success: (data) -> + clear_console() + stop_spin() + toggle_code_area() + if data['compiler_error'] + compilation_error(data['compiler_output']) + return + out = $('#validate_case') + out.html("") + content = "" + content = '
TestCaseStatus
" + "#{i['test_case']}" + + "" + "#{i['response']}" + + "
" + "#{i['test_case']}" + + "" + "#{i['response']}"+ + "
' + @var = "xxxx" content += "" for i in data if i['success'] @@ -365,7 +418,7 @@ debug_console = -> "" content += "" - out.html(content) + out.html(content) return error: (data) -> clear_console() @@ -382,7 +435,7 @@ debug_console = -> @reload_template = () -> editor = ace.edit("editor"); edit_session = editor.getSession(); - template = "public class CoolSoft {\n" + template = "\npublic class CoolSoft {\n" template += "\tpublic static void main(String [] args) {\n\t\t\n\t}\n}" edit_session.setValue(template); return \ No newline at end of file diff --git a/tutor/app/assets/stylesheets/solutions.css b/tutor/app/assets/stylesheets/solutions.css index ab2e5dc5..811e6388 100644 --- a/tutor/app/assets/stylesheets/solutions.css +++ b/tutor/app/assets/stylesheets/solutions.css @@ -71,14 +71,12 @@ textarea { border: #999999; border-style: solid; border-width: thin; - max-height: 150px; - min-height: 150px; + max-height: 100px; + min-height: 100px; background: white; overflow: scroll; overflow-y: scroll; overflow-x: scroll; - max-width: 750px; - min-width: 750px; } .compilation_succeeded {
TestCaseStatus
" + "#{i['response']}"+ "