From 54a1ce7b4f60eb14facc0719c11aa55de22a3fc7 Mon Sep 17 00:00:00 2001 From: Nicolas Setton Date: Mon, 4 Sep 2017 20:16:02 -0400 Subject: [PATCH] (WIP) work on checker --- compile_server/app/static/editors.js | 35 +++++++++++++++++++++++++++- compile_server/app/views.py | 9 ------- compile_server/urls.py | 4 ++-- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/compile_server/app/static/editors.js b/compile_server/app/static/editors.js index 6b4b15f..d2f0b6f 100644 --- a/compile_server/app/static/editors.js +++ b/compile_server/app/static/editors.js @@ -1,3 +1,35 @@ +function query_check_result(editors, container) { + + files = [] + + editors.forEach(function(e){ + files.push({'basename': e.basename, + 'contents': e.getValue()}) + }) + + data = {"files": files} + + // request the examples + $.ajax({ + url: "/check_program/", + data: JSON.stringify(data), + type: "POST", + dataType : "json", + contentType: 'application/json; charset=UTF-8', + }) + .done(function( json ) { + alert(json) + }) + .fail(function( xhr, status, errorThrown ) { + // + alert( "could not run the example" ); + console.log( "Error: " + errorThrown ); + console.log( "Status: " + status ); + console.dir( xhr ); + }) +} + + // Fills a
with an editable representation of an example. // container: the
in question // example_name: the name of the example to load @@ -69,7 +101,7 @@ function fill_editor(container, example_name) { editor.setValue(resource.contents) editor.gotoLine(1) editor.initial_contents = resource.contents - editor.filename = resource.basename + editor.basename = resource.basename // TODO: place the cursor at 1,1 @@ -92,6 +124,7 @@ function fill_editor(container, example_name) { check_button = $('