Monotone-Parent: 519bdd0f61b6db465dc7db8d8c0f93b3c72d3f5a

Monotone-Revision: 34791f35dbfae81d89b325cab373497ac8267859

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-08-03T18:40:18
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-08-03 18:40:18 +00:00
parent 8d107d0de0
commit 05ef0e573e
2 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2010-08-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/RowEditionController.js:
RowEditionController.startEditing: keep the "_selected" class
when starting edition, if exists.
RowEditionController.acceptEdition: revert the changes if the new
value is an empty string (might be wrong, though).
RowEditionController.onInputKeyDown: we now handle the tab key
too.
2010-08-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/RowEditionController.js: new class module

View File

@ -37,7 +37,12 @@ RowEditionController.prototype = {
startEditing: function REC_startEditing() {
var rowElement = this.rowElement;
rowElement.previousClassName = rowElement.className;
rowElement.className = "editing";
if (rowElement.className.indexOf("_selected") > -1) {
rowElement.className = "editing _selected";
}
else {
rowElement.className = "editing";
}
var value = "";
for (var i = 0; i < rowElement.childNodes.length; i++) {
@ -92,11 +97,13 @@ RowEditionController.prototype = {
acceptEdition: function REC_acceptEdition() {
var newValue = this.textField.value;
var isValid = (newValue && newValue.length > 0);
if (this.initialValue != newValue
&& isValid
&& this.notifyNewValueCallback) {
this.notifyNewValueCallback(this, value);
this.notifyNewValueCallback(this, newValue);
}
this.stopEditing(true);
this.stopEditing(isValid);
},
cancelEdition: function REC_acceptEdition() {
this.stopEditing(false);
@ -120,6 +127,9 @@ RowEditionController.prototype = {
this.acceptEdition();
event.stop();
}
else if (event.keyCode == Event.KEY_TAB) {
this.acceptEdition();
}
},
onBodyMouseDown: function REC_onBodyMouseDown(event) {
if (event.target != this.textField) {