+ 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();