nitweb/ng: clean card css
[nit.git] / share / nitweb / javascripts / entities.js
index 3fd473f..98903e7 100644 (file)
                        return {
                                restrict: 'E',
                                scope: {
-                                       mentity: '='
+                                       namespace: '='
                                },
-                               templateUrl: '/directives/entity/namespace.html'
+                               templateUrl: '/directives/entity/namespace.html',
+                               link: function ($scope, element, attrs) {
+                                       $scope.isObject = function(obj) {
+                                               return typeof obj === 'object';
+                                       };
+                                       $scope.isArray = function(obj) {
+                                               return Array.isArray(obj);
+                                       };
+                                       $scope.isString = function(obj) {
+                                               return typeof obj === 'string';
+                                       };
+                               }
                        };
                })
 
                                restrict: 'E',
                                scope: {
                                        mentity: '=',
-                                       defaultTab: '@'
+                                       defaultTab: '@',
+                                       noSynopsis: '='
                                },
                                replace: true,
                                templateUrl: '/directives/entity/card.html',
                                templateUrl: '/directives/entity/defcard.html',
                                link: function ($scope, element, attrs) {
                                        $scope.codeId = 'code_' + $scope.definition.full_name.replace(/[^a-zA-Z0-9]/g, '_');
+
+                                       $scope.isActive = function() {
+                                               return $scope.focus.full_name == $scope.definition.full_name;
+                                       }
+
                                        $scope.loadCardCode = function() {
                                                if(!$scope.code) {
                                                        Model.loadEntityCode($scope.definition.full_name,
                                                        }
                                                }
                                        };
+
+                                       if($scope.isActive()) $scope.loadCardCode();
                                }
                        };
                }])