[Rt-commit] rt branch, lcore, updated. 2cfeb5b5e9ac509dfc1d281bd9d09194fc3665f6
clkao at bestpractical.com
clkao at bestpractical.com
Sat Sep 12 02:18:17 EDT 2009
The branch, lcore has been updated
via 2cfeb5b5e9ac509dfc1d281bd9d09194fc3665f6 (commit)
via 9338c4fc73018b7c609175eab7763913896f6220 (commit)
via 8843f1269dcf6c8bb33b48c54abdfa9b2b06203e (commit)
from 76f5ece184c24ae35bec6875b809c02744e1cced (commit)
Summary of changes:
etc/config.yml | 1 -
share/html/Ticket/Elements/UpdateCc | 4 +-
share/web/static/js/rulebuilder.js | 46 +++++++++++++++++++++++++++--
share/web/static/js/util.js | 54 ++++++++++------------------------
4 files changed, 61 insertions(+), 44 deletions(-)
- Log -----------------------------------------------------------------
commit 8843f1269dcf6c8bb33b48c54abdfa9b2b06203e
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Sat Sep 12 14:35:39 2009 +0900
wip for context traversal.
diff --git a/share/web/static/js/rulebuilder.js b/share/web/static/js/rulebuilder.js
index e9dcf98..475d5b3 100644
--- a/share/web/static/js/rulebuilder.js
+++ b/share/web/static/js/rulebuilder.js
@@ -79,7 +79,11 @@ RuleBuilder.prototype.init = function () {
jQuery._div_({'class': 'ohai'})
.text("OH HAI")
- .click(function(e){ alert(that.top_context.serialize())})
+ .click(function(e){
+ that.top_context.traverse(function(ctx) {
+ jQuery(ctx.element).append(ctx.state());
+ });
+ alert(that.top_context.serialize())})
.prependTo(ebuilder);
};
@@ -160,7 +164,7 @@ RuleBuilder.prototype.build_accessor_menu = function(model) {
function(response, status) {
var entries = [];
for (var name in response) {
- if (re.match(name))
+ if (name.match(re))
entries.push(name);
}
that.model_accessors[model] = entries;
@@ -332,6 +336,35 @@ RuleBuilder.Context.prototype.transformMenu = function(el) {
}
+RuleBuilder.Context.prototype.state = function() {
+ if( this.self_eval ) {
+ }
+ else if ( this.expression ) {
+ }
+ else if ( this.func_name ) {
+ var type_complete = false;
+ console.log(this.children);
+ for (var i in this.children) {
+ var child = this.children[i];
+ console.log(i);
+ console.log(this.children[i]);
+ var state = child.state();
+ if (state == 'pending')
+ return 'pending';
+ if (state == 'type-complete')
+ type_complete = true;
+ }
+ if (!type_complete)
+ return "complete";
+ }
+ else {
+ return 'pending';
+ }
+
+ var el = jQuery("span.return-type", this.element);
+ return el.hasClass('matched') ? 'type-complete' : 'complete';
+}
+
RuleBuilder.Context.prototype.update_return_type = function(type) {
// XXX: this should query the server for 'is-a-type-of'
this.return_type = type;
@@ -355,6 +388,13 @@ RuleBuilder.Context.prototype.clear = function() {
this.func_name = null;
}
+RuleBuilder.Context.prototype.traverse = function(fn) {
+ fn(this);
+ if ( this.func_name ) {
+ jQuery.each(this.children, function(idx, val) { fn(this) } );
+ }
+}
+
RuleBuilder.Context.prototype.serialize = function() {
if( this.self_eval ) {
var val = jQuery('input.enter-value', this.element).val();
@@ -410,7 +450,7 @@ RuleBuilder.Context.prototype.set_application = function(func_name, func) {
var x = jQuery._div_({'class': 'context'})
.appendTo(params);
- var child = new RuleBuilder.Context(val.type, x, that, that.rb);
+ var child = new RuleBuilder.Context(val.type, x.get(0), that, that.rb);
that.children.push(child);
});
if (this.children.length) {
commit 2cfeb5b5e9ac509dfc1d281bd9d09194fc3665f6
Merge: 8843f12 9338c4f
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Sat Sep 12 15:11:43 2009 +0900
Merge branch 'master' into lcore
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list