Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 4f539862a -> cd91b276a


Query-Tray: Prevent double query submission

Disable button after first click until the tray is reopened

Closes COUCHDB-2378


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/cd91b276
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/cd91b276
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/cd91b276

Branch: refs/heads/master
Commit: cd91b276a09d1295b1f20eb8ad6183e7379e0ab2
Parents: 4f53986
Author: sebastianrothbucher <sebastianrothbuc...@googlemail.com>
Authored: Fri Oct 17 21:18:31 2014 +0200
Committer: sebastianrothbucher <sebastianrothbuc...@googlemail.com>
Committed: Sun Oct 19 11:55:06 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/views-queryoptions.js | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/cd91b276/app/addons/documents/views-queryoptions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-queryoptions.js 
b/app/addons/documents/views-queryoptions.js
index 5bea495..52676f7 100644
--- a/app/addons/documents/views-queryoptions.js
+++ b/app/addons/documents/views-queryoptions.js
@@ -107,6 +107,8 @@ define([
         if (!this.trayIsVisible()) {
           $("#query-options-tray").velocity("transition.slideDownIn", 250); // 
TODO constant
           FauxtonAPI.Events.trigger("APIbar:closeTray");
+          // make sure the query button is active again. As we can only expand 
for completed results, this is sufficient to prevent double submission
+          this.$('#query-options-tray 
button[type="submit"]').removeAttr("disabled");
         }
       },
 
@@ -129,6 +131,9 @@ define([
           return;
         }
 
+        // make sure we can not submit twice which results in chaos (and no 
result ever)
+        this.$('#query-options-tray button[type="submit"]').attr("disabled", 
"disabled");
+
         this.closeTray();
 
         // this may be empty. That's ok! Perhaps the user just did a search 
with params, then removed them & wants the default

Reply via email to