+
+ .directive('entitySignature', function() {
+ return {
+ restrict: 'E',
+ scope: {
+ mentity: '='
+ },
+ 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'
+ };
+ })
+
+ .directive('entityCard', function() {
+ return {
+ restrict: 'E',
+ scope: {
+ mentity: '='
+ },
+ replace: true,
+ templateUrl: '/directives/entity/card.html'
+ };
+ })
+
+ .directive('entityList', function() {
+ return {
+ restrict: 'E',
+ scope: {
+ listEntities: '=',
+ listId: '@',
+ listTitle: '@',
+ listObjectFilter: '=',
+ },
+ templateUrl: '/directives/entity/list.html',
+ link: function ($scope, element, attrs) {
+ $scope.showFilters = false;
+ if(!$scope.listObjectFilter) {
+ $scope.listObjectFilter = {};
+ }
+ if(!$scope.visibilityFilter) {
+ $scope.visibilityFilter = {
+ public: true,
+ protected: true,
+ private: false
+ };
+ }
+ $scope.toggleFilters = function() {
+ $scope.showFilters = !$scope.showFilters;
+ };
+ }
+ };
+ })
+
+ .directive('entityLinearization', function() {
+ return {
+ restrict: 'E',
+ scope: {
+ listEntities: '=',
+ listTitle: '@',
+ listFocus: '='
+ },
+ templateUrl: '/directives/entity/linearization.html'
+ };
+ })
+
+ .directive('entityDef', ['Model', function(Model, Code) {
+ return {
+ restrict: 'E',
+ scope: {
+ definition: '=',
+ focus: '='
+ },
+ templateUrl: '/directives/entity/defcard.html',
+ link: function ($scope, element, attrs) {
+ $scope.codeId = 'code_' + $scope.definition.full_name.replace(/[^a-zA-Z0-9]/g, '_');
+ $scope.loadCardCode = function() {
+ if(!$scope.code) {
+ Model.loadEntityCode($scope.definition.full_name,
+ function(data) {
+ $scope.code = data;
+ setTimeout(function() { // smooth collapse
+ $('#' + $scope.codeId).collapse('show')
+ }, 1);
+ }, function(err) {
+ $scope.code = err;
+ });
+ } else {
+ if($('#' + $scope.codeId).hasClass('in')) {
+ $('#' + $scope.codeId).collapse('hide');
+ } else {
+ $('#' + $scope.codeId).collapse('show');
+ }
+ }
+ };
+ }
+ };
+ }])