couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [2/3] fauxton commit: updated refs/heads/master to c74ea9c
Date Mon, 13 Jun 2016 14:07:48 GMT
add redirect option to router

PR: #728
PR-URL: https://github.com/apache/couchdb-fauxton/pull/728
Reviewed-By: garren smith <garren.smith@gmail.com>


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

Branch: refs/heads/master
Commit: 6a442954118a3a29eb7c5d3279f52a863eeb9d30
Parents: 049d6ca
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Mon Jun 13 12:32:52 2016 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Mon Jun 13 16:07:06 2016 +0200

----------------------------------------------------------------------
 app/core/router.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6a442954/app/core/router.js
----------------------------------------------------------------------
diff --git a/app/core/router.js b/app/core/router.js
index 35cbc6d..9c242b9 100644
--- a/app/core/router.js
+++ b/app/core/router.js
@@ -27,18 +27,23 @@ export default Backbone.Router.extend({
     delete beforeUnloads[name];
   },
 
-  navigate: function (fragment, trigger) {
-    var continueNav  = true,
-        msg = _.find(_.map(beforeUnloads, function (fn) { return fn(); }), function (beforeReturn)
{
-          if (beforeReturn) { return true; }
-        });
+
+  navigate: function (fragment, options) {
+    let continueNav = true;
+    const msg = _.find(_.map(beforeUnloads, function (fn) { return fn(); }), function (beforeReturn)
{
+      if (beforeReturn) { return true; }
+    });
 
     if (msg) {
       continueNav = window.confirm(msg);
     }
 
+    if (options && options.redirect) {
+      return window.location = fragment;
+    }
+
     if (continueNav) {
-      Backbone.Router.prototype.navigate(fragment, trigger);
+      Backbone.Router.prototype.navigate(fragment, options);
     }
   },
 


Mime
View raw message