Roo/bootstrap/Modal.js
authorEdward <edward@roojs.com>
Mon, 27 Apr 2015 03:11:02 +0000 (11:11 +0800)
committerEdward <edward@roojs.com>
Mon, 27 Apr 2015 03:11:02 +0000 (11:11 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/Modal.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index a4ba780..f23bbd5 100644 (file)
@@ -247,22 +247,22 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     },
     hide : function()
     {
-        if(this.fireEvent("beforehide", this) === false){
-            return;
+        if(this.fireEvent("beforehide", this) !== false){
+            this.maskEl.hide();
+            Roo.get(document.body).removeClass("x-body-masked");
+            this.el.removeClass('in');
+
+            if(this.animate){
+                var _this = this;
+                (function(){ _this.el.setStyle('display', 'none'); }).defer(150);
+            }else{
+                this.el.setStyle('display', 'none');
+            }
+
+            this.fireEvent('hide', this);
         }
         
-        this.maskEl.hide();
-        Roo.get(document.body).removeClass("x-body-masked");
-        this.el.removeClass('in');
-        
-        if(this.animate){
-            var _this = this;
-            (function(){ _this.el.setStyle('display', 'none'); }).defer(150);
-        }else{
-            this.el.setStyle('display', 'none');
-        }
         
-        this.fireEvent('hide', this);
     },
     
     addButton : function(str, cb)
index 31dad4c..c5f6bad 100644 (file)
@@ -2275,22 +2275,22 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     },
     hide : function()
     {
-        if(this.fireEvent("beforehide", this) === false){
-            return;
+        if(this.fireEvent("beforehide", this) !== false){
+            this.maskEl.hide();
+            Roo.get(document.body).removeClass("x-body-masked");
+            this.el.removeClass('in');
+
+            if(this.animate){
+                var _this = this;
+                (function(){ _this.el.setStyle('display', 'none'); }).defer(150);
+            }else{
+                this.el.setStyle('display', 'none');
+            }
+
+            this.fireEvent('hide', this);
         }
         
-        this.maskEl.hide();
-        Roo.get(document.body).removeClass("x-body-masked");
-        this.el.removeClass('in');
         
-        if(this.animate){
-            var _this = this;
-            (function(){ _this.el.setStyle('display', 'none'); }).defer(150);
-        }else{
-            this.el.setStyle('display', 'none');
-        }
-        
-        this.fireEvent('hide', this);
     },
     
     addButton : function(str, cb)
index b61c9cb..bca5cf8 100644 (file)
@@ -60,9 +60,8 @@ this.el=Roo.get(document.body).createChild(B,A);}if(this.tabIndex!==undefined){t
 this.maskEl=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-dlg-mask"},true);this.maskEl.enableDisplayMode("block");this.maskEl.hide();if(this.buttons.length){Roo.each(this.buttons,function(bb){b=Roo.apply({},bb);b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';if(typeof(b.listeners)=='undefined'){b.listeners={click:this.onButtonClick.createDelegate(this)};}var E=Roo.factory(b);E.onRender(this.el.select('.modal-footer div').first());},this);}var C=[];if(typeof(this.items)!='undefined'){var D=this.items;delete this.items;for(var i=0;i<D.length;i++){C.push(this.addxtype(Roo.apply({},D[i])));}}
 this.items=C;this.body=this.el.select('.modal-body',true).first();this.close=this.el.select('.modal-header .close',true).first();this.footer=this.el.select('.modal-footer',true).first();this.initEvents();},getAutoCreate:function(){var A={cls:'modal-body',html:this.html||''};var B={tag:'h4',cls:'modal-title',html:this.title};if(this.specificTitle){B=this.title;};var C={cls:"modal",style:'display: none',cn:[{cls:"modal-dialog",cn:[{cls:"modal-content",cn:[{cls:'modal-header',cn:[{tag:'button',cls:'close',html:'&times'},B]},A,{cls:'modal-footer',cn:[{tag:'div',cls:'btn-'+this.buttonPosition}]}]}]}]};if(this.animate){C.cls+=' fade';}return C;},getChildContainer:function(){return this.el.select('.modal-body',true).first();},getButtonContainer:function(){return this.el.select('.modal-footer div',true).first();},initEvents:function(){this.el.select('.modal-header .close').on('click',this.hide,this);},show:function(){if(!this.rendered){this.render();}
 this.el.setStyle('display','block');if(this.animate){var A=this;(function(){A.el.addClass('in');}).defer(50);}else {this.el.addClass('in');}
-Roo.get(document.body).addClass("x-body-masked");this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.show();this.el.setStyle('zIndex','10001');this.fireEvent('show',this);},hide:function(){if(this.fireEvent("beforehide",this)===false){return;}
-this.maskEl.hide();Roo.get(document.body).removeClass("x-body-masked");this.el.removeClass('in');if(this.animate){var A=this;(function(){A.el.setStyle('display','none');}).defer(150);}else {this.el.setStyle('display','none');}
-this.fireEvent('hide',this);},addButton:function(A,cb){var b=Roo.apply({},{html:A});b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';if(typeof(b.listeners)=='undefined'){b.listeners={click:cb.createDelegate(this)};}var B=Roo.factory(b);B.onRender(this.el.select('.modal-footer div').first());return B;},setDefaultButton:function(A){},resizeTo:function(w,h){},setContentSize:function(w,h){},onButtonClick:function(A,e){this.fireEvent('btnclick',A.name,e);},setTitle:function(A){this.el.select('.modal-title',true).first().dom.innerHTML=A;}});Roo.apply(Roo.bootstrap.Modal,{OK:[{name:'ok',weight:'primary',html:'OK'}],YESNO:[{name:'no',html:'No'},{name:'yes',weight:'primary',html:'Yes'}],OKCANCEL:[{name:'cancel',html:'Cancel'},{name:'ok',weight:'primary',html:'OK'}],YESNOCANCEL:[{name:'yes',weight:'primary',html:'Yes'},{name:'no',html:'No'},{name:'cancel',html:'Cancel'}]});
+Roo.get(document.body).addClass("x-body-masked");this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.show();this.el.setStyle('zIndex','10001');this.fireEvent('show',this);},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.maskEl.hide();Roo.get(document.body).removeClass("x-body-masked");this.el.removeClass('in');if(this.animate){var A=this;(function(){A.el.setStyle('display','none');}).defer(150);}else {this.el.setStyle('display','none');}
+this.fireEvent('hide',this);}},addButton:function(A,cb){var b=Roo.apply({},{html:A});b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';if(typeof(b.listeners)=='undefined'){b.listeners={click:cb.createDelegate(this)};}var B=Roo.factory(b);B.onRender(this.el.select('.modal-footer div').first());return B;},setDefaultButton:function(A){},resizeTo:function(w,h){},setContentSize:function(w,h){},onButtonClick:function(A,e){this.fireEvent('btnclick',A.name,e);},setTitle:function(A){this.el.select('.modal-title',true).first().dom.innerHTML=A;}});Roo.apply(Roo.bootstrap.Modal,{OK:[{name:'ok',weight:'primary',html:'OK'}],YESNO:[{name:'no',html:'No'},{name:'yes',weight:'primary',html:'Yes'}],OKCANCEL:[{name:'cancel',html:'Cancel'},{name:'ok',weight:'primary',html:'OK'}],YESNOCANCEL:[{name:'yes',weight:'primary',html:'Yes'},{name:'no',html:'No'},{name:'cancel',html:'Cancel'}]});
 //Roo/bootstrap/MessageBox.js
 Roo.bootstrap.MessageBox=function(){var A,B,C,D;var E,F,G,H,I,pp;var J,K,L;var M=function(Q){A.hide();Roo.callback(B.fn,B.scope||window,[Q,K.dom.value],1);};var N=function(){if(B&&B.cls){A.el.removeClass(B.cls);}};var O=function(b){var Q=0;if(!b){J["ok"].hide();J["cancel"].hide();J["yes"].hide();J["no"].hide();return Q;}
 A.footer.dom.style.display='';for(var k in J){if(typeof J[k]!="function"){if(b[k]){J[k].show();J[k].setText(typeof b[k]=="string"?b[k]:Roo.bootstrap.MessageBox.buttonText[k]);Q+=J[k].el.getWidth()+15;}else {J[k].hide();}}}return Q;};var P=function(d,k,e){if(B&&B.closable!==false){A.hide();}if(e){e.stopEvent();}};return {getDialog:function(){if(!A){A=new Roo.bootstrap.Modal({closeClick:function(){if(B&&B.buttons&&B.buttons.no&&!B.buttons.cancel){M("no");}else {M("cancel");}}});A.render();A.on("hide",N);C=A.mask;J={};this.buttons=J;var bt=this.buttonText;J["ok"]=A.addButton(bt["ok"],M.createCallback("ok"));J["yes"]=A.addButton(bt["yes"],M.createCallback("yes"));J["no"]=A.addButton(bt["no"],M.createCallback("no"));J["cancel"]=A.addButton(bt["cancel"],M.createCallback("cancel"));Roo.log(J)