1 |
- !function(){Bootstrap.BsModalComponent=Ember.Component.extend({layoutName:"components/bs-modal",classNames:["modal"],attributeBindings:["role","aria-labelledby","isAriaHidden:aria-hidden","ariaLabelledBy:aria-labelledby"],isAriaHidden:function(){return""+this.get("isVisible")}.property("isVisible"),modalBackdrop:'<div class="modal-backdrop fade in"></div>',role:"dialog",backdrop:!0,title:null,isVisible:!1,manual:!1,didInsertElement:function(){var a;return this._super(),this.setupBinders(),a=this.get("name"),Ember.assert("Modal name is required for modal view "+this.get("elementId"),this.get("name")),null==a&&(a=this.get("elementId")),Bootstrap.ModalManager.add(a,this),this.manual?this.show():void 0},becameVisible:function(){return this.get("backdrop")?this.appendBackdrop():void 0},becameHidden:function(){return this._backdrop?this._backdrop.remove():void 0},appendBackdrop:function(){var a;return a=this.$().parent(),this._backdrop=Em.$(this.modalBackdrop).appendTo(a)},show:function(){return this.set("isVisible",!0)},hide:function(){return this.set("isVisible",!1)},toggle:function(){return this.toggleProperty("isVisible")},click:function(a){var b,c;return b=a.target,c=b.getAttribute("data-dismiss"),"modal"===c?this.close():void 0},keyPressed:function(a){return 27===a.keyCode?this.close(a):void 0},close:function(){return this.get("manual")?this.destroy():this.hide()},willDestroyElement:function(){var a;return this.removeHandlers(),a=this.get("name"),null==a&&(a=this.get("elementId")),Bootstrap.ModalManager.remove(a,this),this._backdrop?this._backdrop.remove():void 0},removeHandlers:function(){return jQuery(window.document).unbind("keyup",this._keyUpHandler)},setupBinders:function(){var a,b=this;return a=function(a){return b.keyPressed(a)},jQuery(window.document).bind("keyup",a),this._keyUpHandler=a}}),Bootstrap.ModalManager=Ember.Object.create({add:function(a,b){return this.set(a,b)},remove:function(a){return this.set(a,null)},close:function(a){return this.get(a).close()},hide:function(a){return this.get(a).hide()},show:function(a){return this.get(a).show()},toggle:function(a){return this.get(a).toggle()},open:function(a,b,c,d,e){var f,g,h;return f=e.container.lookup("component-lookup:main"),g=f.lookupFactory("bs-modal",e.get("container")).create(),g.setProperties({name:a,title:b,manual:!0,footerButtons:d,targetObject:e}),"string"===Ember.typeOf(c)?(h=e.container.lookup("template:"+c),Ember.assert("Template "+c+" was specified for Modal but template could not be found.",h),h&&g.setProperties({body:Ember.View.extend({template:h,controller:e})})):"class"===Ember.typeOf(c)&&g.setProperties({body:c,controller:e}),g.appendTo(e.namespace.rootElement)}}),Ember.Application.initializer({name:"bs-modal",initialize:function(a){return a.register("component:bs-modal",Bootstrap.BsModalComponent)}})}.call(this),this.Ember=this.Ember||{},this.Ember.TEMPLATES=this.Ember.TEMPLATES||{},this.Ember.TEMPLATES["components/bs-modal"]=Ember.Handlebars.template(function(a,b,c,d,e){function f(a,b){var d,e,f="";return b.buffer.push("\n "),d={},e={},b.buffer.push(m(c.view.call(a,"view.body",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}function g(a,b){var d,e,f="";return b.buffer.push("\n "),d={},e={},b.buffer.push(m(c._triageMustache.call(a,"yield",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}function h(a,b){var d,e,f,g,h="";return b.buffer.push("\n "),e={content:a,targetObjectBinding:a},f={content:"ID",targetObjectBinding:"STRING"},g={hash:{content:"",targetObjectBinding:"view.targetObject"},contexts:[],types:[],hashContexts:e,hashTypes:f,data:b},b.buffer.push(m((d=c["bs-button"]||a["bs-button"],d?d.call(a,g):n.call(a,"bs-button",g)))),b.buffer.push("\n "),h}this.compilerInfo=[4,">= 1.0.0"],c=this.merge(c,Ember.Handlebars.helpers),e=e||{};var i,j,k,l="",m=this.escapeExpression,n=c.helperMissing,o=this;return e.buffer.push('<div class="modal-dialog">\n <div class="modal-content">\n <div class="modal-header">\n <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n <h4 class="modal-title">'),j={},k={},e.buffer.push(m(c._triageMustache.call(b,"title",{hash:{},contexts:[b],types:["ID"],hashContexts:k,hashTypes:j,data:e}))),e.buffer.push('</h4>\n </div>\n <div class="modal-body">\n '),j={},k={},i=c["if"].call(b,"body",{hash:{},inverse:o.program(3,g,e),fn:o.program(1,f,e),contexts:[b],types:["ID"],hashContexts:k,hashTypes:j,data:e}),(i||0===i)&&e.buffer.push(i),e.buffer.push('\n </div>\n <div class="modal-footer">\n '),j={},k={},i=c.each.call(b,"footerButtons",{hash:{},inverse:o.noop,fn:o.program(5,h,e),contexts:[b],types:["ID"],hashContexts:k,hashTypes:j,data:e}),(i||0===i)&&e.buffer.push(i),e.buffer.push("\n </div>\n </div>\n</div>"),l});
|