From 06c3f547e5ff0bfe9f37189f360478e985e75579 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 13 Mar 2012 21:13:31 +0000 Subject: [PATCH] See ChangeLog. Monotone-Parent: b31a7aa3d154368df1ba1525deed0dd5867b42f0 Monotone-Revision: 9ecab283bcceea3e4446b4445d65cffeae83252c Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-03-13T21:13:31 --- ChangeLog | 3 +++ .../Toolbars/UIxPreferences.toolbar | 2 +- UI/WebServerResources/UIxFilterEditor.js | 27 ++++++++++++++----- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec00980fe..8c860e461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2012-03-13 Francis Lachapelle + * UI/WebServerResources/UIxFilterEditor.js (savePreferences): + only save the filters if there's at least one rule and one action defined. + * UI/WebServerResources/ContactsUI.js (configureDraggables): increased the delay before starting drag and drop. diff --git a/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar index 09b0c9d8d..498ead765 100644 --- a/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar +++ b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar @@ -1,7 +1,7 @@ ( /* the toolbar groups -*-cperl-*- */ ( { link = "#"; label = "Save and Close"; - onclick = "return savePreferences();"; + onclick = "return savePreferences(event);"; image = "tb-compose-save-flat-24x24.png"; }, { link = "#"; isSafe = NO; diff --git a/UI/WebServerResources/UIxFilterEditor.js b/UI/WebServerResources/UIxFilterEditor.js index 6276e4f73..3e36f767a 100644 --- a/UI/WebServerResources/UIxFilterEditor.js +++ b/UI/WebServerResources/UIxFilterEditor.js @@ -783,13 +783,28 @@ function onActionDeleteClick(event) { event.stop(); } -function savePreferences() { - var inputs = $$("DIV#filterRules input"); +function savePreferences(event) { var valid = true; - inputs.each(function(input) { - if (input.hasClassName("_invalid")) - valid = false; - }); + + var rules = $$("DIV#filterRules DIV.rule"); + if (rules.length == 0) { + onRuleAddClick(event); + valid = false; + } + + var actions = $$("DIV#filterActions DIV.action"); + if (actions.length == 0) { + onActionAddClick(event); + valid = false; + } + + if (valid) { + var inputs = $$("DIV#filterRules input"); + inputs.each(function(input) { + if (input.hasClassName("_invalid")) + valid = false; + }); + } if (valid) { if (window.opener) {