7da75e330bbf04d33d9756fb03257de8cbbdf7db
[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             
47             var ul = {
48                 tag: 'ul',
49                 cls: 'itemizedlist roo-params',
50                 cn : []
51             };
52             // might not have any..
53             var params = this.parent().items[0].items;
54             for (var i =0; i < params.length;i++) {
55                 ul.cn.push( Roo.factory(params[i]).getAutoCreateParamSection() )
56             }
57             
58             
59             cfg.cn.push(ul);
60         }
61         
62         
63         return cfg;
64     },
65     getChildContainer : function(build_call)
66     {
67          
68         if (this.stype == 'parameter') {
69             return this.el.select('.roo-params',true).first();
70         }
71         return this.el;
72     }
73     
74     
75    
76 });
77
78  
79 Roo.doc.Section.map = {
80     'desc' : 'Description',
81     'parameter' : 'Parameters',
82     'return' : 'Return Value',
83     'note' : 'Notes',
84     'example' : 'Examples'
85 }