From: Thierry Parmentelat Date: Sat, 14 Dec 2013 10:54:53 +0000 (+0100) Subject: add a spinner to the validatebutton X-Git-Tag: myslice-0.3-0~84 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=38e8b7554af2299c7c709eedb1c3144cc8eefeac add a spinner to the validatebutton --- 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(); }, });