From 05ef0e573e0834bbae917bfe1faac7a081a372b4 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 3 Aug 2010 18:40:18 +0000 Subject: [PATCH] Monotone-Parent: 519bdd0f61b6db465dc7db8d8c0f93b3c72d3f5a Monotone-Revision: 34791f35dbfae81d89b325cab373497ac8267859 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-08-03T18:40:18 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 10 ++++++++++ UI/WebServerResources/RowEditionController.js | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 836658746..f218683f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-08-03 Wolfgang Sourdeau + + * 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 * UI/WebServerResources/RowEditionController.js: new class module diff --git a/UI/WebServerResources/RowEditionController.js b/UI/WebServerResources/RowEditionController.js index d6b5e084f..e6412dcb4 100644 --- a/UI/WebServerResources/RowEditionController.js +++ b/UI/WebServerResources/RowEditionController.js @@ -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) {