mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Explicitly allow NavItem customization (#17061)
Allow overriding NavItem's title and displayName. Fixes multiple instances of `computed-property.override` warnings in plugins.
This commit is contained in:
@@ -17,12 +17,27 @@ import { reads } from "@ember/object/computed";
|
||||
|
||||
const NavItem = EmberObject.extend({
|
||||
@discourseComputed("name")
|
||||
title(name) {
|
||||
title: {
|
||||
get(name) {
|
||||
if (this._title) {
|
||||
return this._title;
|
||||
}
|
||||
|
||||
return I18n.t("filters." + name.replace("/", ".") + ".help", {});
|
||||
},
|
||||
|
||||
set(value) {
|
||||
this.set("_title", value);
|
||||
},
|
||||
},
|
||||
|
||||
@discourseComputed("name", "count")
|
||||
displayName(name, count) {
|
||||
displayName: {
|
||||
get(name, count) {
|
||||
if (this._displayName) {
|
||||
return this._displayName;
|
||||
}
|
||||
|
||||
count = count || 0;
|
||||
|
||||
if (
|
||||
@@ -40,6 +55,11 @@ const NavItem = EmberObject.extend({
|
||||
);
|
||||
},
|
||||
|
||||
set(value) {
|
||||
this.set("_displayName", value);
|
||||
},
|
||||
},
|
||||
|
||||
@discourseComputed("filterType", "category", "noSubcategories", "tagId")
|
||||
href(filterType, category, noSubcategories, tagId) {
|
||||
let customHref = null;
|
||||
|
||||
Reference in New Issue
Block a user