Roo/bootstrap/Progress.js
[roojs1] / Roo / bootstrap / Progress.js
1 /*
2  * - LGPL
3  *
4  * Progress
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Progress
10  * @extends Roo.bootstrap.Component
11  * Bootstrap Progress class
12  * @cfg {Number} aria_valuenow aria-value now
13  * @cfg {Number} aria_valuemin aria-value min
14  * @cfg {Number} aria_valuemax aria-value max
15  * @cfg {String} label label for the progress bar
16  * @cfg {String} panel (success | info | warning | danger )
17  * @cfg {String} role role of the progress bar
18  * @cfg {Boolean} striped striped of the progress bar
19  * @cfg {Boolean} active animated of the progress bar
20  * @cfg {String} sr_only text
21  * 
22  * 
23  * @constructor
24  * Create a new Progress
25  * @param {Object} config The config object
26  */
27
28 Roo.bootstrap.Progress = function(config){
29     Roo.bootstrap.Progress.superclass.constructor.call(this, config);
30 };
31
32 Roo.extend(Roo.bootstrap.Progress, Roo.bootstrap.Component,  {
33     
34     aria_valuenow : false,
35     aria_valuemin : 0,
36     aria_valuemax : 100,
37     label : false,
38     panel : false,
39     role : false,
40     striped : false,
41     active: false,
42     sr_only: false,
43     
44     getAutoCreate : function(){
45         var cfg = {
46             tag: 'div',
47             cls: 'progress',
48             cn: [
49                 {
50                     tag: 'div',
51                     cls: 'progress-bar'
52                 }
53             ]
54         };
55         
56         
57         if(this.striped){
58             cfg.cls += ' progress-striped';
59         }
60       
61         if(this.active){
62             cfg.cls += ' active';
63         }
64         
65         if(this.sr_only){
66             cfg.cn[0].cn = {
67                 tag: 'span',
68                 cls: 'sr-only',
69                 html: this.sr_only
70             }
71         }
72         
73         if(this.role){
74             cfg.cn[0].role = this.role;
75         }
76         
77         if(this.aria_valuenow){
78             cfg.cn[0]['aria-valuenow'] = this.aria_valuenow;
79         }
80         
81         if(this.label){
82             cfg.cn[0].html = this.label;
83         }
84         
85         if(this.panel){
86             cfg.cn[0].cls += ' progress-bar-' + this.panel;
87         }
88         
89         return cfg;
90     }
91    
92 });
93
94  
95
96