From 353322d9ed43724af08e414b5cca86731bbf0990 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 9 Jun 2017 14:33:08 -0400 Subject: [PATCH] mitweb: move entity model to entity module Signed-off-by: Alexandre Terrasa --- share/nitweb/javascripts/entities.js | 43 +++++++++++++++++++++++++++++++++- share/nitweb/javascripts/model.js | 41 -------------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/share/nitweb/javascripts/entities.js b/share/nitweb/javascripts/entities.js index 8cf648e..2f7c6f5 100644 --- a/share/nitweb/javascripts/entities.js +++ b/share/nitweb/javascripts/entities.js @@ -16,7 +16,48 @@ (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; diff --git a/share/nitweb/javascripts/model.js b/share/nitweb/javascripts/model.js index f29ac4c..eaa86b5 100644 --- a/share/nitweb/javascripts/model.js +++ b/share/nitweb/javascripts/model.js @@ -20,47 +20,6 @@ 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) { -- 1.7.9.5