You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/12/18 19:08:31 UTC

fauxton commit: updated refs/heads/master to 7e99366

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master cfdc7f98f -> 7e99366c4


Fix for lookahead tray redirect problem

This fixes the following problem. To reproduce:
1. On the All Docs page of a database, edit a document.
2. Click Back.
3. Use the lookahead tray to select a new database.

Result: the page was missing content. What was going on was that the
route object ended up listening to the event multiple times, causing
the error. This now explicitly cleans up and re-assigns the listeners
for this scenario.

Closes COUCHDB-2503


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/7e99366c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/7e99366c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/7e99366c

Branch: refs/heads/master
Commit: 7e99366c46dcda47f40071508414910c4438cd02
Parents: cfdc7f9
Author: Benjamin Keen <be...@gmail.com>
Authored: Wed Dec 17 13:03:46 2014 -0800
Committer: Benjamin Keen <be...@gmail.com>
Committed: Thu Dec 18 10:07:05 2014 -0800

----------------------------------------------------------------------
 app/addons/documents/routes-documents.js | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7e99366c/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index f38e06f..7c02bba 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -15,7 +15,6 @@ define([
   "api",
 
   // Modules
-  //views
   "addons/documents/views",
   "addons/documents/views-changes",
   "addons/documents/views-index",
@@ -93,7 +92,7 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resou
 
     initialize: function (route, masterLayout, options) {
       this.initViews(options[0]);
-      this.listenTo(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
+      this.listenToLookaheadTray();
     },
 
     establish: function () {
@@ -146,9 +145,18 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resou
     onSelectDatabase: function (dbName) {
       this.cleanup();
       this.initViews(dbName);
+
       FauxtonAPI.navigate('/database/' + app.utils.safeURLName(dbName) + '/_all_docs', {
         trigger: true
       });
+
+      // we need to start listening again because cleanup() removed the listener, but in this case
+      // initialize() doesn't fire to re-set up the listener
+      this.listenToLookaheadTray();
+    },
+
+    listenToLookaheadTray: function () {
+      this.listenTo(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
     },
 
     setUpDropdown: function() {
@@ -214,7 +222,7 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resou
       this.apiUrl = [designDocInfo.url('apiurl'), designDocInfo.documentation()];
     },
 
-    tempFn:  function(databaseName, ddoc, fn){
+    tempFn: function(databaseName, ddoc, fn){
       this.setView("#dashboard-upper-content", new Documents.Views.temp({}));
       this.crumbs = function () {
         return [
@@ -609,6 +617,9 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resou
       if (this.footer) {
         this.removeView('#footer');
       }
+
+      // we're no longer interested in listening to the lookahead tray event on this route object
+      this.stopListening(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
     }
 
   });