vumix/commit

add cancel button

authorMichiel Hildebrand
Thu Mar 22 16:29:09 2012 +0100
committerMichiel Hildebrand
Thu Mar 22 16:29:09 2012 +0100
commiteb95dc753e220dea38db97c99abf6d58b580a573
treee2d1022b69a61e6f14ca3ffb858691342aa0d766
parent56687c3433c5862ee18a6dc7523532fe23886c12
Diff style: patch stat
diff --git a/web/js/textedit.js b/web/js/textedit.js
index fcedeab..c111017 100644
--- a/web/js/textedit.js
+++ b/web/js/textedit.js
@@ -45,15 +45,18 @@ YUI.add('textedit', function(Y) {
 				inputLabel = inputNode.appendChild(Node.create('<div class="inputLabel">'
 					+this.get('inputLabel')+'</div>')),
 				inputField = inputNode.appendChild(Node.create('<textarea></textarea>')),
-				submitButton = inputNode.appendChild(Node.create('<button>save</button>'));
+				cancelButton = inputNode.appendChild(Node.create('<button>cancel</button>'));
+				saveButton = inputNode.appendChild(Node.create('<button>save</button>'));
 			
 			this._setText({newVal:text});
 			this.on("textChange", this._setText, this);
 			textNode.on("click", this._enableEdit, this);
-			submitButton.on("click", this._submitText, this);
+			cancelButton.on("click", function() {this._setText({newVal:this.get("text")})}, this);
+			saveButton.on("click", this._submitText, this);
 		},
 		
 		_setText : function(e) {
+			console.log(e);
 			var host = this.get("host"),
 				text = e.newVal;
 			if(text) {