mitweb: move entity model to entity module
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 9 Jun 2017 18:33:08 +0000 (14:33 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 9 Jun 2017 18:33:08 +0000 (14:33 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

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

index 8cf648e..2f7c6f5 100644 (file)
 
 (function() {
        angular
-               .module('entities', ['ngSanitize', 'ui', 'model'])
+               .module('entities', ['ngSanitize', 'ui'])
+
+               .factory('Model', [ '$http', function($http) {
+                       return {
+
+                               loadEntity: function(id, cb, cbErr) {
+                                       $http.get('/api/entity/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
+                               loadEntityLinearization: function(id, cb, cbErr) {
+                                       $http.get('/api/linearization/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
+                               loadEntityDefs: function(id, cb, cbErr) {
+                                       $http.get('/api/defs/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
+                               loadEntityCode: function(id, cb, cbErr) {
+                                       $http.get('/api/code/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
+                               loadEntityGraph: function(id, cb, cbErr) {
+                                       $http.get('/api/graph/inheritance/' + id + '?cdepth=3')
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
+                               search: function(q, n, cb, cbErr) {
+                                       $http.get('/api/search?q=' + q + '&n=' + n)
+                                               .success(cb)
+                                               .error(cbErr);
+                               }
+                       };
+               }])
 
                .controller('EntityCtrl', ['Model', 'Metrics', 'Feedback', '$stateParams', '$scope', '$sce', function(Model, Metrics, Feedback, $stateParams, $scope, $sce) {
                        $scope.entityId = $stateParams.id;
index f29ac4c..eaa86b5 100644 (file)
        angular
                .module('model', [])
 
-               .factory('Model', [ '$http', function($http) {
-                       return {
-
-                               loadEntity: function(id, cb, cbErr) {
-                                       $http.get(apiUrl + '/entity/' + id)
-                                               .success(cb)
-                                               .error(cbErr);
-                               },
-
-                               loadEntityLinearization: function(id, cb, cbErr) {
-                                       $http.get(apiUrl + '/linearization/' + id)
-                                               .success(cb)
-                                               .error(cbErr);
-                               },
-
-                               loadEntityDefs: function(id, cb, cbErr) {
-                                       $http.get(apiUrl + '/defs/' + id)
-                                               .success(cb)
-                                               .error(cbErr);
-                               },
-
-                               loadEntityCode: function(id, cb, cbErr) {
-                                       $http.get(apiUrl + '/code/' + id)
-                                               .success(cb)
-                                               .error(cbErr);
-                               },
-
-                               loadEntityGraph: function(id, cb, cbErr) {
-                                       $http.get(apiUrl + '/graph/inheritance/' + id + '?cdepth=3')
-                                               .success(cb)
-                                               .error(cbErr);
-                               },
-
-                               search: function(q, n, cb, cbErr) {
-                                       $http.get(apiUrl + '/search?q=' + q + '&n=' + n)
-                                               .success(cb)
-                                               .error(cbErr);
-                               }
-                       };
-               }])
-
                .factory('Feedback', [ '$http', function($http) {
                        return {
                                loadEntityStars: function(id, cb, cbErr) {