From: Edward Date: Mon, 31 Mar 2014 10:51:26 +0000 (+0800) Subject: Roo/bootstrap/Button.js X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=787a846ed4d66d5cb5874a514bb8ec244761d640;p=roojs1 Roo/bootstrap/Button.js roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/Roo/bootstrap/Button.js b/Roo/bootstrap/Button.js index 861adc5d8a..a2267f9942 100644 --- a/Roo/bootstrap/Button.js +++ b/Roo/bootstrap/Button.js @@ -213,7 +213,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, { } ]; - cfg.html=''; +// cfg.html=''; } if (cfg.tag !== 'a' && this.href !== '') { diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 313ab8e4c2..3a4c1ef8c2 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -560,8 +560,8 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, { cfg.cn = [ { tag: 'span', - cls: 'glyphicon glyphicon-' + this.glyphicon, - html: this.html + cls: 'glyphicon glyphicon-' + this.glyphicon + }, { tag: 'span', @@ -570,7 +570,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, { } ]; - cfg.html=''; +// cfg.html=''; } if (cfg.tag !== 'a' && this.href !== '') { diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 3a89dbb14e..ac11cb31e9 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -12,7 +12,7 @@ A.html=this.html||A.html;if(this.toolbar){A={cls:'btn-toolbar',html:null};return //Roo/bootstrap/Button.js Roo.bootstrap.Button=function(A){Roo.bootstrap.Button.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Button,Roo.bootstrap.Component,{html:false,active:false,weight:'',size:'',tag:'button',href:'',disabled:false,isClose:false,glyphicon:'',badge:'',theme:'default',inverse:false,toggle:false,ontext:'ON',offtext:'OFF',defaulton:true,preventDefault:true,getAutoCreate:function(){var A={tag:'button',cls:'roo-button',html:'hello'};if(['a','button','input','submit'].indexOf(this.tag)<0){throw "Invalid value for tag: "+this.tag+". must be a, button, input or submit.";this.tag='button';}else {A.tag=this.tag;} A.html=this.html||A.html;if(this.toggle===true){A={tag:'div',cls:'slider-frame roo-button',cn:[{tag:'span','data-on-text':'ON','data-off-text':'OFF',cls:'slider-button',html:this.offtext}]};if(['default','primary','success','info','warning','danger','link'].indexOf(this.weight)>-1){A.cls+=' '+this.weight;}return A;}if(this.isClose){A.cls+=' close';A["aria-hidden"]=true;A.html="×";return A;}if(this.theme==='default'){A.cls='btn roo-button';if(this.parentType!='Navbar'){this.weight=this.weight.length?this.weight:'default';}if(['default','primary','success','info','warning','danger','link'].indexOf(this.weight)>-1){A.cls+=' btn-'+this.weight;}}else if(this.theme==='glow'){A.tag='a';A.cls='btn-glow roo-button';if(['default','primary','success','info','warning','danger','link'].indexOf(this.weight)>-1){A.cls+=' '+this.weight;}}if(this.inverse){this.cls+=' inverse';}if(this.active){A.cls+=' active';} -A.cls+=this.size.length?(' btn-'+this.size):'';if(this.parentType==='Navbar'){A.tag='li';A.cls='';A.cn=[{tag:'a',cls:'roo-button',html:this.html,href:this.href||'#'}];if(this.menu){A.cn[0].html=this.html+' ';A.cls+=' dropdown';}delete A.html;}else if(this.menu){A.tag='a';A.cls+=' dropdown test';}if(this.disabled){A.disabled='disabled';}if(this.items){Roo.log('changing to ul');A.tag='ul';this.glyphicon='caret';}if(this.glyphicon){A.html=' '+A.html;A.cn=[{tag:'span',cls:'glyphicon glyphicon-'+this.glyphicon}];}if(this.badge){A.html+=' ';A.tag='a';A.cls='btn roo-button';A.href=this.href;A.cn=[{tag:'span',cls:'glyphicon glyphicon-'+this.glyphicon,html:this.html},{tag:'span',cls:'badge',html:this.badge}];A.html='';}if(A.tag!=='a'&&this.href!==''){throw "Tag must be a to set href.";}else if(this.href.length>0){A.href=this.href;}return A;},initEvents:function(){if(this.el.hasClass('roo-button')){this.el.on('click',this.onClick,this);}else {this.el.select('.roo-button').on('click',this.onClick,this);}},onClick:function(e){Roo.log('button on click ');if(this.preventDefault){e.preventDefault();} +A.cls+=this.size.length?(' btn-'+this.size):'';if(this.parentType==='Navbar'){A.tag='li';A.cls='';A.cn=[{tag:'a',cls:'roo-button',html:this.html,href:this.href||'#'}];if(this.menu){A.cn[0].html=this.html+' ';A.cls+=' dropdown';}delete A.html;}else if(this.menu){A.tag='a';A.cls+=' dropdown test';}if(this.disabled){A.disabled='disabled';}if(this.items){Roo.log('changing to ul');A.tag='ul';this.glyphicon='caret';}if(this.glyphicon){A.html=' '+A.html;A.cn=[{tag:'span',cls:'glyphicon glyphicon-'+this.glyphicon}];}if(this.badge){A.html+=' ';A.tag='a';A.cls='btn roo-button';A.href=this.href;A.cn=[{tag:'span',cls:'glyphicon glyphicon-'+this.glyphicon},{tag:'span',cls:'badge',html:this.badge}];}if(A.tag!=='a'&&this.href!==''){throw "Tag must be a to set href.";}else if(this.href.length>0){A.href=this.href;}return A;},initEvents:function(){if(this.el.hasClass('roo-button')){this.el.on('click',this.onClick,this);}else {this.el.select('.roo-button').on('click',this.onClick,this);}},onClick:function(e){Roo.log('button on click ');if(this.preventDefault){e.preventDefault();} this.fireEvent('click',this,e);}}); //Roo/bootstrap/Column.js Roo.bootstrap.Column=function(A){Roo.bootstrap.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Column,Roo.bootstrap.Component,{xs:null,sm:null,md:null,lg:null,html:'',offset:0,getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.Column.superclass.getAutoCreate.call(this));A={tag:'div',cls:'column'};var B=this;['xs','sm','md','lg'].map(function(C){if(B[C]){A.cls+=' col-'+C+'-'+B[C];}});if(this.html.length){A.html=this.html;}return A;}});