Roo/bootstrap/Alert.js
[roojs1] / Roo / bootstrap / Alert.js
1 /*
2  * - LGPL
3  *
4  * Alert
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Alert
10  * @extends Roo.bootstrap.Component
11  * Bootstrap Alert class
12  * @cfg {String} title The title of alert
13  * @cfg {String} html The content of alert
14  * @cfg {String} weight (  success | info | warning | danger )
15  * @cfg {String} faicon font-awesomeicon
16  * 
17  * @constructor
18  * Create a new alert
19  * @param {Object} config The config object
20  */
21
22
23 Roo.bootstrap.Alert = function(config){
24     Roo.bootstrap.Alert.superclass.constructor.call(this, config);
25     
26 };
27
28 Roo.extend(Roo.bootstrap.Alert, Roo.bootstrap.Component,  {
29     
30     title: '',
31     html: '',
32     weight: '',
33     faicon: false,
34     
35     getAutoCreate : function()
36     {
37         
38         var cfg = {
39             tag : 'div',
40             cls : 'alert',
41             cn : [
42                 {
43                     tag : 'b',
44                     cls : 'roo-alert-title',
45                     html : this.title
46                 },
47                 {
48                     tag : 'span',
49                     cls : 'roo-alert-content',
50                     html : this.html
51                 }
52             ]
53         };
54         
55         if(this.faicon){
56             cfg.cn.unshift({
57                 tag : 'i',
58                 cls : 'fa ' + this.faicon
59             });
60         }
61         
62         
63         
64         return cfg;
65     },
66     
67     initEvents: function() 
68     {
69         
70     },
71     
72     setText : function(str)
73     {
74         this.el.select('.roo-button-text',true).first().dom.innerHTML = str;
75     },
76     
77     hide: function() 
78     {
79         this.el.hide();   
80     },
81     
82     show: function() 
83     {  
84         this.el.show();   
85     }
86     
87 });
88
89