1.1 --- a/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/app.js Wed Jan 16 12:44:17 2013 +0100
1.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/app.js Mon Jan 21 22:10:08 2013 +0100
1.3 @@ -29,6 +29,7 @@
1.4
1.5 deferCodeMirror = function() {
1.6 codeMirror = CodeMirror.fromTextArea(elm[0], opts);
1.7 + elm[0].codeMirror = codeMirror;
1.8 // codeMirror.on("change", onChange(opts.onChange));
1.9 codeMirror.on("change", onChange);
1.10
1.11 @@ -119,19 +120,39 @@
1.12 + "}\n";
1.13
1.14
1.15 - $scope.reload= function() {
1.16 + $scope.reload = function() {
1.17 + $scope.errors = null;
1.18 var frame = document.getElementById("result");
1.19 frame.src = "result.html";
1.20 frame.contentDocument.location.reload(true);
1.21 frame.contentWindow.location.reload();
1.22 };
1.23
1.24 + $scope.fail = function( data ) {
1.25 + $scope.errors = eval( data );
1.26 + };
1.27 +
1.28 $scope.post = function(html, java) {
1.29 return $http({url: ".",
1.30 method: "POST",
1.31 //headers: this.headers,
1.32 data: { html : $scope.html, java : $scope.java}
1.33 - }).success( $scope.reload );
1.34 + }).success( $scope.reload ).error( $scope.fail );
1.35 + };
1.36 +
1.37 + $scope.errorClass = function( kind ) {
1.38 + switch( kind ) {
1.39 + case "ERROR" :
1.40 + return "error";
1.41 + default :
1.42 + return "warning";
1.43 + }
1.44 + };
1.45 +
1.46 + $scope.gotoError = function( line, col ) {
1.47 + var editor = document.getElementById("editorJava").codeMirror;
1.48 + editor.setCursor({ line: line - 1, ch : col });
1.49 + editor.focus();
1.50 };
1.51
1.52 $scope.tab = "html";