forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							53 lines
						
					
					
						
							1.5 KiB
						
					
					
				
			
		
		
	
	
							53 lines
						
					
					
						
							1.5 KiB
						
					
					
				evoapp.directive('inlineAlert', function (globals) {
 | 
						|
 | 
						|
    return {
 | 
						|
        require:'ngModel',
 | 
						|
        require: '^ngController',
 | 
						|
        restrict: 'AE',
 | 
						|
        template:   
 | 
						|
            '<div class="{{cssClass}} p-10">' +
 | 
						|
            '    <span class="glyphicon glyphicon-warning-sign"></span>' +
 | 
						|
            '    <span class="text-sm" ng-bind="message"></span>' +
 | 
						|
            '</div>',
 | 
						|
        scope: {
 | 
						|
            message: '@',
 | 
						|
            cssClass: '@'
 | 
						|
        },
 | 
						|
        link: function (scope, elem, attrs, controller) {
 | 
						|
 | 
						|
            scope.message = attrs.message != undefined ? attrs.message : null;
 | 
						|
            scope.cssClass = attrs.cssClass != null ? attrs.cssClass : null;
 | 
						|
 | 
						|
            scope.domEl = $(elem);
 | 
						|
 | 
						|
            scope.domEl.hide();
 | 
						|
 | 
						|
            scope.isVisible = false;
 | 
						|
 | 
						|
            scope.show = function () {
 | 
						|
                scope.domEl.show();
 | 
						|
 | 
						|
                scope.isVisible = true;
 | 
						|
            };
 | 
						|
 | 
						|
            scope.hide = function () {
 | 
						|
                scope.domEl.hide();
 | 
						|
 | 
						|
                scope.isVisible = false;
 | 
						|
            };
 | 
						|
 | 
						|
            if (attrs.itemId != undefined) {
 | 
						|
                //add reference to this inlineAlert, in parent controller
 | 
						|
                if (scope.$parent[attrs.itemId] == undefined) {
 | 
						|
                    scope.$parent[attrs.itemId] = scope;
 | 
						|
                }
 | 
						|
                else {
 | 
						|
                    //throw Error('inlineAlert ' + attrs.itemId + ' already exists!');
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
        }
 | 
						|
    }
 | 
						|
});
 | 
						|
 |