roojs-doc.js
[roojs1] / roojs-doc-debug.js
index f367b5f..34ab359 100644 (file)
@@ -30,13 +30,12 @@ Roo.doc.Entry  = function(config){
         marginheight : 0,
         offset : 0
     });
-    Roo.doc.Entry._calls++;
-    if (Roo.doc.Entry._calls > 1) {
-        throw "test";
-    }
+    
+     
     // call onRender once... and block next call...?
     this.onRender(body);
-    this.onRender = function() { };
+    this.el = body;
+    //this.onRender = function() { };
 
 };
 
@@ -74,10 +73,20 @@ Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component,  {
     addxtype :   function (tree, cntr)
     {
         return this.addxtypeChild(tree,cntr);
-    }
-
+    },
     
+    onRender : function(ct, position)
+    {
+        
+        Roo.doc.Entry._calls++;
+        if (Roo.doc.Entry._calls > 1 || !ct) {
+            return;
+        }
+        
+    // call onRender once... and block next call...?
     
+        Roo.bootstrap.Component.prototype.onRender.call(this, ct, position);
+    }
    
 });
 
@@ -273,12 +282,16 @@ Roo.extend(Roo.doc.Param, Roo.bootstrap.Component,  {
         var cfg ={
             tag: 'span',
             cn : [
-                is_optional ? '[' : '',
+                this.is_optional ? '[' : '',
                 this.type,
                 ' ',
-                this.name,
+                {
+                    tag : 'b',
+                    html : this.name
+                },
                 this.defaultvalue == '' ? '' : ' = ',
                 this.defaultvalue,
+                this.is_optional ? ']' : '',
                 ',' // not really.. but let's do it anyway...
             ]
         };
@@ -287,7 +300,29 @@ Roo.extend(Roo.doc.Param, Roo.bootstrap.Component,  {
         
        
         return cfg;
+    },
+    getAutoCreateParamSection : function()
+    {
+        return {
+               tag : 'li',
+               cn : [
+                   {
+                       tag : 'p',
+                       cls: 'para',
+                       cn : [
+                           {
+                               tag: 'code',
+                               html : this.type + ' ' + this.name
+                           },
+                           this.desc
+                       ]
+                   }
+               ]
+           };
+        
+        
     }
+    
      
     
     
@@ -325,6 +360,9 @@ Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
      
     getAutoCreate : function(){
         
+        
+        
+        
         var cfg ={
             
             cls : 'refsection',
@@ -333,17 +371,27 @@ Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
                 {
                     tag: 'h1',
                     cls : 'title',
-                    html : this.stype.charAt(0).toUpperCase() + this.stype.slice(1) //ucfirst
+                    html : Roo.doc.Section.map[this.stype] 
                 }
             ]
         };
         if (this.stype == 'parameter') {
             
             // db package uses variable list here... - it results in dd/dl but the layout is messed up..
-            cfg.cn.push({
+            
+            var ul = {
                 tag: 'ul',
-                cls: 'itemizedlist roo-params'
-            });
+                cls: 'itemizedlist roo-params',
+                cn : []
+            };
+            // might not have any..
+            var params = this.parent().items[0].items;
+            for (var i =0; i < params.length;i++) {
+                ul.cn.push( Roo.factory(params[i]).getAutoCreateParamSection() )
+            }
+            
+            
+            cfg.cn.push(ul);
         }
         
        
@@ -363,8 +411,14 @@ Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
 });
 
  
-
- /*
+Roo.doc.Section.map = {
+    'desc' : 'Description',
+    'parameter' : 'Parameters',
+    'return' : 'Return Value',
+    'note' : 'Notes',
+    'example' : 'Examples'
+}
+/*
  * - LGPL
  *
  */
@@ -418,7 +472,8 @@ Roo.extend(Roo.doc.Synopsis, Roo.bootstrap.Component,  {
                                     {
                                         tag: 'span',
                                         cls : 'roo-params'
-                                    }
+                                    },
+                                    ')'
                                 ]
                                 
                             }