move title computed property back to nav-item so it can be overriden in a plugin

This commit is contained in:
Régis Hanol 2017-08-07 09:53:03 +02:00
parent 22a1db7b8a
commit ce7d97a9a8
2 changed files with 13 additions and 13 deletions

View File

@ -4,22 +4,10 @@ import { bufferedRender } from 'discourse-common/lib/buffered-render';
export default Ember.Component.extend(bufferedRender({
tagName: 'li',
classNameBindings: ['active', 'content.hasIcon:has-icon'],
attributeBindings: ['title'],
attributeBindings: ['content.title:title'],
hidden: Em.computed.not('content.visible'),
rerenderTriggers: ['content.count'],
@computed("content.categoryName", "content.name")
title(categoryName, name) {
const extra = {};
if (categoryName) {
name = "category";
extra.categoryName = categoryName;
}
return I18n.t("filters." + name.replace("/", ".") + ".help", extra);
},
@computed("content.filterMode", "filterMode")
active(contentFilterMode, filterMode) {
return contentFilterMode === filterMode ||

View File

@ -3,6 +3,18 @@ import computed from 'ember-addons/ember-computed-decorators';
const NavItem = Discourse.Model.extend({
@computed("categoryName", "name")
title(categoryName, name) {
const extra = {};
if (categoryName) {
name = "category";
extra.categoryName = categoryName;
}
return I18n.t("filters." + name.replace("/", ".") + ".help", extra);
},
@computed("categoryName", "name", "count")
displayName(categoryName, name, count) {
count = count || 0;