# HG changeset patch # User cavaliet # Date 1413554151 -7200 # Node ID 5d392dea4f49dda4d3ef5810c6870524de5ef05d # Parent 139737335c8a159ce1b16ef8223872f0bcf1ef78 error status management in client annotation diff -r 139737335c8a -r 5d392dea4f49 .hgignore --- a/.hgignore Fri Oct 17 13:52:24 2014 +0200 +++ b/.hgignore Fri Oct 17 15:55:51 2014 +0200 @@ -21,3 +21,6 @@ ^annot-server/static/js/lib ^annot-server/static/data ^annot-server/templates/annotationclient.html$ + +syntax: regexp +^annot-server/webapp/templates/annotationclient\.html$ \ No newline at end of file diff -r 139737335c8a -r 5d392dea4f49 annot-server/webapp/templates/annotationclient.html --- a/annot-server/webapp/templates/annotationclient.html Fri Oct 17 13:52:24 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ - - - - - - Mons by IRI - - - - -
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-

RETOUR

-
-
-
-
-
-
-
-
-

ENVOYER

-

la catégorie saisie

-
-
-
-
-
-
-
-
-
-
-
-

{{ '{{' }} c.label {{ '}}' }}

-

{{ '{{' }} c.full_label {{ '}}' }}

-
-
-
-
-
-
-
-
-
-
-

{{ '{{' }} c.label {{ '}}' }}

-

{{ '{{' }} c.full_label {{ '}}' }}

-
-
-
-
-
-
- -
- -
-
- - - - - - diff -r 139737335c8a -r 5d392dea4f49 client/app/annotationclient.html --- a/client/app/annotationclient.html Fri Oct 17 13:52:24 2014 +0200 +++ b/client/app/annotationclient.html Fri Oct 17 15:55:51 2014 +0200 @@ -33,7 +33,7 @@ -
+
@@ -47,7 +47,7 @@
+ ng-click="selectLevel(c.label, c.code, c)" ng-class="{'success-border':c.sendSuccess, 'error-border':c.sendError}">
@@ -60,7 +60,7 @@
+ ng-click="sendAnnotation(c.label, c.code, c)" ng-class="{'success-border':c.sendSuccess, 'error-border':c.sendError}">
diff -r 139737335c8a -r 5d392dea4f49 client/app/app.css --- a/client/app/app.css Fri Oct 17 13:52:24 2014 +0200 +++ b/client/app/app.css Fri Oct 17 15:55:51 2014 +0200 @@ -84,6 +84,9 @@ .success-border{ border: 10px solid #3c763d; } +.error-border{ + border: 10px solid #cb4442; +} /*.ng-scope{ border: red 1px solid; diff -r 139737335c8a -r 5d392dea4f49 client/app/app.js --- a/client/app/app.js Fri Oct 17 13:52:24 2014 +0200 +++ b/client/app/app.js Fri Oct 17 15:55:51 2014 +0200 @@ -95,7 +95,7 @@ if(typeof eventCode==='undefined' || eventCode===''){ eventCode = getURLParameter('event'); if(typeof eventCode==='undefined' || eventCode===''){ - alert('le code de l\'événement doit être indiqué dans l\'url selon "?event=CODE_EVENEMENT".'); + alert('le code de l\'événement doit être indiqué dans l\'url selon ?event=CODE_EVENEMENT.'); return; } } @@ -128,24 +128,29 @@ }; sock.onmessage = function(e) { + var data_json = JSON.parse(e.data); + //console.log('1', data_json); if(context.logging){ - log('Got message: ', e.data); + log('Got message: ' + e.data); } - //var data_json = JSON.parse(e.data); //showAlert('Annotation bien reçue.', true); //console.log('2 message', $scope.annotPile.length); if($scope.annotPile.length>0){ var c = $scope.annotPile.shift(); //console.log('3 message', c); + //console.log('2',data_json.status,data_json.status==='OK'); + var ok = data_json.status==='OK'; var i; if(c===false){ //showAlert('Annotation envoyée.', true); - $scope.sendBtnSuccess = true; - i = $interval(function(){ $interval.cancel(i); $scope.sendBtnSuccess = false; }, 2000, 1); + $scope.sendBtnSuccess = ok; + $scope.sendBtnError = !ok; + i = $interval(function(){ $interval.cancel(i); $scope.sendBtnSuccess = false; $scope.sendBtnError = false; }, 2000, 1); } else{ - c.sendSuccess = true; - i = $interval(function(){ $interval.cancel(i); c.sendSuccess = false; }, 2000, 1); + c.sendSuccess = ok; + c.sendError = !ok; + i = $interval(function(){ $interval.cancel(i); c.sendSuccess = false; c.sendError = false; }, 2000, 1); } if(!$scope.$$phase) { $scope.$apply();