sync
authorAlan Knowles <alan@roojs.com>
Tue, 17 Feb 2015 08:03:35 +0000 (16:03 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 17 Feb 2015 08:03:35 +0000 (16:03 +0800)
src/JsRender/JsRender.vala
src/JsRender/NodeToJs.vala
src/JsRender/Roo.vala

index 5cae000..d2c3ee8 100644 (file)
@@ -173,7 +173,7 @@ namespace JsRender {
                {
                     
                    var generator = new Json.Generator ();
-                   generator.indent = 4;
+                   generator.indent = 1;
                    generator.pretty = true;
                    var node = new Json.Node(Json.NodeType.OBJECT);
                    node.set_object(this.toJsonObject());
index 7338379..ce1450c 100644 (file)
@@ -284,6 +284,7 @@ public class JsRender.NodeToJs : Object {
                                var nstr = "" + str;
                                if (lines.length > 0) {
                                        nstr =  string.joinv("\n" + this.pad, lines);
+                                       //nstr =  string.joinv("\n", lines);
                                }
                                //print("==> " +  str + "\n");
                                this.els.add(left + nstr);
@@ -357,7 +358,8 @@ public class JsRender.NodeToJs : Object {
                        
                        
                        if (right.length > 0){
-                               this.els.add(left + "[\n" +  this.pad + "        " +  right + "\n" + this.pad + "]");
+                               this.els.add(left + "[\n" +  this.pad + indent_str + indent_str +  
+                                            right + "\n" + this.pad + "]");
                        }
                
                        
@@ -384,11 +386,10 @@ public class JsRender.NodeToJs : Object {
                        var str = liter.get_value().strip();
                        var lines = str.split("\n");
                        if (lines.length > 0) {
-                               str = string.joinv("\n" + this.pad + "     ", lines);
+                               //str = string.joinv("\n" + this.pad + "           ", lines);
+                               str = string.joinv("\n" + this.pad + indent_str + indent_str , lines);
                        }
                        
-
-                       
                        itms +=  this.pad + indent_str  + liter.get_key().replace("|", "")  + " : " + str;
 
                        i++;
index c28c22c..20505fa 100644 (file)
@@ -426,34 +426,34 @@ namespace JsRender {
  
             string[] adda = { " = {",
                 "",
-                "    dialog : false,",
-                "    callback:  false,",
+                " dialog : false,",
+                " callback:  false,",
                 "",   
-                "    show : function(data, cb)",
-                "    {",
-                "        if (!this.dialog) {",
-                "            this.create();",
-                "        }",
+                " show : function(data, cb)",
+                " {",
+                "  if (!this.dialog) {",
+                "   this.create();",
+                "  }",
                 "",
-                "        this.callback = cb;",
-                "        this.data = data;",
-                "        this.dialog.show(this.data._el);",
-                "        if (this.form) {",
-                "           this.form.reset();",
-                "           this.form.setValues(data);",
-                "           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
-                "        }",
+                "  this.callback = cb;",
+                "  this.data = data;",
+                "  this.dialog.show(this.data._el);",
+                "  if (this.form) {",
+                "   this.form.reset();",
+                "   this.form.setValues(data);",
+                "   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
+                "  }",
                 "",   
-                "    },",
+                " },",
                 "",
-                "    create : function()",
-                "    {",
-                "        var _this = this;",
-                "        this.dialog = Roo.factory(" 
+                " create : function()",
+                " {",
+                "   var _this = this;",
+                "   this.dialog = Roo.factory(" 
             };
             string[] addb = {  
-                        ");",
-                "    }",
+                   ");",
+                " }",
                 "};",
                 ""
             };
@@ -474,34 +474,34 @@ namespace JsRender {
             
             string[] adda = { " = {",
                 "",
-                "    dialog : false,",
-                "    callback:  false,",
+                " dialog : false,",
+                " callback:  false,",
                 "",   
-                "    show : function(data, cb)",
-                "    {",
-                "        if (!this.dialog) {",
-                "            this.create();",
-                "        }",
+                " show : function(data, cb)",
+                " {",
+                "  if (!this.dialog) {",
+                "   this.create();",
+                "  }",
                 "",
-                "        this.callback = cb;",
-                "        this.data = data;",
-                "        this.dialog.show(this.data._el);",
-                "        if (this.form) {",
-                "           this.form.reset();",
-                "           this.form.setValues(data);",
-                "           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
-                "        }",
+                "  this.callback = cb;",
+                "  this.data = data;",
+                "  this.dialog.show(this.data._el);",
+                "  if (this.form) {",
+                "   this.form.reset();",
+                "   this.form.setValues(data);",
+                "   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
+                "  }",
                 "",   
-                "    },",
+                " },",
                 "",
-                "    create : function()",
-                "    {",
-                "        var _this = this;",
-                "        this.dialog = Roo.factory("
+                " create : function()",
+                " {",
+                "  var _this = this;",
+                "  this.dialog = Roo.factory("
             };
             string[] addb =  {
-                ");",
-                "    }",
+                "  );",
+                " }",
                 "};",
                 ""
             };
@@ -572,22 +572,22 @@ namespace JsRender {
                        this.outputHeader() + "\n" +
                        
                        this.name  +  " = new Roo.XComponent({\n" +
-                       "    part     :  "+ this.pathToPart() + ",\n" +
+                       "  part     :  "+ this.pathToPart() + ",\n" +
                                /// critical used by builder to associate modules/parts/persm
-                       "    order    : '" +modkey+"',\n" +
-                       "    region   : '" + this.region   +"',\n" +
-                       "    parent   : "+ parent + ",\n" +
-                       "    name     : " + this.tree.quoteString(this.title.length > 0 ? this.title : "unnamed module") + ",\n" +
-                       "    disabled : " + (this.disabled ? "true" : "false") +", \n" +
-                       "    permname : '" + (this.permname.length > 0 ? this.permname : "") +"', \n" +
+                       "  order    : '" +modkey+"',\n" +
+                       "  region   : '" + this.region   +"',\n" +
+                       "  parent   : "+ parent + ",\n" +
+                       "  name     : " + this.tree.quoteString(this.title.length > 0 ? this.title : "unnamed module") + ",\n" +
+                       "  disabled : " + (this.disabled ? "true" : "false") +", \n" +
+                       "  permname : '" + (this.permname.length > 0 ? this.permname : "") +"', \n" +
                            
                       // "    tree : function() { return this._tree(); },\n" +   //BC
-                       "    _tree : function()\n" +
-                       "    {\n" +
-                       "        var _this = this;\n" + // bc
-                       "        var MODULE = this;\n" + /// this looks like a better name.
-                       "        return " + o + ";" +
-                       "    }\n" +
+                       "  _tree : function()\n" +
+                       "  {\n" +
+                       "   var _this = this;\n" + // bc
+                       "   var MODULE = this;\n" + /// this looks like a better name.
+                       "   return " + o + ";" +
+                       "  }\n" +
                        "});\n";