couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to 057f2f1
Date Wed, 05 Nov 2014 10:46:46 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 20d635676 -> 057f2f193


Fixes back button from edit document

Closes COUCHDB-2427


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

Branch: refs/heads/master
Commit: 057f2f19309deb0082dc89881a21fa0b409d3179
Parents: 20d6356
Author: Michelle Phung <michellephung@gmail.com>
Authored: Tue Nov 4 11:39:52 2014 -0500
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Wed Nov 5 11:46:11 2014 +0100

----------------------------------------------------------------------
 app/addons/documents/templates/code_editor.html |  2 +-
 app/addons/documents/views-doceditor.js         | 10 ++++++++--
 app/core/router.js                              |  9 +++++++++
 3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/057f2f19/app/addons/documents/templates/code_editor.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/code_editor.html b/app/addons/documents/templates/code_editor.html
index 977bacf..2397157 100644
--- a/app/addons/documents/templates/code_editor.html
+++ b/app/addons/documents/templates/code_editor.html
@@ -18,7 +18,7 @@ the License.
 <div id="doc-actions" class="nav">
   <div class="span3">
     <button class="save-doc btn btn-success save" type="button"><i class="icon fonticon-ok-circled"></i>
Save</button>
-    <button class="btn cancel-button">Back to _all_docs</button>
+    <button class="btn cancel-button">Back</button>
   </div>
 
   <div class="span7">

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/057f2f19/app/addons/documents/views-doceditor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js
index bd15596..57447b7 100644
--- a/app/addons/documents/views-doceditor.js
+++ b/app/addons/documents/views-doceditor.js
@@ -221,8 +221,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, resizeColumns,
prett
       _.bindAll(this);
     },
 
-    goback: function(){
-      FauxtonAPI.navigate(this.database.url("index") + "?limit=100");
+    goback: function () {
+      var lastPageLength = FauxtonAPI.router.lastPage.length;
+
+      if ( lastPageLength < 2 ) {
+        FauxtonAPI.navigate( this.database.url('index') + '?limit=100' );
+      }else{
+        window.history.back();
+      }
     },
 
     determineStringEditMatch: function(event) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/057f2f19/app/core/router.js
----------------------------------------------------------------------
diff --git a/app/core/router.js b/app/core/router.js
index 5281343..49190cb 100644
--- a/app/core/router.js
+++ b/app/core/router.js
@@ -97,6 +97,15 @@ function(FauxtonAPI, Auth, Backbone) {
 
       $(FauxtonAPI.el).html(FauxtonAPI.masterLayout.el);
       FauxtonAPI.masterLayout.render();
+
+      this.lastPage = [];
+      //keep last pages visited in Fauxton
+      Backbone.history.on('route', function () { 
+        this.lastPage.push(Backbone.history.fragment);
+        if (this.lastPage.length > 2) {
+          this.lastPage.shift();
+        }
+      }, this);
     },
 
     triggerRouteEvent: function(event, args) {


Mime
View raw message