remove debugging code
[roojs1] / Roo / bootstrap / ProgressBar.js
1 /*
2  * - LGPL
3  *
4  * ProgressBar
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.ProgressBar
10  * @extends Roo.bootstrap.Component
11  * Bootstrap ProgressBar 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 {String} sr_only text
19  * 
20  * 
21  * @constructor
22  * Create a new ProgressBar
23  * @param {Object} config The config object
24  */
25
26 Roo.bootstrap.ProgressBar = function(config){
27     Roo.bootstrap.ProgressBar.superclass.constructor.call(this, config);
28 };
29
30 Roo.extend(Roo.bootstrap.ProgressBar, Roo.bootstrap.Component,  {
31     
32     aria_valuenow : 0,
33     aria_valuemin : 0,
34     aria_valuemax : 100,
35     label : false,
36     panel : false,
37     role : false,
38     sr_only: false,
39     
40     getAutoCreate : function()
41     {
42         
43         var cfg = {
44             tag: 'div',
45             cls: 'progress-bar',
46             style: 'width:' + Math.ceil((this.aria_valuenow / this.aria_valuemax) * 100) + '%'
47         };
48         
49         if(this.sr_only){
50             cfg.cn = {
51                 tag: 'span',
52                 cls: 'sr-only',
53                 html: this.sr_only
54             }
55         }
56         
57         if(this.role){
58             cfg.role = this.role;
59         }
60         
61         if(this.aria_valuenow){
62             cfg['aria-valuenow'] = this.aria_valuenow;
63         }
64         
65         if(this.aria_valuemin){
66             cfg['aria-valuemin'] = this.aria_valuemin;
67         }
68         
69         if(this.aria_valuemax){
70             cfg['aria-valuemax'] = this.aria_valuemax;
71         }
72         
73         if(this.label && !this.sr_only){
74             cfg.html = this.label;
75         }
76         
77         if(this.panel){
78             cfg.cls += ' progress-bar-' + this.panel;
79         }
80         
81         return cfg;
82     },
83     
84     update : function(aria_valuenow)
85     {
86         this.aria_valuenow = aria_valuenow;
87         
88         this.el.setStyle('width', Math.ceil((this.aria_valuenow / this.aria_valuemax) * 100) + '%');
89     }
90    
91 });
92
93  
94
95