nitweb/angular: add linearization to model
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 7 Jun 2016 13:38:38 +0000 (09:38 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 7 Jun 2016 15:56:36 +0000 (11:56 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitweb/javascripts/entities.js
share/nitweb/javascripts/model.js

index 9d9a452..c54f515 100644 (file)
                .module('entities', ['ui', 'model'])
 
                .controller('EntityCtrl', ['Model', '$routeParams', '$scope', function(Model, $routeParams, $scope) {
+                       this.loadEntityLinearization = function() {
+                               Model.loadEntityLinearization($routeParams.id,
+                                       function(data) {
+                                               $scope.linearization = data;
+                                       }, function(err) {
+                                               $scope.error = err;
+                                       });
+                       };
+
                        Model.loadEntity($routeParams.id,
                                function(data) {
                                        $scope.mentity = data;
index 3bf927c..aae3cae 100644 (file)
                                                .error(cbErr);
                                },
 
+                               loadEntityLinearization: function(id, cb, cbErr) {
+                                       $http.get(apiUrl + '/linearization/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
                                search: function(q, n, cb, cbErr) {
                                        $http.get(apiUrl + '/search?q=' + q + '&n=' + n)
                                                .success(cb)