couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r733104 - in /couchdb/trunk/share: ./ www/ www/image/ www/script/ www/style/
Date Fri, 09 Jan 2009 18:20:38 GMT
Author: cmlenz
Date: Fri Jan  9 10:20:37 2009
New Revision: 733104

URL: http://svn.apache.org/viewvc?rev=733104&view=rev
Log:
Refactoring in Futon to clean up interactions between specific pages and the navigation. Also,
switched some graphics over to PNGs with alpha-transparency (screw you IE6), and added a button
for removing databases from the recent databases list.

Added:
    couchdb/trunk/share/www/image/add.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/add.gif
    couchdb/trunk/share/www/image/compact.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/compact.gif
    couchdb/trunk/share/www/image/delete-mini.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/delete-mini.gif
    couchdb/trunk/share/www/image/delete.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/delete.gif
    couchdb/trunk/share/www/image/load.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/load.gif
    couchdb/trunk/share/www/image/run-mini.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/run-mini.gif
    couchdb/trunk/share/www/image/run.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/run.gif
    couchdb/trunk/share/www/image/running.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/running.gif
    couchdb/trunk/share/www/image/save.png
      - copied, changed from r732843, couchdb/trunk/share/www/image/save.gif
    couchdb/trunk/share/www/script/futon.js
Removed:
    couchdb/trunk/share/www/image/add.gif
    couchdb/trunk/share/www/image/compact.gif
    couchdb/trunk/share/www/image/delete-mini.gif
    couchdb/trunk/share/www/image/delete.gif
    couchdb/trunk/share/www/image/load.gif
    couchdb/trunk/share/www/image/run-mini.gif
    couchdb/trunk/share/www/image/run.gif
    couchdb/trunk/share/www/image/running.gif
    couchdb/trunk/share/www/image/save.gif
Modified:
    couchdb/trunk/share/Makefile.am
    couchdb/trunk/share/www/_sidebar.html
    couchdb/trunk/share/www/config.html
    couchdb/trunk/share/www/couch_tests.html
    couchdb/trunk/share/www/database.html
    couchdb/trunk/share/www/document.html
    couchdb/trunk/share/www/index.html
    couchdb/trunk/share/www/replicator.html
    couchdb/trunk/share/www/script/browse.js
    couchdb/trunk/share/www/style/layout.css

Modified: couchdb/trunk/share/Makefile.am
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/Makefile.am?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/Makefile.am (original)
+++ couchdb/trunk/share/Makefile.am Fri Jan  9 10:20:37 2009
@@ -21,25 +21,25 @@
     www/dialog/_upload_attachment.html \
     www/couch_tests.html \
     www/favicon.ico \
-    www/image/add.gif \
+    www/image/add.png \
     www/image/apply.gif \
     www/image/bg.png \
     www/image/cancel.gif \
-    www/image/compact.gif \
-    www/image/delete-mini.gif \
-    www/image/delete.gif \
+    www/image/compact.png \
+    www/image/delete-mini.png \
+    www/image/delete.png \
     www/image/grippie.gif \
     www/image/hgrad.gif \
-    www/image/load.gif \
+    www/image/load.png \
     www/image/logo.png \
     www/image/order-asc.gif \
     www/image/order-desc.gif \
     www/image/path.gif \
     www/image/progress.gif \
-    www/image/run-mini.gif \
-    www/image/run.gif \
-    www/image/running.gif \
-    www/image/save.gif \
+    www/image/run-mini.png \
+    www/image/run.png \
+    www/image/running.png \
+    www/image/save.png \
     www/image/spinner.gif \
     www/image/test_failure.gif \
     www/image/test_success.gif \
@@ -58,6 +58,7 @@
     www/script/couch.js \
     www/script/couch_tests.js \
     www/script/couch_test_runner.js \
+    www/script/futon.js \
     www/script/jquery.js \
     www/script/jquery.cookies.js \
     www/script/jquery.couch.js \

Modified: couchdb/trunk/share/www/_sidebar.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/_sidebar.html?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/_sidebar.html (original)
+++ couchdb/trunk/share/www/_sidebar.html Fri Jan  9 10:20:37 2009
@@ -18,48 +18,3 @@
     <span id="version">?</span>
   </div>
 </div>
-<script type="text/javascript">
-  function updateNavigation(path, queryString) {
-    function fixupPath(path) { // hack for IE/Win
-      return (path.charAt(0) != "/") ? ("/" + path) : path;
-    }
-    if (!path) {
-      path = location.pathname;
-      if (!queryString) {
-        queryString = location.search;
-      }
-    } else if (!queryString) {
-      queryString = "";
-    }
-    var href = fixupPath(path + queryString);
-    $("#nav li").removeClass("selected");
-    $("#nav li a").each(function() {
-      if (fixupPath(this.pathname) + this.search != href) return;
-      $(this).parent("li").addClass("selected").parents("li").addClass("selected");
-    });
-  }
-
-  function updateRecentDatabasesList() {
-    $("#dbs").empty();
-    var recentDbs = $.cookies.get("recent", "").split(",");
-    recentDbs.sort();
-    $.each(recentDbs, function(idx, name) {
-      if (name) {
-        $("#dbs").append("<li><a href='database.html?" +
-          encodeURIComponent(name) + "'>" + name +
-          "</a></li>");
-      }
-    });
-  }
-
-  $(function() {
-    document.title = "Apache CouchDB - Futon: " + document.title;
-    $.couch.info({
-      success: function(info, status) {
-        $("#version").text(info.version);
-      }
-    });
-    updateRecentDatabasesList();
-    updateNavigation();
-  });
-</script>

Modified: couchdb/trunk/share/www/config.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/config.html?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/config.html (original)
+++ couchdb/trunk/share/www/config.html Fri Jan  9 10:20:37 2009
@@ -22,13 +22,10 @@
     <script src="script/jquery.js?1.2.6"></script>
     <script src="script/jquery.cookies.js?0.9.0"></script>
     <script src="script/jquery.couch.js?0.9.0"></script>
+    <script src="script/futon.js?0.9.0"></script>
     <script src="script/pprint.js?0.9.0"></script>
     <script>
       $(document).ready(function() {
-        $.get("_sidebar.html", function(resp) {
-          $(resp).insertAfter("#wrap");
-        });
-
         $(document.body).addClass("loading");
         $.couch.config({
           success: function(resp) {

Modified: couchdb/trunk/share/www/couch_tests.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/couch_tests.html?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/couch_tests.html [utf-8] (original)
+++ couchdb/trunk/share/www/couch_tests.html [utf-8] Fri Jan  9 10:20:37 2009
@@ -23,14 +23,11 @@
     <script src="script/jquery.cookies.js?0.9.0"></script>
     <script src="script/jquery.couch.js?0.9.0"></script>
     <script src="script/couch.js?0.9.0"></script>
+    <script src="script/futon.js?0.9.0"></script>
     <script src="script/pprint.js?0.9.0"></script>
     <script src="script/couch_test_runner.js"></script>
     <script>
       $(function() {        
-        $.get("_sidebar.html", function(resp) {
-          $(resp).insertAfter("#wrap");
-        });
-
         updateTestsListing();
         $("#toolbar button.run").click(runAllTests);
         $("#toolbar button.load").click(function() {

Modified: couchdb/trunk/share/www/database.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/database.html?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/database.html [utf-8] (original)
+++ couchdb/trunk/share/www/database.html [utf-8] Fri Jan  9 10:20:37 2009
@@ -25,23 +25,15 @@
     <script src="script/jquery.dialog.js?0.9.0"></script>
     <script src="script/jquery.resizer.js?0.9.0"></script>
     <script src="script/jquery.suggest.js?0.9.0"></script>
+    <script src="script/futon.js?0.9.0"></script>
     <script src="script/browse.js?0.9.0"></script>
     <script src="script/pprint.js?0.9.0"></script>
     <script>
       var page = new CouchDatabasePage();
 
-      $.get("_sidebar.html", function(resp) {
-        $(resp).insertAfter("#wrap");
-
-        var recentDbs = $.cookies.get("recent", "").split(",");
-        if ($.inArray(page.db.name, recentDbs) == -1) {
-          recentDbs.unshift(page.db.name);
-          if (recentDbs.length > 10) recentDbs.length = 10;
-          $.cookies.set("recent", recentDbs.join(","));
-          updateRecentDatabasesList();
-        }
-
-        updateNavigation(location.pathname, "?" + page.db.name);
+      $.futon.navigation.ready(function() {
+        this.addDatabase(page.db.name);
+        this.updateSelection(location.pathname, "?" + page.db.name);
       });
 
       $(function() {
@@ -91,6 +83,7 @@
 
         $("#switch select").change(function() {
           var viewName = $(this).val();
+          console.log(viewName);
           if (!viewName) $.cookies.remove(page.db.name + ".view");
           location.href = "?" + encodeURIComponent(page.db.name) +
             (viewName ? "/" + encodeURIComponent(viewName)  : "");
@@ -118,7 +111,7 @@
     <div id="content">
       <div id="switch">
         <label>Select view: <select autocomplete="false">
-          <option value="">All documents</option>
+          <option value="_all_docs">All documents</option>
           <option value="_design_docs">Design documents</option>
           <option value="_slow_view">Custom query…</option>
         </select></label>

Modified: couchdb/trunk/share/www/document.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/document.html?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/document.html [utf-8] (original)
+++ couchdb/trunk/share/www/document.html [utf-8] Fri Jan  9 10:20:37 2009
@@ -25,20 +25,21 @@
     <script src="script/jquery.dialog.js?0.9.0"></script>
     <script src="script/jquery.form.js?0.9.0"></script>
     <script src="script/jquery.resizer.js?0.9.0"></script>
+    <script src="script/futon.js?0.9.0"></script>
     <script src="script/browse.js?0.9.0"></script>
     <script src="script/pprint.js?0.9.0"></script>
     <script>
       var page = new CouchDocumentPage();
 
-      $(function() {
-        $.get("_sidebar.html", function(resp) {
-          $(resp).insertAfter("#wrap");
-
-          updateNavigation(
-            location.pathname.replace(/document\.html/, "database.html"),
-            "?" + page.db.name);
-        });
+      $.futon.navigation.ready(function() {
+        this.addDatabase(page.db.name);
+        this.updateSelection(
+          location.pathname.replace(/document\.html/, "database.html"),
+          "?" + page.db.name
+        );
+      });
 
+      $(function() {
         $("h1 a.dbname").text(page.dbName)
           .attr("href", "database.html?" + encodeURIComponent(page.db.name));
         $("h1 strong").text(page.docId);

Copied: couchdb/trunk/share/www/image/add.png (from r732843, couchdb/trunk/share/www/image/add.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/add.png?p2=couchdb/trunk/share/www/image/add.png&p1=couchdb/trunk/share/www/image/add.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/compact.png (from r732843, couchdb/trunk/share/www/image/compact.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/compact.png?p2=couchdb/trunk/share/www/image/compact.png&p1=couchdb/trunk/share/www/image/compact.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/delete-mini.png (from r732843, couchdb/trunk/share/www/image/delete-mini.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/delete-mini.png?p2=couchdb/trunk/share/www/image/delete-mini.png&p1=couchdb/trunk/share/www/image/delete-mini.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/delete.png (from r732843, couchdb/trunk/share/www/image/delete.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/delete.png?p2=couchdb/trunk/share/www/image/delete.png&p1=couchdb/trunk/share/www/image/delete.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/load.png (from r732843, couchdb/trunk/share/www/image/load.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/load.png?p2=couchdb/trunk/share/www/image/load.png&p1=couchdb/trunk/share/www/image/load.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/run-mini.png (from r732843, couchdb/trunk/share/www/image/run-mini.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/run-mini.png?p2=couchdb/trunk/share/www/image/run-mini.png&p1=couchdb/trunk/share/www/image/run-mini.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/run.png (from r732843, couchdb/trunk/share/www/image/run.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/run.png?p2=couchdb/trunk/share/www/image/run.png&p1=couchdb/trunk/share/www/image/run.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/running.png (from r732843, couchdb/trunk/share/www/image/running.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/running.png?p2=couchdb/trunk/share/www/image/running.png&p1=couchdb/trunk/share/www/image/running.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Copied: couchdb/trunk/share/www/image/save.png (from r732843, couchdb/trunk/share/www/image/save.gif)
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/image/save.png?p2=couchdb/trunk/share/www/image/save.png&p1=couchdb/trunk/share/www/image/save.gif&r1=732843&r2=733104&rev=733104&view=diff
==============================================================================
Binary files - no diff available.

Modified: couchdb/trunk/share/www/index.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/index.html?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/index.html [utf-8] (original)
+++ couchdb/trunk/share/www/index.html [utf-8] Fri Jan  9 10:20:37 2009
@@ -23,17 +23,17 @@
     <script src="script/jquery.cookies.js?0.9.0"></script>
     <script src="script/jquery.couch.js?0.9.0"></script>
     <script src="script/jquery.dialog.js?0.9.0"></script>
+    <script src="script/futon.js?0.9.0"></script>
     <script src="script/browse.js?0.9.0"></script>
     <script src="script/pprint.js?0.9.0"></script>
     <script>
       var page = new CouchIndexPage();
       $(document).ready(function() {
-        $.get("_sidebar.html", function(resp) {
-          $(resp).insertAfter("#wrap");
-          if (!/index\.html$/.test(location.pathname)) {
-            updateNavigation(location.pathname + "index.html");
-          }
-        });
+        if (!/index\.html$/.test(location.pathname)) {
+          $.futon.navigation.ready(function() {
+            this.updateSelection(location.pathname + "index.html");
+          });
+        }
         var dbsPerPage = $.cookies.get("perpage");
         if (dbsPerPage) $("#perpage").val(dbsPerPage);
         $("#perpage").change(function() {

Modified: couchdb/trunk/share/www/replicator.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/replicator.html?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/replicator.html [utf-8] (original)
+++ couchdb/trunk/share/www/replicator.html [utf-8] Fri Jan  9 10:20:37 2009
@@ -22,13 +22,10 @@
     <script src="script/jquery.js?1.2.6"></script>
     <script src="script/jquery.cookies.js?0.9.0"></script>
     <script src="script/jquery.couch.js?0.9.0"></script>
+    <script src="script/futon.js?0.9.0"></script>
     <script src="script/pprint.js?0.9.0"></script>
     <script>
       $(document).ready(function() {
-        $.get("_sidebar.html", function(resp) {
-          $(resp).insertAfter("#wrap");
-        });
-
         $("fieldset input[type=radio]").click(function() {
           var radio = this;
           var fieldset = $(this).parents("fieldset").get(0);

Modified: couchdb/trunk/share/www/script/browse.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/browse.js?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/browse.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/browse.js [utf-8] Fri Jan  9 10:20:37 2009
@@ -107,7 +107,10 @@
     viewName = decodeURIComponent(viewName);
     $.cookies.set(dbName + ".view", viewName);
   } else {
-    viewName = $.cookies.get(dbName + ".view") || "";
+    viewName = $.cookies.get(dbName + ".view", "");
+    if (viewName) {
+      location.href = "database.html?" + dbName + "/" + viewName;
+    }
   }
   var db = $.couch.db(dbName);
 
@@ -157,15 +160,7 @@
               $("#dbs li").filter(function(index) {
                 return $("a", this).text() == dbName;
               }).remove();
-
-              // remove database from recent databases list
-              var recentDbs = $.cookies.get("recent", "").split(",");
-              var recentIdx = $.inArray(db.name, recentDbs)
-              if (recentIdx >= 0) {
-                recentDbs.splice(recentIdx, 1);
-                $.cookies.set("recent", recentDbs.join(","));
-                updateRecentDatabasesList();
-              }
+              $.futon.navigation.removeDatabase(dbName);
             }
           }
         });
@@ -200,6 +195,11 @@
                                  .bind("textInput", updateDirtyState);
         }
       });
+    } else if (viewName == "_slow_view") {
+      page.updateViewEditor(
+        $.cookies.get(db.name + ".map"),
+        $.cookies.get(db.name + ".reduce", "")
+      );
     }
   }
 
@@ -252,11 +252,7 @@
         },
         success: function(resp) {
           var viewCode = resp.views[localViewName];
-          $("#viewcode_map").val(viewCode.map);
-          $("#viewcode_reduce").val(viewCode.reduce || "");
-          var lines = Math.max(viewCode.map.split("\n").length,
-                               (viewCode.reduce ? viewCode.reduce.split("\n").length : 1));
-          $("#viewcode textarea").attr("rows", Math.min(15, Math.max(3, lines)));
+          page.updateViewEditor(viewCode.map, viewCode.reduce || "");
           $("#viewcode button.revert, #viewcode button.save").attr("disabled", "disabled");
           page.storedViewCode = viewCode;
           if (callback) callback();
@@ -271,13 +267,24 @@
     }
   }
 
+  this.updateViewEditor = function(mapFun, reduceFun) {
+    if (!mapFun) return;
+    $("#viewcode_map").val(mapFun);
+    $("#viewcode_reduce").val(reduceFun);
+    var lines = Math.max(
+      mapFun.split("\n").length,
+      reduceFun.split("\n").length
+    );
+    $("#viewcode textarea").attr("rows", Math.min(15, Math.max(3, lines)));
+  }
+
   this.saveViewAs = function() {
     if (viewName && /^_design/.test(viewName)) {
       var viewNameParts = viewName.split("/");
       var designDocId = viewNameParts[1];
       var localViewName = viewNameParts[2];
     } else {
-      var designDocId = "", localViewName = ""
+      var designDocId = "", localViewName = "";
     }
     $.showDialog("dialog/_save_view_as.html", {
       load: function(elem) {
@@ -496,7 +503,7 @@
       $(document.body).removeClass("loading");
     }
 
-    if (!viewName) {
+    if (!viewName || viewName == "_all_docs") {
       $("#switch select")[0].selectedIndex = 0;
       db.allDocs(options);
     } else {

Added: couchdb/trunk/share/www/script/futon.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.js?rev=733104&view=auto
==============================================================================
--- couchdb/trunk/share/www/script/futon.js (added)
+++ couchdb/trunk/share/www/script/futon.js Fri Jan  9 10:20:37 2009
@@ -0,0 +1,127 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License.  You may obtain a copy
+// of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+(function($) {
+
+  function Navigation() {
+    var nav = this;
+    this.loaded = false;
+    this.eventHandlers = {
+      load: []
+    };
+
+    this.ready = function(callback) {
+      if (callback) {
+        if (this.loaded) {
+          callback.apply(this);
+        }
+        this.eventHandlers["load"].push(callback);
+      } else {
+        this.loaded = true;
+        callbacks = this.eventHandlers["load"];
+        for (var i = 0; i < callbacks.length; i++) {
+          callbacks[i].apply(this);
+        }
+      }
+    }
+
+    this.addDatabase = function(name) {
+      var recentDbs = $.cookies.get("recent", "").split(",");
+      if ($.inArray(name, recentDbs) == -1) {
+        recentDbs.unshift(name);
+        if (recentDbs.length > 10) recentDbs.length = 10;
+        $.cookies.set("recent", recentDbs.join(","));
+        this.updateDatabases();
+      }
+    }
+
+    this.removeDatabase = function(name) {
+      // remove database from recent databases list
+      var recentDbs = $.cookies.get("recent", "").split(",");
+      var recentIdx = $.inArray(name, recentDbs);
+      if (recentIdx >= 0) {
+        recentDbs.splice(recentIdx, 1);
+        $.cookies.set("recent", recentDbs.join(","));
+        this.updateDatabases();
+      }
+    }
+
+    this.updateDatabases = function() {
+      var selection = null;
+      $("#dbs .selected a").each(function() {
+        selection = [this.pathname, this.search];
+      });
+      $("#dbs").empty();
+      var recentDbs = $.cookies.get("recent", "").split(",");
+      recentDbs.sort();
+      $.each(recentDbs, function(idx, name) {
+        if (name) {
+          $("#dbs").append("<li><a href='database.html?" +
+            encodeURIComponent(name) + "'>" + name +
+            "<button class='remove' title='Remove from list' value='" + name + "'></button>"
+
+            "</a></li>");
+        }
+      });
+      if (selection) {
+        this.updateSelection(selection[0], selection[1]);
+      }
+      $("#dbs button.remove").click(function() {
+        nav.removeDatabase(this.value);
+        return false;
+      });
+    }
+
+    this.updateSelection = function(path, queryString) {
+      function fixupPath(path) { // hack for IE/Win
+        return (path.charAt(0) != "/") ? ("/" + path) : path;
+      }
+      if (!path) {
+        path = location.pathname;
+        if (!queryString) {
+          queryString = location.search;
+        }
+      } else if (!queryString) {
+        queryString = "";
+      }
+      var href = fixupPath(path + queryString);
+      $("#nav li").removeClass("selected");
+      $("#nav li a").each(function() {
+        if (fixupPath(this.pathname) + this.search != href) return;
+        $(this).parent("li").addClass("selected").parents("li").addClass("selected");
+      });
+    }
+
+  }
+
+  $.futon = $.futon || {};
+  $.fn.extend($.futon, {
+    navigation: new Navigation()
+  });
+
+  $(function() {
+    document.title = "Apache CouchDB - Futon: " + document.title;
+    $.get("_sidebar.html", function(resp) {
+      $(resp).insertAfter("#wrap");
+
+      $.futon.navigation.updateDatabases();
+      $.futon.navigation.updateSelection();
+      $.futon.navigation.ready();
+
+      $.couch.info({
+        success: function(info, status) {
+          $("#version").text(info.version);
+        }
+      });
+    });
+  });
+
+})(jQuery);

Modified: couchdb/trunk/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/style/layout.css?rev=733104&r1=733103&r2=733104&view=diff
==============================================================================
--- couchdb/trunk/share/www/style/layout.css (original)
+++ couchdb/trunk/share/www/style/layout.css Fri Jan  9 10:20:37 2009
@@ -163,6 +163,14 @@
 #nav li li.selected :link:hover, #nav li li.selected :visited:hover {
   color: #fff;
 }
+#nav li button { background: transparent 0 0 no-repeat; border: none;
+  cursor: pointer; width: 15px; height: 15px; margin-left: .5em;
+  vertical-align: top;
+}
+#nav li li:hover button.remove {
+  background-image: url(../image/delete-mini.png);
+}
+#nav li button.remove:hover { background-position: -15px 0; }
 
 #footer { background: #ddd; border-top: 1px solid #bbb; color: #000;
   font-size: 80%; opacity: .7; padding: 5px 10px; position: absolute; right: 0;
@@ -185,13 +193,12 @@
 }
 #toolbar button:hover { background-position: 2px -30px; color: #000; }
 #toolbar button:active { background-position: 2px -62px; color: #000; }
-#toolbar button.add { background-image: url(../image/add.gif); }
-#toolbar button.compact { background-image: url(../image/compact.gif); }
-#toolbar button.delete { background-image: url(../image/delete.gif); }
-#toolbar button.edit { background-image: url(../image/edit.gif); }
-#toolbar button.load { background-image: url(../image/load.gif); }
-#toolbar button.run { background-image: url(../image/run.gif); }
-#toolbar button.save { background-image: url(../image/save.gif); }
+#toolbar button.add { background-image: url(../image/add.png); }
+#toolbar button.compact { background-image: url(../image/compact.png); }
+#toolbar button.delete { background-image: url(../image/delete.png); }
+#toolbar button.load { background-image: url(../image/load.png); }
+#toolbar button.run { background-image: url(../image/run.png); }
+#toolbar button.save { background-image: url(../image/save.png); }
 
 /* Dialogs */
 
@@ -344,7 +351,7 @@
 #fields col.field { width: 33%; }
 #fields tbody.content th { padding-left: 25px; padding-right: 48px; }
 #fields tbody.content th button {
-  background-image: url(../image/delete-mini.gif);
+  background-image: url(../image/delete-mini.png);
 }
 #fields tbody.content th b { display: block; padding: 2px; }
 #fields tbody.content td { padding-left: 14px; padding-right: 48px; }
@@ -421,7 +428,7 @@
   background-position: -15px 0;
 }
 #fields tbody.content td ul.attachments li button.delete {
-  background-image: url(../image/delete-mini.gif);
+  background-image: url(../image/delete-mini.png);
 }
 #fields tbody.source td code { display: block; overflow: auto;
   white-space: pre-wrap; width: 100%;
@@ -437,7 +444,7 @@
   white-space: nowrap;
 }
 #tests tbody.content th button {
-  background-image: url(../image/run-mini.gif);
+  background-image: url(../image/run-mini.png);
 }
 #tests tbody.content td.duration { text-align: right; width: 6em; }
 #tests tbody.content td.status { background-position: 5px 8px;
@@ -454,7 +461,7 @@
 #tests tbody.content td.details ol code { color: #c00; font-size: 100%; }
 #tests tbody.content td.details ol code.error { white-space: pre; }
 #tests tbody.content td.running {
-  background-image: url(../image/running.gif); color: #333;
+  background-image: url(../image/running.png); color: #333;
 }
 #tests tbody.content td.success {
   background-image: url(../image/test_success.gif); color: #060;



Mime
View raw message