1 |
- !function(){Bootstrap.GrowlNotifications=Ember.CollectionView.extend({classNames:["growl-notifications"],contentBinding:"Bootstrap.GNM.notifications",attributeBindings:["style"],showTime:1e4,itemViewClass:Ember.View.extend({classNames:["growl-notification"],template:Ember.Handlebars.compile('<span class="icon"><i class="fa {{unbound view.iconType}}"></i></span>\n<a class="close-notification" {{action "close" target="view"}}>\n <span style="font-size: 15px;"><i class="fa fa-times"></i></span>\n</a>\n<strong>\n {{view.content.title}}\n</strong>\n<p>\n {{view.content.sub}}\n</p>'),classNameBindings:[":growl-notification","content.closed","isOpaque"],attributeBindings:["style"],timeoutId:null,isOpaque:!1,init:function(){var a;return this._super(),a=function(){return this.notifyPropertyChange("style")}.bind(this),this.set("_recomputeStyle",a),$(window).bind("resize",a)},didInsertElement:function(){return this.set("timeoutId",setTimeout(function(){return this.send("close")}.bind(this),this.get("parentView.showTime"))),Ember.run.later(this,function(){return this.set("isOpaque",!0)},1)},willDestroyElement:function(){return $(window).unbind("resize",this.get("_recomputeStyle"))},style:function(){var a,b,c,d,e,f,g,h,i,j;return c=this.get("parentView.content").rejectProperty("closed",!0),b=c.indexOf(this.get("content")),j=$(window).height(),g=80,h=320,i=Math.floor(j/g),a=Math.floor(b/i),e=b%i,-1===b?"":(f=e*g,d=a*h,"top: "+f+"px; right: "+d+"px;")}.property("parentView.content.@each.closed"),iconType:function(){var a,b;return b=this.get("content.type"),a={info:"fa-bullhorn",success:"fa-check",warning:"fa-exclamation",danger:"fa-times"},a[b]||""}.property("content.type"),actions:{close:function(){return this.set("isOpaque",!1),setTimeout(function(){return this.get("parentView.content").removeObject(this.get("content")),clearTimeout(this.get("timeoutId"))}.bind(this),300)}}})}),Ember.Handlebars.helper("bs-growl-notifications",Bootstrap.GrowlNotifications),Bootstrap.GNM=Bootstrap.GrowlNotificationManager=Ember.Object.create({notifications:Ember.A(),push:function(a,b,c){var d;return c=null!=c?c:c="info",d=Bootstrap.Notification.create({title:a,sub:b,type:c,closed:!1}),this.get("notifications").pushObject(d)}}),Bootstrap.GrowlNotification=Ember.Object.extend()}.call(this);
|