nitweb/angular: introduce entity-location directive
[nit.git] / share / nitweb / javascripts / entities.js
index 820af42..c689277 100644 (file)
 
 (function() {
        angular
-               .module('entities', ['model', 'ui'])
+               .module('entities', ['model'])
+
+               .controller('EntityCtrl', ['Model', '$routeParams', '$scope', function(Model, $routeParams, $scope) {
+                       Model.loadEntity($routeParams.id,
+                               function(data) {
+                                       $scope.mentity = data;
+                               }, function(err) {
+                                       $scope.error = err;
+                               });
+               }])
 
                .directive('entityLink', function() {
                        return {
                                templateUrl: '/directives/entity/signature.html'
                        };
                })
+
+               .directive('entityTag', function() {
+                       return {
+                               restrict: 'E',
+                               scope: {
+                                       mentity: '='
+                               },
+                               replace: true,
+                               templateUrl: '/directives/entity/tag.html'
+                       };
+               })
+
+               .directive('entityLocation', function() {
+                       return {
+                               restrict: 'E',
+                               scope: {
+                                       mentity: '='
+                               },
+                               templateUrl: '/directives/entity/location.html'
+                       };
+               })
 })();