client/app/app.js
author ymh <ymh.work@gmail.com>
Tue, 14 Oct 2014 08:12:54 +0200
changeset 23 16a1925df2df
parent 11 c0f9f9ab2a8a
child 27 68b29e36c9a2
permissions -rw-r--r--
add status to annotation creation. Improve error management for annotation creation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     1
(function(){
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     2
    'use strict';
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     3
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     4
    angular.module('mons', [ 'ngResource', 'ngRoute', 'autocomplete' ])
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     5
        .config(function($routeProvider) {
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     6
            $routeProvider.
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     7
                when('/', {
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     8
                    controller: 'homeCtrl'
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
     9
               }).
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    10
               otherwise({
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    11
                   redirectTo: '/'
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    12
               });
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    13
        })
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    14
        .config(function($logProvider){
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    15
            $logProvider.debugEnabled(true);
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    16
        })
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    17
        .service('dataApi', function($resource, context) {
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    18
            console.log('dataApi',$resource, context);
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    19
            this.dataResource = $resource(context.urls.dataUrl);
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    20
        })
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    21
        .service('dataModel', function(dataApi) {
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    22
            //console.log('dataModel',this,dataApi);
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    23
            this.data = dataApi.dataResource.get();
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    24
        })
9
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    25
        .controller('homeCtrl', function($scope, $location, dataModel, context, $interval){
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    26
            //console.log('homeCtrl 1', $scope, $location, context);
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    27
            console.log('homeCtrl 2', context);
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    28
            $scope.data = dataModel.data;
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
    29
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    30
            dataModel.data.$promise.then(function(data) {
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    31
                if(typeof data.categories!=='undefined' && data.categories.length>0){
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    32
                    var cats = [];
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    33
                    var nbCat = data.categories.length;
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    34
                    for(var i=0;i<nbCat;i++){
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    35
                        cats.push(data.categories[i].label);
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    36
                        if(typeof data.categories[i].subcategories!=='undefined' && data.categories[i].subcategories.length>0){
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    37
                            var nbSubCat = data.categories[i].subcategories.length;
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    38
                            for(var j=0;j<nbSubCat;j++){
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    39
                                cats.push(data.categories[i].subcategories[j].label);
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    40
                            }
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    41
                        }
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    42
                    }
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    43
                    $scope.allCatLabels = cats;
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    44
                }
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    45
            });
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
    46
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
    47
            $scope.selectedlevel = false;
9
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    48
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    49
            $scope.currentInterval = false;
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    50
            $scope.showSuccessAlert = false;
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    51
            $scope.showAlertDiv = false;
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    52
            function showAlert(m, success){
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    53
                $scope.alertMessage = m;
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    54
                $scope.showSuccessAlert = success;
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    55
                $scope.showAlertDiv = true;
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    56
                if(!$scope.$$phase) {
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    57
                    $scope.$apply();
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    58
                }
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    59
                if($scope.currentInterval){
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    60
                    $interval.cancel($scope.currentInterval);
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    61
                    $scope.currentInterval = false;
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    62
                }
10
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
    63
                $scope.currentInterval = $interval(function(){ $interval.cancel($scope.currentInterval); $scope.showAlertDiv = false; }, 2000, 1);
9
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
    64
            }
10
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
    65
            $scope.annotPile = [];
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
    66
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
    67
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    68
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    69
            // Socket management
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    70
            var sock = null;
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    71
            var ellog = null;
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
    72
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    73
            ellog = document.getElementById('log');
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    74
            function log(m) {
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
    75
                if(ellog){
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
    76
                    ellog.innerHTML += m + '\n';
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
    77
                    ellog.scrollTop = ellog.scrollHeight;
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
    78
                }
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    79
            }
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    80
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    81
            var wsuri;
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    82
            if (window.location.protocol === 'file:') {
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    83
                wsuri = 'ws://127.0.0.1:8090/annot';
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    84
            } else {
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    85
                wsuri = 'ws://' + window.location.hostname + ':8090/annot';
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    86
            }
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    87
            wsuri = wsuri + '?event=test';
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    88
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    89
            if ('WebSocket' in window) {
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    90
                sock = new WebSocket(wsuri);
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    91
            } else if ('MozWebSocket' in window) {
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    92
                sock = new window.MozWebSocket(wsuri);
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    93
            } else {
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
    94
                if(context.logging===true){
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
    95
                    log('Browser does not support WebSocket!');
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
    96
                }
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    97
                window.location = 'http://autobahn.ws/unsupportedbrowser';
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
    98
            }
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
    99
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   100
            if (sock) {
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   101
                sock.onopen = function() {
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   102
                    if(context.logging===true){
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   103
                        log('Connected to ' + wsuri);
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   104
                    }
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   105
                };
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   106
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   107
                sock.onclose = function(e) {
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   108
                    if(context.logging===true){
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   109
                        log('Connection closed (wasClean = ' + e.wasClean + ', code = ' + e.code + ', reason = ' + e.reason + ')');
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   110
                    }
9
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
   111
                    showAlert('Communication interrompue : la socket vient de se fermer.', false);
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   112
                    sock = null;
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   113
                };
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   114
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   115
                sock.onmessage = function(e) {
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
   116
                    if(context.logging){
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
   117
                        console.log('Got message: ', e.data);
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   118
                    }
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
   119
                    var data_json = JSON.parse(e.data)
10
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   120
                    //showAlert('Annotation bien reçue.', true);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   121
                    console.log('2 message', $scope.annotPile.length);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   122
                    if($scope.annotPile.length>0){
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   123
                        var c = $scope.annotPile.shift();
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   124
                        console.log('3 message', c);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   125
                        var i;
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   126
                        if(c===false){
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   127
                            //showAlert('Annotation envoyée.', true);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   128
                            $scope.sendBtnSuccess = true;
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   129
                            i = $interval(function(){ $interval.cancel(i); $scope.sendBtnSuccess = false; }, 2000, 1);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   130
                        }
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   131
                        else{
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   132
                            c.sendSuccess = true;
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   133
                            i = $interval(function(){ $interval.cancel(i); c.sendSuccess = false; }, 2000, 1);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   134
                        }
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   135
                        if(!$scope.$$phase) {
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   136
                            $scope.$apply();
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   137
                        }
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   138
                    }
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   139
                };
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   140
            }
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   141
11
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   142
            $scope.sendAnnotation = function(label, code, c){
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   143
                if($scope.username==='' || typeof $scope.username==='undefined'){
9
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
   144
                    showAlert('Vous devez indiquer un nom d\'utilisateur.', false);
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   145
                    return;
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   146
                }
11
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   147
                if(label==='' || typeof label==='undefined'){
9
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
   148
                    showAlert('Vous devez indiquer un nom de catégorie.', false);
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   149
                    return;
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   150
                }
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   151
                // Send query
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   152
                if (sock) {
11
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   153
                    if(typeof code==='undefined' || code===''){
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   154
                        code = window.S(label).slugify().s;
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   155
                    }
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   156
                    var new_annot = {
11
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   157
                            category: {code: code, label: label},
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   158
                            user : $scope.username
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   159
                    };
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   160
                    sock.send(JSON.stringify(new_annot));
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   161
                    if(context.logging===true){
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   162
                        log('Sent: ' + JSON.stringify(new_annot));
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   163
                    }
10
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   164
                    if(typeof c==='undefined'){
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   165
                        $scope.annotPile.push(false);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   166
                    }
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   167
                    else{
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   168
                        $scope.annotPile.push(c);
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   169
                    }
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   170
                } else {
9
ae8a74bd6add alert system for feedback
cavaliet
parents: 7
diff changeset
   171
                    showAlert('La socket ne fonctionne pas.', false);
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   172
                    if(context.logging===true){
7
813fec862542 little correction
cavaliet
parents: 6
diff changeset
   173
                        log('Not connected.');
6
c53e9b24f93f loggin in annotation client depends on a boolean
cavaliet
parents: 5
diff changeset
   174
                    }
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   175
                }
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   176
            };
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
   177
5
90a7c431b979 first step of working annotation real annotation client
cavaliet
parents: 1
diff changeset
   178
            // Interface management
11
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   179
            $scope.selectLevel = function(label, code, c){
10
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   180
                if(typeof c==='undefined'){
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   181
                    $scope.returnVisStyle = {visibility:'hidden'};
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   182
                    $scope.selectedlevel = false;
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   183
                    return;
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   184
                }
10
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   185
                if(typeof c.subcategories!=='undefined' && c.subcategories.length>0){
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   186
                    $scope.selectedlevel = c.subcategories;
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   187
                    $scope.returnVisStyle = {visibility:'show'};
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   188
                }
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   189
                else{
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   190
                    // Send query
10
90918426079c better feedback after annotation sent
cavaliet
parents: 9
diff changeset
   191
                    console.log('send ntm', c);
11
c0f9f9ab2a8a clean messages and error.
cavaliet
parents: 10
diff changeset
   192
                    $scope.sendAnnotation(label, code, c);
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   193
                }
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   194
            };
23
16a1925df2df add status to annotation creation. Improve error management for annotation creation
ymh <ymh.work@gmail.com>
parents: 11
diff changeset
   195
1
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   196
        });
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   197
1cdebfeb77f9 add client folder and update hgignore
cavaliet
parents:
diff changeset
   198
})();