# HG changeset patch # User cavaliet # Date 1412953626 -7200 # Node ID c0f9f9ab2a8a4e84980cc7387d884bf149fb28d4 # Parent 90918426079cb1e17d991d8b32653e7de641fa12 clean messages and error. diff -r 90918426079c -r c0f9f9ab2a8a client/README.md --- a/client/README.md Fri Oct 10 14:59:09 2014 +0200 +++ b/client/README.md Fri Oct 10 17:07:06 2014 +0200 @@ -11,4 +11,6 @@ TODO: ----- +- serveur has to send message with success or error code, + then client has to display green or red feedback. - unit tests diff -r 90918426079c -r c0f9f9ab2a8a client/app/annotationclient.html --- a/client/app/annotationclient.html Fri Oct 10 14:59:09 2014 +0200 +++ b/client/app/annotationclient.html Fri Oct 10 17:07:06 2014 +0200 @@ -24,7 +24,7 @@
-
+
@@ -47,7 +47,7 @@
+ ng-click="selectLevel(c.label, c.code, c)" ng-class="{'success-border':c.sendSuccess}">
@@ -60,7 +60,7 @@
+ ng-click="sendAnnotation(c.label, c.code, c)" ng-class="{'success-border':c.sendSuccess}">
diff -r 90918426079c -r c0f9f9ab2a8a client/app/app.js --- 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); } }; diff -r 90918426079c -r c0f9f9ab2a8a client/bower.json --- a/client/bower.json Fri Oct 10 14:59:09 2014 +0200 +++ b/client/bower.json Fri Oct 10 17:07:06 2014 +0200 @@ -20,6 +20,7 @@ "angular-resource": "~1.3", "angular-bootstrap": "~0.11.0", "allmighty-autocomplete": "*", - "bootstrap": "~3.1.1" + "bootstrap": "~3.1.1", + "string": "*" } } diff -r 90918426079c -r c0f9f9ab2a8a client/data/categories.json --- a/client/data/categories.json Fri Oct 10 14:59:09 2014 +0200 +++ b/client/data/categories.json Fri Oct 10 17:07:06 2014 +0200 @@ -9,25 +9,25 @@ "label": "Batterie", "full_label": "sous-catégorie 1-1", "color": "rgb(205,200,63)", - "event_code": "ntm" + "code": "ntm" }, { "label": "Clavier", "full_label": "sous-catégorie 1-2", "color": "rgb(205,200,63)", - "event_code": "iam" + "code": "iam" }, { "label": "Guitare", "full_label": "sous-catégorie 1-3", "color": "rgb(205,200,63)", - "event_code": "hip" + "code": "hip" }, { "label": "Trombone", "full_label": "sous-catégorie 1-4", "color": "rgb(205,200,63)", - "event_code": "hop" + "code": "hop" } ] }, @@ -40,19 +40,19 @@ "label": "Accélération", "full_label": "sous-catégorie 2-1", "color": "rgb(222,139,83)", - "event_code": "rock" + "code": "rock" }, { "label": "Décélération", "full_label": "sous-catégorie 2-2", "color": "rgb(222,139,83)", - "event_code": "rap" + "code": "rap" }, { "label": "Pause", "full_label": "sous-catégorie 2-3", "color": "rgb(222,139,83)", - "event_code": "classic" + "code": "classic" } ] }, @@ -65,13 +65,13 @@ "label": "sub cat 3-1", "full_label": "sous-catégorie 3-1", "color": "rgb(197,163,202)", - "event_code": "drums" + "code": "drums" }, { "label": "sub cat 3-2", "full_label": "sous-catégorie 3-2", "color": "rgb(197,163,202)", - "event_code": "guitar" + "code": "guitar" } ] }, @@ -79,7 +79,7 @@ "label": "Annot'direct", "full_label": "catégorie 4", "color": "rgb(121,187,146)", - "event_code": "bass" + "code": "bass" } ] } \ No newline at end of file