From 38e8b7554af2299c7c709eedb1c3144cc8eefeac Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sat, 14 Dec 2013 11:54:53 +0100 Subject: [PATCH] add a spinner to the validatebutton --- plugins/validatebutton/static/js/validatebutton.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/validatebutton/static/js/validatebutton.js b/plugins/validatebutton/static/js/validatebutton.js index dd987cde..42220dde 100644 --- a/plugins/validatebutton/static/js/validatebutton.js +++ b/plugins/validatebutton/static/js/validatebutton.js @@ -5,7 +5,7 @@ (function($){ var debug=false; - debug=true +// debug=true var ValidateButton = Plugin.extend({ @@ -15,16 +15,23 @@ this.triggered=false; }, + // Could be the default in parent + on_query_in_progress: function() { + this.spin(); + }, + // we have received at least one answer: we'll do something on_new_record: function (record) { // we only need to act on the first record if (this.triggered) return; if (debug) messages.debug("validatebutton.on_query_done - turning on "+this.options.button_domid); $('#'+this.options.button_domid).removeClass('disabled'); + this.unspin(); this.triggered=true; }, // for reference only, since there is nothing we need to do at this point on_query_done: function() { + if (!this.triggered) this.unspin(); }, }); -- 2.43.0