1 define(['angular'], function (angular) {
4 angular.module('app.yangman').directive('ymInfoBox', infoBoxDirective);
6 infoBoxDirective.$inject = [];
8 function infoBoxDirective() {
11 templateUrl: 'src/app/yangman/views/directives/ym-info-box.tpl.html',
16 link: function (scope, element) {
17 element.addClass('info-box-container');
19 controller: function ($scope) {
20 var description = $scope.node.getChildren('description', null, null, 'label')[0];
22 $scope.description = description ? description : '';
23 $scope.infoBox = false;
26 $scope.dividerCheck = dividerCheck;
27 $scope.executeInfoBox = executeInfoBox;
28 $scope.showBoxCheck = showBoxCheck;
31 * Set info box value - true, false
34 function executeInfoBox(value){
35 $scope.infoBox = value;
39 * Check if box info could be shown
40 * @returns {boolean|*}
42 function showBoxCheck(){
43 return $scope.infoBox && ($scope.description.length || $scope.node.augmentationId);
47 * Check for showing divider between different shown info
51 function dividerCheck(key){
52 return key ? $scope.description.length || $scope.node.augmentationId : $scope.description.length;