0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Nav helper bug - home page always marked as current

- fixed a bug whereby once you visit the homepage the homepage menu item is always marked as the active page
- this was due to passing the config object being done by reference rather than by value, and therefore setting the selected item was persisted.
This commit is contained in:
ErisDS 2013-07-10 16:54:29 +01:00
parent 53fe5e3ba3
commit 0dd0d20678

View file

@ -6,8 +6,12 @@ coreFilters = function (ghost) {
ghost.registerFilter('ghostNavItems', defaultCoreFilterPriority, function (args) {
var selectedItem;
// Set the nav items based on the config
args.navItems = ghost.config().nav;
// we want to clone the config so the config remains unchanged
// we will need to make this recursive if we start supporting
// hierarchical menus
args.navItems = _.map(ghost.config().nav, function (value) {
return Object.create(value);
});
// Mark the current selected Item
selectedItem = _.find(args.navItems, function (item) {