From f6507e21f87f962c7e7731123450914aa12e227d Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Wed, 22 Jul 2009 09:03:40 +0000 Subject: Change document creation in Futon so that it no longer prompts for a document ID, but simply opens the document page for an empty (and unsaved) document, and allows you to modify the ID. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@796635 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/jquery.couch.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'share/www/script/jquery.couch.js') diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index 1d83a91d..0b5d4eab 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -22,6 +22,8 @@ return encodeURIComponent(docID); } + uuidCache = []; + $.extend($.couch, { activeTasks: function(options) { ajax( @@ -242,6 +244,22 @@ options, "Replication failed" ); + }, + + newUUID: function(cacheNum) { + if (cacheNum === undefined) { + cacheNum = 1; + } + if (!uuidCache.length) { + ajax({url: "/_uuids", data: {count: cacheNum}, async: false}, { + success: function(resp) { + uuidCache = resp.uuids + } + }, + "Failed to retrieve UUID batch." + ); + } + return uuidCache.shift(); } }); -- cgit v1.2.3