[pve-devel] [PATCH pve-manager 1/8] add goBack function

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 23 17:54:39 CEST 2015


Add function to go a step back in browsing history.
Also don't use the anim var in setActiveItem when no old appWindow
is defined, as it is undefined in this scope.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/mobile/Workspace.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/www/mobile/Workspace.js b/www/mobile/Workspace.js
index 63c7589..59e4522 100644
--- a/www/mobile/Workspace.js
+++ b/www/mobile/Workspace.js
@@ -74,6 +74,20 @@ Ext.define('PVE.Workspace', { statics: {
 	});
     },
 
+    goBack: function() {
+	var actions = PVE.Workspace.history.getActions(),
+	    lastAction = actions[actions.length - 2];
+
+	var url = '';
+	if(lastAction) {
+	    actions.pop();
+	    url = lastAction.getUrl();
+	}
+
+	// use loadPage directly so we don't cause new additions to the history
+	PVE.Workspace.loadPage(url);
+    },
+
     __setAppWindow: function(comp, dir) {
 
 	var old = PVE.Workspace.appWindow;
@@ -94,7 +108,7 @@ Ext.define('PVE.Workspace', { statics: {
 		}
 	    }, 500);
 	} else {
-	    Ext.Viewport.setActiveItem(PVE.Workspace.appWindow, anim);
+	    Ext.Viewport.setActiveItem(PVE.Workspace.appWindow);
 	}
     },
 
-- 
2.1.4



More information about the pve-devel mailing list