From ae46d1ed6221af19cbc060b879f80d81d227651c Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Fri, 11 Dec 2009 23:00:17 +0000 Subject: Futon: Remember tabular vs. source tab preference in a cookie. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@889846 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/futon.browse.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'share') diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js index 733c9d08..4b033b28 100644 --- a/share/www/script/futon.browse.js +++ b/share/www/script/futon.browse.js @@ -731,6 +731,8 @@ } var db = $.couch.db(dbName); + $.futon.storage.declare("tab", {defaultValue: "tabular", scope: "cookie"}); + this.dbName = dbName; this.db = db; this.docId = docId; @@ -742,13 +744,16 @@ if ($("#fields tbody.source textarea").length > 0) return; + $.futon.storage.set("tab", "tabular"); $("#tabs li").removeClass("active").filter(".tabular").addClass("active"); $("#fields thead th:first").text("Field").attr("colspan", 1).next().show(); $("#fields tbody.content").show(); $("#fields tbody.source").hide(); + return false; } this.activateSourceView = function() { + $.futon.storage.set("tab", "source"); $("#tabs li").removeClass("active").filter(".source").addClass("active"); $("#fields thead th:first").text("Source").attr("colspan", 2).next().hide(); $("#fields tbody.content").hide(); @@ -789,6 +794,7 @@ } }); }).end().show(); + return false; } this.addField = function() { @@ -855,7 +861,7 @@ $("#fields tbody.footer td span").text("Showing revision " + (revs.length - currentIndex) + " of " + revs.length); } - if (location.hash == "#source" && !noReload) { + if ($.futon.storage.get("tab") == "source") { page.activateSourceView(); } } -- cgit v1.2.3