From f6447a3f18a3a1ee51cd488af7e65b51f10c0131 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Fri, 11 Dec 2009 18:58:12 +0000 Subject: Futon: Improve storage of session state by storing short-term settings in the window.name. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@889766 13f79535-47bb-0310-9956-ffa450edef68 --- share/Makefile.am | 1 - share/www/config.html | 1 - share/www/couch_tests.html | 1 - share/www/custom_test.html | 1 - share/www/database.html | 22 +++---- share/www/document.html | 1 - share/www/index.html | 5 +- share/www/replicator.html | 1 - share/www/script/futon.browse.js | 39 ++++++++---- share/www/script/futon.js | 121 ++++++++++++++++++++++++++++++++++--- share/www/script/jquery.cookies.js | 50 --------------- share/www/status.html | 7 ++- 12 files changed, 151 insertions(+), 99 deletions(-) delete mode 100644 share/www/script/jquery.cookies.js (limited to 'share') diff --git a/share/Makefile.am b/share/Makefile.am index 0d5e585e..e32f09c3 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -84,7 +84,6 @@ nobase_dist_localdata_DATA = \ www/script/futon.browse.js \ www/script/futon.format.js \ www/script/futon.js \ - www/script/jquery.cookies.js \ www/script/jquery.couch.js \ www/script/jquery.dialog.js \ www/script/jquery.editinline.js \ diff --git a/share/www/config.html b/share/www/config.html index 53e52c4a..f324c923 100644 --- a/share/www/config.html +++ b/share/www/config.html @@ -20,7 +20,6 @@ specific language governing permissions and limitations under the License. - diff --git a/share/www/couch_tests.html b/share/www/couch_tests.html index 9064a88d..d34e3f8c 100644 --- a/share/www/couch_tests.html +++ b/share/www/couch_tests.html @@ -20,7 +20,6 @@ specific language governing permissions and limitations under the License. - diff --git a/share/www/custom_test.html b/share/www/custom_test.html index 41d1a4a1..21d33ea5 100644 --- a/share/www/custom_test.html +++ b/share/www/custom_test.html @@ -20,7 +20,6 @@ specific language governing permissions and limitations under the License. - diff --git a/share/www/database.html b/share/www/database.html index c44d83fc..a4dedfcf 100644 --- a/share/www/database.html +++ b/share/www/database.html @@ -20,7 +20,6 @@ specific language governing permissions and limitations under the License. - @@ -70,13 +69,10 @@ specific language governing permissions and limitations under the License. horizontal: true }); - // Restore preferences/state from cookies - var desc = $.cookies.get(page.db.name + ".desc"); - if (desc) $("#documents thead th.key").addClass("desc"); - var reduce = $.cookies.get(page.db.name + ".doreduce"); - $("#reduce :checkbox")[0].checked = reduce; - var rowsPerPage = $.cookies.get(page.db.name + ".perpage"); - if (rowsPerPage) $("#perpage").val(rowsPerPage); + // Restore preferences/state + $("#documents thead th.key").toggleClass("desc", $.futon.storage.get("desc")); + $("#reduce :checkbox")[0].checked = $.futon.storage.get("reduce"); + $("#perpage").val($.futon.storage.get("per_page")); page.populateViewsMenu(); page.populateViewEditor(); @@ -87,7 +83,7 @@ specific language governing permissions and limitations under the License. $("#switch select").change(function() { var viewName = $(this).val(); - if (!viewName) $.cookies.remove(page.db.name + ".view"); + if (!viewName) $.futon.storage.del("view"); location.href = "?" + encodeURIComponent(page.db.name) + (viewName ? "/" + viewName : ""); }); @@ -97,15 +93,11 @@ specific language governing permissions and limitations under the License. }); $("#reduce :checkbox").click(function() { page.updateDocumentListing(); - if (this.checked) { - $.cookies.set(page.db.name + ".doreduce", "1"); - } else { - $.cookies.remove(page.db.name + ".doreduce"); - } + $.futon.storage.set("reduce", this.checked); }); $("#perpage").change(function() { page.updateDocumentListing(); - $.cookies.set(page.db.name + ".perpage", this.value); + $.futon.storage.set("per_page", this.value); }); $("#toolbar button.add").click(page.newDocument); $("#toolbar button.compact").click(page.compactDatabase); diff --git a/share/www/document.html b/share/www/document.html index 57d458d4..2202f170 100644 --- a/share/www/document.html +++ b/share/www/document.html @@ -20,7 +20,6 @@ specific language governing permissions and limitations under the License. - diff --git a/share/www/index.html b/share/www/index.html index 3255767f..8115bc4d 100644 --- a/share/www/index.html +++ b/share/www/index.html @@ -20,7 +20,6 @@ specific language governing permissions and limitations under the License. - @@ -34,11 +33,11 @@ specific language governing permissions and limitations under the License. this.updateSelection(location.pathname + "index.html"); }); } - var dbsPerPage = $.cookies.get("perpage"); + var dbsPerPage = $.futon.storage.get("per_page"); if (dbsPerPage) $("#perpage").val(dbsPerPage); $("#perpage").change(function() { page.updateDatabaseListing(); - $.cookies.set("perpage", this.value); + $.futon.storage.set("per_page", this.value); }); page.updateDatabaseListing(); diff --git a/share/www/replicator.html b/share/www/replicator.html index d5873d3c..3516128d 100644 --- a/share/www/replicator.html +++ b/share/www/replicator.html @@ -20,7 +20,6 @@ specific language governing permissions and limitations under the License. - - @@ -52,6 +51,8 @@ specific language governing permissions and limitations under the License.