[Rt-commit] rt branch, lcore, updated. b8eb4f53f57ff1dec5fd4a056711171a3ce0b549
clkao at bestpractical.com
clkao at bestpractical.com
Tue Sep 29 05:39:16 EDT 2009
The branch, lcore has been updated
via b8eb4f53f57ff1dec5fd4a056711171a3ce0b549 (commit)
from 666756cf63f33421cef4670a8af2ad18f7d5ee96 (commit)
Summary of changes:
share/web/static/css/rulebuilder.css | 39 +++++++++++++++++++++++
share/web/static/images/add.png | Bin 0 -> 733 bytes
share/web/static/images/delete.png | Bin 0 -> 715 bytes
share/web/static/images/text_columns.png | Bin 0 -> 246 bytes
share/web/static/js/rulebuilder.js | 49 ++++++++++++++++++++++++++++++
5 files changed, 88 insertions(+), 0 deletions(-)
create mode 100755 share/web/static/images/add.png
create mode 100755 share/web/static/images/delete.png
create mode 100755 share/web/static/images/text_columns.png
- Log -----------------------------------------------------------------
commit b8eb4f53f57ff1dec5fd4a056711171a3ce0b549
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Tue Sep 29 17:38:51 2009 +0800
first cut of arraybuilder ui.
diff --git a/share/web/static/css/rulebuilder.css b/share/web/static/css/rulebuilder.css
index cf09654..c1c1941 100644
--- a/share/web/static/css/rulebuilder.css
+++ b/share/web/static/css/rulebuilder.css
@@ -213,3 +213,42 @@ div.context span.expression {
-webkit-border-radius: 0.5em;
border-radius: 0.5em;
}
+
+span.arraybuilder-icon {
+ background:#FFFFFF url(/static/images/text_columns.png) no-repeat scroll 0 0;
+ float:right;
+ height:16px;
+ overflow:hidden;
+ padding-left:16px;
+ width:0;
+}
+
+div.arraybuilder {
+
+}
+
+div.array-item-container {
+}
+
+div.array-item {
+ width: 120%;
+}
+
+span.add-icon, span.delete-icon {
+ float:left;
+ height:16px;
+ clear: left;
+ overflow:hidden;
+ padding-left:16px;
+ margin-top: 4px;
+ width:0;
+}
+
+span.add-icon {
+ background: url(/static/images/add.png) no-repeat;
+}
+
+span.delete-icon {
+ background: url(/static/images/delete.png) no-repeat;
+}
+
diff --git a/share/web/static/images/add.png b/share/web/static/images/add.png
new file mode 100755
index 0000000..6332fef
Binary files /dev/null and b/share/web/static/images/add.png differ
diff --git a/share/web/static/images/delete.png b/share/web/static/images/delete.png
new file mode 100755
index 0000000..08f2493
Binary files /dev/null and b/share/web/static/images/delete.png differ
diff --git a/share/web/static/images/text_columns.png b/share/web/static/images/text_columns.png
new file mode 100755
index 0000000..97b2e03
Binary files /dev/null and b/share/web/static/images/text_columns.png differ
diff --git a/share/web/static/js/rulebuilder.js b/share/web/static/js/rulebuilder.js
index 42f5da2..596ada9 100644
--- a/share/web/static/js/rulebuilder.js
+++ b/share/web/static/js/rulebuilder.js
@@ -320,6 +320,55 @@ RuleBuilder.Context = function(expected_type, element, parent, rb) {
})
.appendTo(this.element);
}
+
+ var matched = /^ArrayRef\[(.*)\]$/.exec(expected_type);
+ if (matched) {
+ this.inner_type = matched[1];
+ this.children = [];
+ var builder = jQuery._div({'class': 'arraybuilder'})
+ ._div_({'class': 'array-item-container'})
+ .div_()
+ .appendTo(this.element)
+ .hide();
+ jQuery._span_({'class': 'arraybuilder-icon'})
+ .text("Array builder")
+ .appendTo(this.element)
+ .click(function(e) {
+ that.arraybuilder = builder;
+ var child = that.mk_array_item_context(that.inner_type,
+ jQuery('div.array-item-container', builder));
+ that.children.push(child);
+ builder.show();
+ jQuery(this).remove();
+ that.rb.focus(child);
+ return false;
+ });
+ }
+};
+
+RuleBuilder.Context.prototype.mk_array_item_context = function(type, container) {
+ var li = jQuery._div_({'class': 'array-item'})
+ .appendTo(container);
+ var x = jQuery._div_({'class': 'context'})
+ .appendTo(li);
+ var child = new RuleBuilder.Context(type, x.get(0), this, this.rb);
+ var that = this; // parent
+ jQuery._span_({'class': 'add-icon'})
+ .text("+")
+ .appendTo(li)
+ .click(function(e) {
+ var child = that.mk_array_item_context(that.inner_type,
+ jQuery('div.array-item-container', that.arraybuilder));
+ that.children.push(child); // XXX: make correct insert order
+ });
+ jQuery._span_({'class': 'delete-icon'})
+ .text("-")
+ .appendTo(li)
+ .click(function(e) {
+ // XXX: make correct splice order
+ });
+
+ return child;
};
RuleBuilder.Context.prototype.return_type_from_val = function(val) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list