[Bps-public-commit] r12686 - in pie/branches/named-params/pieplate/PIE-Plate/share/web/static: css

jesse at bestpractical.com jesse at bestpractical.com
Mon May 26 05:06:43 EDT 2008


Author: jesse
Date: Mon May 26 05:06:38 2008
New Revision: 12686

Modified:
   pie/branches/named-params/pieplate/PIE-Plate/share/web/static/css/app.css
   pie/branches/named-params/pieplate/PIE-Plate/share/web/static/js/pieui.js

Log:
* it works. ship it

Modified: pie/branches/named-params/pieplate/PIE-Plate/share/web/static/css/app.css
==============================================================================
--- pie/branches/named-params/pieplate/PIE-Plate/share/web/static/css/app.css	(original)
+++ pie/branches/named-params/pieplate/PIE-Plate/share/web/static/css/app.css	Mon May 26 05:06:38 2008
@@ -1,13 +1,13 @@
 .lorzy-expression, .lorzy-target {
-        min-height: 2em;
-       border: 2px solid grey;
+        min-height: 1em;
+       border: 2px solid #fff;
         padding-top: 0.25em;
         padding-bottom: 0.25em;
-        background: #eee;
 }
 
 .droppable-active {
-    background: green;
+    border: 2px solid green;
+        background: #eee;
 }
 
 .droppable-hover {

Modified: pie/branches/named-params/pieplate/PIE-Plate/share/web/static/js/pieui.js
==============================================================================
--- pie/branches/named-params/pieplate/PIE-Plate/share/web/static/js/pieui.js	(original)
+++ pie/branches/named-params/pieplate/PIE-Plate/share/web/static/js/pieui.js	Mon May 26 05:06:38 2008
@@ -52,7 +52,8 @@
 function lorzy_show_expression(parent, add_event) {
 
     if( this.name == 'progn') {
-        jQuery.each(this.nodes, function () { lorzy_show_expression.apply(this,[parent]);
+        jQuery.each(this.nodes, function () { lorzy_show_expression(parent);
+        //jQuery.each(this.nodes, function () { lorzy_show_expression.apply(this,[parent]);
 
 });
 
@@ -71,27 +72,28 @@
     var codeargs = jQuery(ret).createAppend('div', { className: 'lorzy-code-args'});
 
     jQuery.each(this.args, function(name, exp) {
-        console.log(name +  ": "+exp);
         var entry = codeargs.createAppend('div', { className: that.name+' '+name });
         entry.addClass('lorzy-code-arg');
         entry.createAppend('div', { className: 'name'}, [ name]);
-        var value = entry.createAppend('div', { className: 'value lorzy-expression'});
-        lorzy_wrap_in_drop_targets(value);
+        var value = entry.createAppend('div', { className: 'value'});
+        
         if (!exp)
             return;
         if (typeof(exp) == 'string') {
-            lorzy_show_expression_str(exp, value);
+        var valcontent= value.createAppend('div', { className: 'lorzy-expression'});
+            lorzy_wrap_in_drop_targets(valcontent);
+            lorzy_show_expression_str(exp, valcontent);
             return;
         } else {
 
-        var progn = value.createAppend('div', { className: 'lorzy-progn'});
+        //var progn = valcontent.createAppend('div', { className: 'lorzy-progn'});
 
-        lorzy_show_expression.apply(exp, [progn]); //[entry]);
+        lorzy_show_expression.apply(exp, [value]); //[entry]);
 
         }
     });
 
-        lorzy_wrap_in_drop_targets(parent);
+        //lorzy_wrap_in_drop_targets(parent);
 
     jQuery('div.lorzy-code > div.name', parent)
     .click(function(e) {
@@ -122,8 +124,8 @@
             lorzy_show_expression.apply(this, [jQuery('#wrapper'), true]);
             
         });
-       // var tree = lorzy_generate_struct(jQuery('#wrapper'));
-        //console.log(tree.toJSON());
+       var tree = lorzy_generate_struct(jQuery('#wrapper'));
+        console.log(tree.toJSON());
 
 
 
@@ -185,11 +187,24 @@
 function lorzy_generate_struct(parent) {
 
       var ops = jQuery(parent).children();
-     var tree=    jQuery.map(ops, function (op) {
-            return lorzy_generate_op(jQuery(op));
-       }
+     var tree=   jQuery.grep( 
+         
+     
+     jQuery.map(ops, function (op) {
+        return lorzy_generate_op(jQuery(op));
+        }
 
-        );
+        ),
+
+        function(element, index) {
+                if (element &&  (! jQuery(element).hasClass('lorzy-target'))) {
+                return true;
+                    } else {
+                return false;
+                }
+        }
+
+    );
    
     return tree;
 
@@ -199,27 +214,44 @@
 
 
 function lorzy_generate_op (op) {
-    
-            if( op.hasClass('lorzy-code')) {
-                
+            if(op.hasClass('lorzy-target')) {
+            // it's nothing. skip it
+                return '';
+
+                }
+            if (op.hasClass('lorzy-const')) {            
+               return op.text();
+            } 
+           else if( op.hasClass('lorzy-expression')) {
                 var codeargs =  op.children('.lorzy-code-args').children();
                 return { 'name': op.children('.name').text(), 'args': lorzy_generate_args_struct(codeargs)  };
-            } else if (op.hasClass('lorzy-const')) {            
-               return op.text();
+            } 
+            
+            else if (op.hasClass('lorzy-progn')) {    
+                return { 'progn':  lorzy_generate_progn(op)}; 
             }else  { 
             console.log("failed to find a class on " +op.attr('class'));
             }
 }
 
+function lorzy_generate_progn(op) {
+        return lorzy_generate_struct(op);//.children('lorzy-expression'));
+
+}
+
 
 function lorzy_generate_args_struct(args) {
+
     var myArray = {};
      jQuery.map(args, function (op)  {  
-               var kids = lorzy_generate_struct(jQuery(op).children('.value'));
-               if (kids.length == 1) {
-                myArray[ jQuery(op).children('.name').text() ] =   kids[0] ;
+               var values =  lorzy_generate_struct(jQuery(op).children('.value'));
+               if (values.length < 1 ) {
+                    myArray[ jQuery(op).children('.name').text() ]= null;
+                }
+               else if (values.length == 1) {
+                myArray[ jQuery(op).children('.name').text() ] =   values[0] ;
                } else {
-                myArray[ jQuery(op).children('.name').text() ] =  { 'progn': kids} ;
+                myArray[ jQuery(op).children('.name').text() ] =  { 'progn': values} ;
                }
     });
 



More information about the Bps-public-commit mailing list