Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7D8BD10A86 for ; Fri, 5 Dec 2014 19:48:32 +0000 (UTC) Received: (qmail 77942 invoked by uid 500); 5 Dec 2014 19:48:32 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 77890 invoked by uid 500); 5 Dec 2014 19:48:32 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 77881 invoked by uid 99); 5 Dec 2014 19:48:32 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Dec 2014 19:48:32 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1D36F951C6B; Fri, 5 Dec 2014 19:48:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: benkeen@apache.org To: commits@couchdb.apache.org Message-Id: <559680a6aebb4de8b7073ea5ca5d92bb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: fauxton commit: updated refs/heads/master to c2e8dbd Date: Fri, 5 Dec 2014 19:48:32 +0000 (UTC) Repository: couchdb-fauxton Updated Branches: refs/heads/master fbff1116f -> c2e8dbd02 Recognize manual URL changes on doc editor page This ticket lets users manually change the URL on the doc editor page and have the page automatically load the new doc. Closes COUCHDB-2490 Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/c2e8dbd0 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/c2e8dbd0 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/c2e8dbd0 Branch: refs/heads/master Commit: c2e8dbd0294b4c7de914904c7f75c17dbf54d016 Parents: fbff111 Author: Benjamin Keen Authored: Thu Dec 4 09:47:59 2014 -0800 Committer: Benjamin Keen Committed: Fri Dec 5 11:48:39 2014 -0800 ---------------------------------------------------------------------- app/addons/documents/routes-doc-editor.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c2e8dbd0/app/addons/documents/routes-doc-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js index a4fa44c..83cca0b 100644 --- a/app/addons/documents/routes-doc-editor.js +++ b/app/addons/documents/routes-doc-editor.js @@ -30,15 +30,11 @@ function(app, FauxtonAPI, Documents, DocEditor, Databases) { selectedHeader: "Databases", initialize: function(route, masterLayout, options) { - var databaseName = options[0]; - this.docID = options[1]||'new'; + this.databaseName = options[0]; + this.docID = options[1] || 'new'; - this.database = this.database || new Databases.Model({id: databaseName}); - this.doc = new Documents.Doc({ - _id: this.docID - }, { - database: this.database - }); + this.database = this.database || new Databases.Model({ id: this.databaseName }); + this.doc = new Documents.Doc({ _id: this.docID }, { database: this.database }); }, routes: { @@ -59,6 +55,17 @@ function(app, FauxtonAPI, Documents, DocEditor, Databases) { }, code_editor: function (database, doc) { + + // if either the database or document just changed, we need to get the latest doc/db info + if (this.databaseName !== database) { + this.databaseName = database; + this.database = new Databases.Model({ id: this.databaseName }); + } + if (this.docID !== doc) { + this.docID = doc; + this.doc = new Documents.Doc({ _id: this.docID }, { database: this.database }); + } + this.docView = this.setView("#dashboard-content", new DocEditor.CodeEditor({ model: this.doc, database: this.database