add goBack function

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@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2015-09-23 17:54:39 +02:00 committed by Dietmar Maurer
parent ab3cc94ae5
commit 4a3d71016d

View File

@ -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);
}
},