sync
[roojs1] / Roo / bootstrap / Img.js
1 /*
2  * - LGPL
3  *
4  * image
5  * 
6  */
7
8
9 /**
10  * @class Roo.bootstrap.Img
11  * @extends Roo.bootstrap.Component
12  * Bootstrap Img class
13  * @cfg {Boolean} imgResponsive false | true
14  * @cfg {String} border rounded | circle | thumbnail
15  * @cfg {String} src image source
16  * @cfg {String} alt image alternative text
17  * 
18  * @constructor
19  * Create a new Input
20  * @param {Object} config The config object
21  */
22
23 Roo.bootstrap.Img = function(config){
24     Roo.bootstrap.Img.superclass.constructor.call(this, config);
25 };
26
27 Roo.extend(Roo.bootstrap.Img, Roo.bootstrap.Component,  {
28     
29     imgResponsive: true,
30     border: '',
31     src: '',
32
33     getAutoCreate : function(){
34         
35         cfg = {
36             tag: 'img',
37             cls: 'img-responsive',
38             html : null
39         }
40         
41         cfg.html = this.html || cfg.html;
42         
43         cfg.src = this.src || cfg.src;
44         
45         if (['rounded','circle','thumbnail'].indexOf(this.border)>-1) {
46             cfg.cls += ' img-' + this.border;
47         }
48         
49         if(this.alt){
50             cfg.alt = this.alt;
51         }
52         
53         return cfg;
54     }
55    
56 });
57
58