[Rt-commit] rt branch, lcore, updated. 0300109500b65660acf108c5a2bb4ab9cd776873
clkao at bestpractical.com
clkao at bestpractical.com
Thu Oct 15 13:41:36 EDT 2009
The branch, lcore has been updated
via 0300109500b65660acf108c5a2bb4ab9cd776873 (commit)
from d2855f140bccc8f4b2e42907355b558ee71b9b89 (commit)
Summary of changes:
share/web/static/css/rulebuilder.css | 9 +++++
share/web/static/images/cross.png | Bin 0 -> 655 bytes
share/web/static/js/rulebuilder.js | 59 ++++++++++++++++++++-------------
3 files changed, 45 insertions(+), 23 deletions(-)
create mode 100755 share/web/static/images/cross.png
- Log -----------------------------------------------------------------
commit 0300109500b65660acf108c5a2bb4ab9cd776873
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Fri Oct 16 01:38:33 2009 +0800
icon for clearing context.
diff --git a/share/web/static/css/rulebuilder.css b/share/web/static/css/rulebuilder.css
index 394154d..efba026 100644
--- a/share/web/static/css/rulebuilder.css
+++ b/share/web/static/css/rulebuilder.css
@@ -233,6 +233,15 @@ span.arraybuilder-icon {
width:0;
}
+span.clear-icon {
+ background:transparent url(/static/images/cross.png) no-repeat scroll 0 0;
+ float:right;
+ height:16px;
+ overflow:hidden;
+ padding-left:16px;
+ width:0;
+}
+
div.arraybuilder {
}
diff --git a/share/web/static/images/cross.png b/share/web/static/images/cross.png
new file mode 100755
index 0000000..1514d51
Binary files /dev/null and b/share/web/static/images/cross.png differ
diff --git a/share/web/static/js/rulebuilder.js b/share/web/static/js/rulebuilder.js
index caab1fd..5768f41 100644
--- a/share/web/static/js/rulebuilder.js
+++ b/share/web/static/js/rulebuilder.js
@@ -389,9 +389,9 @@ Module("RuleBuilder2", function(m) {
context.expcontext = new m.ArrayContext({ context: context,
builder: builder,
inner_type: inner_type });
- var child = this.context.mk_array_item_context(this.inner_type,
- jQuery('div.array-item-container', this.builder), 0);
- this.context.children.push(child);
+ var child = context.mk_array_item_context(context.inner_type,
+ jQuery('div.array-item-container', this.builder), 0);
+ context.children.push(child);
builder.show();
jQuery(this).hide();
context.rb.focus(child);
@@ -478,33 +478,46 @@ Module("RuleBuilder2", function(m) {
rb: { is: "rw" }
},
after: { initialize: function() {
- var expected_type = this.expected_type;
var rb = this.rb;
var that = this;
jQuery(this.element).click(function(e) { rb.focus(that); return false });
- jQuery._span_({ 'class': 'return-type'})
- .text(expected_type)
- .appendTo(this.element);
-
- if (expected_type == 'Str' || expected_type == 'Num') { // self-evaluating
- jQuery._span_({ 'class': 'enter-value' })
- .text("Enter a value")
- .click(function(e) {
- jQuery(this).html('').unbind('click');
- that.expcontext = new m.SelfEvalContext( { context: that } );
- return true;
- })
- .appendTo(this.element);
- }
-
- var matched = /^ArrayRef\[(.*)\]$/.exec(expected_type);
- if (matched) {
- m.ArrayContext.prototype.helper(this, matched[1]);
- }
+ this.show_helpers();
}
},
methods: {
+ show_helpers: function() {
+ var expected_type = this.expected_type;
+ var that = this;
+ jQuery._span_({ 'class': 'return-type'})
+ .text(expected_type)
+ .appendTo(this.element);
+
+ if (expected_type == 'Str' || expected_type == 'Num') { // self-evaluating
+ jQuery._span_({ 'class': 'enter-value' })
+ .text("Enter a value")
+ .click(function(e) {
+ jQuery(this).html('').unbind('click');
+ that.expcontext = new m.SelfEvalContext( { context: that } );
+ return true;
+ })
+ .appendTo(this.element);
+ }
+
+ var matched = /^ArrayRef\[(.*)\]$/.exec(expected_type);
+ if (matched) {
+ m.ArrayContext.prototype.helper(this, matched[1]);
+ }
+ jQuery._span_({'class': 'clear-icon'})
+ .text("Clear")
+ .appendTo(this.element)
+ .click(function(e) {
+ jQuery(that.element).html('');
+ that.clear();
+ that.show_helpers();
+ });
+ },
+
array_item_idx: function() {
for (var i in this.parent.children) {
if (this.parent.children[i] == this)
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list