From: edward Date: Wed, 13 Jan 2016 03:59:50 +0000 (+0800) Subject: Roo/bootstrap/Img.js X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=fab07e4ff4b41b0add046cf68bec73f46850682f;p=roojs1 Roo/bootstrap/Img.js roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/Roo/bootstrap/Img.js b/Roo/bootstrap/Img.js index 8ec34746fd..72b436c740 100644 --- a/Roo/bootstrap/Img.js +++ b/Roo/bootstrap/Img.js @@ -80,6 +80,12 @@ Roo.extend(Roo.bootstrap.Img, Roo.bootstrap.Component, { img.cls += ' roo-image-responsive-' + size; + var s = ['xs', 'sm', 'md', 'lg']; + + Roo.eac(ss.splice(ss.indexOf(size), 1), function(ss){ + img.cls += ' hidden-' + ss; + }); + if (['rounded','circle','thumbnail'].indexOf(_this.border)>-1) { cfg.cls += ' img-' + _this.border; } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 7bd0d153fa..0c467ba709 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -1376,8 +1376,7 @@ Roo.extend(Roo.bootstrap.Img, Roo.bootstrap.Component, { var _this = this; Roo.each(['xs', 'sm', 'md', 'lg'], function(size){ - Roo.log(size); - Roo.log(_this[size + 'Url']); + if(!_this[size + 'Url']){ return; } @@ -1386,11 +1385,17 @@ Roo.extend(Roo.bootstrap.Img, Roo.bootstrap.Component, { tag: 'img', cls: (_this.imgResponsive) ? 'img-responsive' : '', html: _this.html || cfg.html, - src: _this[size] + src: _this[size + 'Url'] } img.cls += ' roo-image-responsive-' + size; + var s = ['xs', 'sm', 'md', 'lg']; + + Roo.eac(ss.splice(ss.indexOf(size), 1), function(ss){ + img.cls += ' hidden-' + ss; + }); + if (['rounded','circle','thumbnail'].indexOf(_this.border)>-1) { cfg.cls += ' img-' + _this.border; } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index bb2acbf024..49a975678b 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -36,8 +36,8 @@ A.removeClass(['fa-minus','fa-plus']).addClass(['fa-plus']);}},toggleEl:function A.dom.innerHTML=v;},getTitle:function(){var A=this.titleEl();if(!A){return '';}return A.dom.innerHTML;},setRightTitle:function(v){var t=this.el.select('.panel-header-right',true).first();if(!t){return;} t.dom.innerHTML=v;}}); //Roo/bootstrap/Img.js -Roo.bootstrap.Img=function(A){Roo.bootstrap.Img.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Img,Roo.bootstrap.Component,{imgResponsive:true,border:'',src:'',href:false,target:false,xsUrl:'',smUrl:'',mdUrl:'',lgUrl:'',getAutoCreate:function(){if(this.src||(!this.xsUrl&&!this.smUrl&&!this.mdUrl&&!this.lgUrl)){return this.createSingleImg();}var A={tag:'div',cls:'roo-image-responsive-group',cn:[]};var _this=this;Roo.each(['xs','sm','md','lg'],function(B){Roo.log(B);Roo.log(_this[B+'Url']);if(!_this[B+'Url']){return;}var C={tag:'img',cls:(_this.imgResponsive)?'img-responsive':'',html:_this.html||A.html,src:_this[B]} -C.cls+=' roo-image-responsive-'+B;if(['rounded','circle','thumbnail'].indexOf(_this.border)>-1){A.cls+=' img-'+_this.border;}if(_this.alt){A.alt=_this.alt;}if(_this.href){var a={tag:'a',href:_this.href,cn:[C]};if(this.target){a.target=_this.target;}} +Roo.bootstrap.Img=function(A){Roo.bootstrap.Img.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Img,Roo.bootstrap.Component,{imgResponsive:true,border:'',src:'',href:false,target:false,xsUrl:'',smUrl:'',mdUrl:'',lgUrl:'',getAutoCreate:function(){if(this.src||(!this.xsUrl&&!this.smUrl&&!this.mdUrl&&!this.lgUrl)){return this.createSingleImg();}var A={tag:'div',cls:'roo-image-responsive-group',cn:[]};var _this=this;Roo.each(['xs','sm','md','lg'],function(B){if(!_this[B+'Url']){return;}var C={tag:'img',cls:(_this.imgResponsive)?'img-responsive':'',html:_this.html||A.html,src:_this[B+'Url']} +C.cls+=' roo-image-responsive-'+B;var s=['xs','sm','md','lg'];Roo.eac(ss.splice(ss.indexOf(B),1),function(ss){C.cls+=' hidden-'+ss;});if(['rounded','circle','thumbnail'].indexOf(_this.border)>-1){A.cls+=' img-'+_this.border;}if(_this.alt){A.alt=_this.alt;}if(_this.href){var a={tag:'a',href:_this.href,cn:[C]};if(this.target){a.target=_this.target;}} A.cn.push((_this.href)?a:C);});return A;},createSingleImg:function(){var A={tag:'img',cls:(this.imgResponsive)?'img-responsive':'',html:null} A.html=this.html||A.html;A.src=this.src||A.src;if(['rounded','circle','thumbnail'].indexOf(this.border)>-1){A.cls+=' img-'+this.border;}if(this.alt){A.alt=this.alt;}if(this.href){var a={tag:'a',href:this.href,cn:[A]};if(this.target){a.target=this.target;}}return (this.href)?a:A;},initEvents:function(){if(!this.href){this.el.on('click',this.onClick,this);}},onClick:function(e){Roo.log('img onclick');this.fireEvent('click',this,e);}}); //Roo/bootstrap/Link.js