[Bps-public-commit] r12665 - in pie/branches/named-params/pieplate/PIE-Plate: lib/PIE/Plate
jesse at bestpractical.com
jesse at bestpractical.com
Sat May 24 08:01:21 EDT 2008
Author: jesse
Date: Sat May 24 08:01:03 2008
New Revision: 12665
Modified:
pie/branches/named-params/pieplate/PIE-Plate/lib/PIE/Plate/View.pm
pie/branches/named-params/pieplate/PIE-Plate/share/web/static/js/pieui.js
Log:
* checkpoint js
Modified: pie/branches/named-params/pieplate/PIE-Plate/lib/PIE/Plate/View.pm
==============================================================================
--- pie/branches/named-params/pieplate/PIE-Plate/lib/PIE/Plate/View.pm (original)
+++ pie/branches/named-params/pieplate/PIE-Plate/lib/PIE/Plate/View.pm Sat May 24 08:01:03 2008
@@ -6,11 +6,24 @@
template 'lorzy' => page {
div { { id is 'wrapper' } };
-
+ outs_raw('<style>#wrapper div { padding-left:1em;} </style>');
my $ops = [
+ { name => 'hateyou', args => {}},
+
{ name => 'IfThen',
args => {
- 'if_true' => 'hate',
+ 'if_true' => {
+ name => 'progn',
+ nodes => [
+ { name => 'IsTrue', args => {}},
+ { name => 'IsFalse', args => {}},
+ { name => 'IsTrue', args => {}}
+
+
+ ]
+
+
+ },
'if_false' => 'love',
'condition' => {
name => 'match-regexp',
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 Sat May 24 08:01:03 2008
@@ -8,17 +8,23 @@
function lorzy_show_expression(parent) {
+ if( this.name == 'progn') {
+ jQuery.each(this.nodes, function () { lorzy_show_expression.apply(this,[parent]) });
+
+ return;
+ }
+
+
+
+
var ret = parent.createAppend('div', { className: this.name });
ret.addClass('lorzy-code');
var that = this;
jQuery(ret)
.html(this.name+': '+this.toString() );
-// .click(function () { alert (that.name) });
jQuery(ret).createAppend('div', { className: 'name'} , [this.name]);
ret = jQuery(ret).createAppend('div', { className: 'lorzy-code-args'});
-
-
jQuery.each(this.args, function(name, exp) {
console.log(name + ": "+exp);
var entry = ret.createAppend('div', { className: that.name+' '+name });
@@ -44,9 +50,15 @@
});
var tree = lorzy_generate_struct(jQuery('#wrapper'));
console.log(tree.toJSON());
-// jQuery('#wrapper').after(jQuery('<a href="#">Traverse</a>').attr('id', 'clicky'));
+ jQuery('#wrapper').after(jQuery('<a href="#">Traverse</a>').attr('id', 'clicky'));
- // jQuery('#clicky').click(function () { lorzy_generate_struct(jQuery('#wrapper'))});
+ jQuery('#clicky').click(function () {
+
+ var x = lorzy_generate_struct(jQuery('#wrapper'));
+
+ console.log(x.toJSON());
+
+ });
};
function lorzy_generate_struct(parent) {
@@ -82,7 +94,12 @@
function lorzy_generate_args_struct(args) {
var myArray = {};
jQuery.map(args, function (op) {
- myArray[ jQuery(op).children('.name').text() ] = lorzy_generate_op(jQuery(op).children('.value').children());
+ var kids = lorzy_generate_struct(jQuery(op).children('.value'));
+ if (kids.length == 1) {
+ myArray[ jQuery(op).children('.name').text() ] = kids[0] ;
+ } else {
+ myArray[ jQuery(op).children('.name').text() ] = { 'progn': kids} ;
+ }
});
More information about the Bps-public-commit
mailing list