--- a/client/app/app.js Fri Oct 10 14:59:09 2014 +0200
+++ b/client/app/app.js Fri Oct 10 17:07:06 2014 +0200
@@ -138,19 +138,22 @@
};
}
- $scope.sendAnnotation = function(eventCode, c){
+ $scope.sendAnnotation = function(label, code, c){
if($scope.username==='' || typeof $scope.username==='undefined'){
showAlert('Vous devez indiquer un nom d\'utilisateur.', false);
return;
}
- if(eventCode==='' || typeof eventCode==='undefined'){
+ if(label==='' || typeof label==='undefined'){
showAlert('Vous devez indiquer un nom de catégorie.', false);
return;
}
// Send query
if (sock) {
+ if(typeof code==='undefined' || code===''){
+ code = window.S(label).slugify().s;
+ }
var new_annot = {
- categories : eventCode,
+ category: {code: code, label: label},
user : $scope.username
};
sock.send(JSON.stringify(new_annot));
@@ -172,7 +175,7 @@
};
// Interface management
- $scope.selectLevel = function(eventCode, c){
+ $scope.selectLevel = function(label, code, c){
if(typeof c==='undefined'){
$scope.returnVisStyle = {visibility:'hidden'};
$scope.selectedlevel = false;
@@ -185,7 +188,7 @@
else{
// Send query
console.log('send ntm', c);
- $scope.sendAnnotation(eventCode, c);
+ $scope.sendAnnotation(label, code, c);
}
};