all files / app/core/directives/ms-info-bar/ ms-info-bar.directive.js

36.36% Statements 4/11
100% Branches 0/0
25% Functions 1/4
36.36% Lines 4/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40                                                                        
(function ()
{
    'use strict';
 
    angular
        .module('app.core')
        .directive('msInfoBar', msInfoBarDirective);
 
    /** @ngInject */
    function msInfoBarDirective($document)
    {
        return {
            restrict   : 'E',
            scope      : {},
            transclude : true,
            templateUrl: 'app/core/directives/ms-info-bar/ms-info-bar.html',
            link       : function (scope, iElement)
            {
                var body = $document.find('body'),
                    bodyClass = 'ms-info-bar-active';
 
                // Add body class
                body.addClass(bodyClass);
 
                /**
                 * Remove the info bar
                 */
                function removeInfoBar()
                {
                    body.removeClass(bodyClass);
                    iElement.remove();
                    scope.$destroy();
                }
 
                // Expose functions
                scope.removeInfoBar = removeInfoBar;
            }
        };
    }
})();