Roo/doc/Example.js
[roojs1] / Roo / doc / Example.js
1 /*
2  * - LGPL
3  *
4  */
5
6 /**
7  * @class Roo.doc.Example
8  * @extends Roo.bootstrap.Component
9  * Example Element class
10  * @cfg {String} lang (phpcode|programlisting) section type.
11  * @cfg {String} code  example code
12  * @cfg {String} output The expected output from the code
13  *
14  * 
15  * @constructor
16  * Create a new Synopsis
17  * @param {Object} config The config object
18  */
19
20 Roo.doc.Example = function(config){
21     Roo.doc.Example.superclass.constructor.call(this, config);
22 };
23
24 Roo.extend(Roo.doc.Example, Roo.bootstrap.Component,  {
25     
26     
27     lang:   'php',
28     code : '',
29     output : '',
30     
31     getAutoCreate : function(){
32         
33         // no colour highlighting in here....
34         
35         var cfg ={
36             
37             cls : this.lang,
38             
39             cn : [
40                 {
41                     tag: 'pre',
42                     html :  String.format('{0}',this.code).replace(/\n/g, '<br/>')
43                 }
44             ]
45         };
46         if (this.output) {
47             cfg.cn.push({
48                 cls : 'panel panel-default',
49                 cn : [
50                     {
51                         cls : 'panel-heading',
52                         html : "Outputs",
53                     {
54                         cls : 'panel-body',
55                         cn : {
56                             
57                         }
58                     }
59                 ]
60                 
61                 
62             })
63         }
64         
65         
66         
67         return cfg;
68     }
69   
70     
71     
72    
73 });
74
75  
76
77