DEV: allows customHref for extra nav items (#8012)

* DEV: allowes customHref for extra nav item

* linting

* uses value not key
This commit is contained in:
Joffrey JAFFEUX 2019-08-15 20:26:21 +02:00 committed by Blake Erickson
parent b8f21ea962
commit 00b91de5e8
1 changed files with 13 additions and 2 deletions

View File

@ -101,8 +101,19 @@ const NavItem = Discourse.Model.extend({
});
const ExtraNavItem = NavItem.extend({
@computed("href")
href: href => href,
href: Ember.computed({
set(key, value) {
let customHref;
NavItem.customNavItemHrefs.forEach(function(cb) {
customHref = cb.call(this, this);
if (customHref) {
return false;
}
}, this);
return customHref || value;
}
}),
customFilter: null
});