mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36: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:
parent
53fe5e3ba3
commit
0dd0d20678
1 changed files with 6 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue