Created
July 16, 2014 16:50
-
-
Save CoryChaplin/e629c502598744d47475 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
panels: function() { | |
var panel_access = []; | |
this.model.panels.on('active', function() { | |
var panel = _kiwi.app.panels().active, | |
panel_index; | |
panel_index = _.indexOf(panel_access, panel.cid); | |
if (panel_index > -1) { | |
panel_access.splice(panel_index, 1); | |
} | |
//Make this panel the most recently accessed | |
panel_access.unshift(panel.cid); | |
}); | |
this.model.panels.on('close', function(test) { | |
// If closing the active panel, switch to the last-accessed panel | |
if (panel_access[0] === _kiwi.app.panels().active.cid) { | |
panel_access.shift(); | |
//Get the last-accessed panel model now that we removed the closed one | |
var model = kiwi.connections.active_connection.panels.getByCid(panel_access[0]); | |
if (model) { | |
model.view.show(); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment