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/www/database.html | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'share/www/database.html') 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); -- cgit v1.2.3