[Bps-public-commit] r12666 - in pie/branches/named-params/pieplate/PIE-Plate/share/web/static: css
clkao at bestpractical.com
clkao at bestpractical.com
Sat May 24 11:34:19 EDT 2008
Author: clkao
Date: Sat May 24 11:34:18 2008
New Revision: 12666
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:
selectable entries, remove, add if/else.
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 Sat May 24 11:34:18 2008
@@ -1,11 +1,21 @@
-div.lorzy-code {
- color: blue;
-};
-
div.lorzy-code-arg {
color: green;
-};
+}
span.lorzy-const {
color: black;
-};
+}
+
+div.selected {
+ border: 1px solid #ff0000;
+}
+
+div.hover {
+ border: 1px solid #990000;
+}
+
+div.lorzy-code {
+ width: 300px;
+ color: blue;
+}
+
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 11:34:18 2008
@@ -2,11 +2,11 @@
function lorzy_show_expression_str(str, parent) {
var el = parent.createAppend('span', { className: 'lorzy-const string' });
el.html(str)
- .editable(function(value, settings) { alert('yatta'); return value},
+ .editable(function(value, settings) { return value},
{ submit: 'OK' } );
}
-function lorzy_show_expression(parent) {
+function lorzy_show_expression(parent, add_event) {
if( this.name == 'progn') {
jQuery.each(this.nodes, function () { lorzy_show_expression.apply(this,[parent]) });
@@ -20,8 +20,6 @@
var ret = parent.createAppend('div', { className: this.name });
ret.addClass('lorzy-code');
var that = this;
- jQuery(ret)
- .html(this.name+': '+this.toString() );
jQuery(ret).createAppend('div', { className: 'name'} , [this.name]);
ret = jQuery(ret).createAppend('div', { className: 'lorzy-code-args'});
@@ -31,6 +29,8 @@
entry.addClass('lorzy-code-arg');
entry.createAppend('div', { className: 'name'}, [ name]);
var value = entry.createAppend('div', { className: 'value'});
+ if (!exp)
+ return;
if (typeof(exp) == 'string') {
lorzy_show_expression_str(exp, value);
return;
@@ -40,25 +40,71 @@
}
});
-}
+ jQuery('div.lorzy-code > div.name', parent)
+ .click(function(e) {
+ jQuery('.selected').removeClass('selected');
+ jQuery(this).parent().addClass('selected') }
+ )
+ .hover(function(e) {
+ jQuery(this).parent().addClass('hover') },
+ function(e) {
+ jQuery(this).parent().removeClass('hover') });
+
+ jQuery('div.lorzy-code-arg > div.name', parent)
+ .click(function(e) {
+ jQuery('.selected').removeClass('selected');
+ jQuery(this).siblings('.value').addClass('selected') }
+ )
+ .hover(function(e) {
+ jQuery(this).siblings('.value').addClass('hover') },
+ function(e) {
+ jQuery(this).siblings('.value').removeClass('hover') });
+
+
+}
+var last_hate;
function lorzy_show(ops) {
jQuery(ops).each(
function() {
- lorzy_show_expression.apply(this, [jQuery('#wrapper')]);
+ lorzy_show_expression.apply(this, [jQuery('#wrapper'), true]);
});
var tree = lorzy_generate_struct(jQuery('#wrapper'));
console.log(tree.toJSON());
+ jQuery('#wrapper').after(jQuery('<a href="#">Remove</a>').attr('id', 'remove-entry'));
+ jQuery('#wrapper').after(jQuery('<a href="#">Add If</a>').attr('id', 'add-entry-if'));
jQuery('#wrapper').after(jQuery('<a href="#">Traverse</a>').attr('id', 'clicky'));
+
+ jQuery('#remove-entry').click(function() {
+ var el = jQuery('div.selected');
+ if (el.hasClass("value"))
+ el.empty();
+ else
+ el.remove();
+
+ });
+
+ jQuery('#add-entry-if').click(function() {
+ var el = jQuery('div.selected');
+ if (!el.hasClass('value')) {
+ el = el.parent();
+ }
+ lorzy_show_expression.apply({ name: 'IfThen',
+ args: { if_true: null,
+ if_false: null,
+ condition: null
+ } }, [el, true] );
+ });
- jQuery('#clicky').click(function () {
+ jQuery('#clicky').click(function () {
var x = lorzy_generate_struct(jQuery('#wrapper'));
console.log(x.toJSON());
});
+
};
function lorzy_generate_struct(parent) {
More information about the Bps-public-commit
mailing list