forked from patternfly/angular-patternfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular-patternfly.min.js
More file actions
1 lines (1 loc) · 1.58 KB
/
Copy pathangular-patternfly.min.js
File metadata and controls
1 lines (1 loc) · 1.58 KB
1
"use strict";angular.module("patternfly.buttons",[]).directive("pfBtnClear",function(){return{scope:{pfBtnClear:"&"},restrict:"A",link:function(scope,elem){elem.addClass("btn btn-default btn-lg"),elem.attr("type","button"),elem.bind("click",function(){scope.$apply(function(){scope.pfBtnClear()})})}}}),angular.module("patternfly.notification",[]).factory("Notifications",function($rootScope,$timeout,$log){var delay=5e3,notifications={};$rootScope.notifications={},$rootScope.notifications.data=[],$rootScope.notifications.remove=function(index){$rootScope.notifications.data.splice(index,1)};var scheduleMessagePop=function(){$timeout(function(){$rootScope.notifications.data.splice(0,1)},delay)};return $rootScope.notifications||($rootScope.notifications.data=[]),notifications.message=function(type,header,message){$rootScope.notifications.data.push({type:type,header:header,message:message}),scheduleMessagePop()},notifications.info=function(message){notifications.message("info","Info!",message),$log.info(message)},notifications.success=function(message){notifications.message("success","Success!",message),$log.info(message)},notifications.error=function(message){notifications.message("danger","Error!",message),$log.error(message)},notifications.warn=function(message){notifications.message("warning","Warning!",message),$log.warn(message)},notifications.httpError=function(message,httpResponse){message+=" ("+(httpResponse.data.message?httpResponse.data.message:httpResponse.data.cause?httpResponse.data.cause:"")+")",notifications.message("danger","Error!",message),$log.error(message)},notifications});