UNPKG

zettapi_client

Version:

Client side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project

7 lines 2.84 kB
/*! angular-inform v0.0.18 (c) 2014 (null) McNull https://github.com/McNull/angular-inform License: MIT */ !function(t){var e=t.module("inform",[]);e.controller("InformCtrl",["$scope","inform",function(t,e){t.messages=e.messages(),t.remove=e.remove,t.cancelTimeout=e.cancelTimeout,t.setTimeout=e.setTimeout}]),e.directive("inform",function(){return{restrict:"AE",templateUrl:"angular-inform/directive.ng.html",controller:"InformCtrl"}}),e.provider("inform",function(){var e=this;this._defaults={type:"default",ttl:5e3},this.defaults=function(n){return e._defaults=t.extend(e._defaults,n||{}),e._defaults},this.$get=["$timeout","$sce",function(n,r){function o(t){for(var e=m.length;e--;)if(t(m[e]))return e;return-1}function i(t){t.timeout&&(n.cancel(t.timeout),delete t.timeout)}function s(t){i(t),t.ttl>0&&(t.timeout=n(function(){u(t)},t.ttl))}function c(n,i){var c=t.extend({},e._defaults,i);t.isString(n)||(n="<pre><code>"+JSON.stringify(n,null," ")+"</code></pre>",c.html=!0);var u=o(function(t){return t.content.toString()===n&&t.type==c.type});return u>=0?(c=m[u],c.count+=1):(c.content=n,c.html&&(c.content=r.trustAsHtml(n)),c.tickCount=+new Date,c.count=1,m.push(c)),s(c),c}function u(t){var e=o(function(e){return e===t});e>=0&&(m.splice(e,1),i(t))}function a(){m.length=0}var m=[];return{messages:function(){return m},add:c,remove:u,clear:a,cancelTimeout:i,setTimeout:s}}]}),t.module("inform-exception",["inform"]).config(["$provide",function(t){t.decorator("$exceptionHandler",["$delegate","$injector",function(t,e){var n;return function(r,o){try{n=n||e.get("inform"),n.add(r.toString(),{type:"danger",ttl:0})}catch(i){console.log("$exceptionHandler",i)}t(r,o)}}])}]),t.module("inform-http-exception",["inform"]).factory("informHttpInterceptor",["$q","inform",function(t,e){function n(n){try{var r="Network error ("+n.status+"): "+n.statusText;e.add(r,{type:"danger",ttl:0})}catch(o){console.log("$httpProvider",o)}return t.reject(n)}return{requestError:n,responseError:n}}]).config(["$httpProvider",function(t){t.interceptors.push("informHttpInterceptor")}]),t.module("inform").run(["$templateCache",function(t){t.put("angular-inform/directive.ng.html",'<div class="inform"><div ng-repeat="msg in messages | orderBy:\'-tickCount\'" class="inform-message-wrap"><div class="inform-message alert alert-{{ msg.type }} alert-dismissible" role="alert" ng-mouseenter="cancelTimeout(msg)" ng-mouseleave="setTimeout(msg)"><button type="button" class="close" ng-click="remove(msg)"><span>&times;</span></button> <span class="inform-message-content"><span class="badge inform-badge" ng-if="msg.count > 1">{{ msg.count }}</span> <span ng-if="msg.html" ng-bind-html="msg.content"></span> <span ng-if="!msg.html" ng-bind="msg.content"></span></span></div></div></div>')}])}(angular); //# sourceMappingURL=angular-inform.min.js.map