Roo/doc/Section.js
[roojs1] / Roo / doc / Section.js
1 /*
2  * - LGPL
3  *
4  */
5
6 /**
7  * @class Roo.doc.Section
8  * @extends Roo.bootstrap.Component
9  * SectionElement class
10  * @cfg {String} stype (desc|parameter|return|note|example) section type.
11  * 
12  * @constructor
13  * Create a new Synopsis
14  * @param {Object} config The config object
15  */
16
17 Roo.doc.Section = function(config){
18     Roo.doc.Section.superclass.constructor.call(this, config);
19 };
20
21 Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
22     
23     
24     stype:   '',
25      
26     getAutoCreate : function(){
27         
28         
29         
30         
31         var cfg ={
32             
33             cls : 'refsection',
34             // id... ?
35             cn : [
36                 {
37                     tag: 'h1',
38                     cls : 'title',
39                     html : Roo.doc.Section.map[this.stype] 
40                 }
41             ]
42         };
43         if (this.stype == 'parameter') {
44             
45             // db package uses variable list here... - it results in dd/dl but the layout is messed up..
46             cfg.cn.push({
47                 tag: 'ul',
48                 cls: 'itemizedlist roo-params'
49             });
50         }
51         
52         
53         return cfg;
54     },
55     getChildContainer : function(build_call)
56     {
57          
58         if (this.stype == 'parameter') {
59             return this.el.select('.roo-params',true).first();
60         }
61         return this.el;
62     }
63     
64     
65    
66 });
67
68  
69 Roo.doc.Section.map = {
70     'desc' : 'Description',
71     'parameter' : 'Parameters',
72     'return' : 'Return Value',
73     'note' : 'Notes',
74     'example' : 'Examples'
75 }