DEV: Use new filterType property where possible
This commit is contained in:
parent
585a229d3f
commit
5762498391
|
@ -28,17 +28,8 @@ export default Component.extend(FilterModeMixin, {
|
|||
@discourseComputed("category.can_edit")
|
||||
showCategoryEdit: canEdit => canEdit,
|
||||
|
||||
@discourseComputed("filterMode", "category", "noSubcategories")
|
||||
navItems(filterMode, category, noSubcategories) {
|
||||
const filterModeParts = filterMode.split("/");
|
||||
if (
|
||||
filterModeParts.length >= 2 &&
|
||||
filterModeParts[filterModeParts.length - 2] === "top"
|
||||
) {
|
||||
filterModeParts.pop();
|
||||
filterMode = filterModeParts.join("/");
|
||||
}
|
||||
|
||||
@discourseComputed("filterType", "category", "noSubcategories")
|
||||
navItems(filterType, category, noSubcategories) {
|
||||
let params;
|
||||
const currentRouteQueryParams = this.get("router.currentRoute.queryParams");
|
||||
if (this.persistedQueryParams && currentRouteQueryParams) {
|
||||
|
@ -54,7 +45,7 @@ export default Component.extend(FilterModeMixin, {
|
|||
}
|
||||
|
||||
return NavItem.buildList(category, {
|
||||
filterMode,
|
||||
filterType,
|
||||
noSubcategories,
|
||||
persistedQueryParams: params
|
||||
});
|
||||
|
|
|
@ -18,21 +18,11 @@ export default Component.extend(FilterModeMixin, {
|
|||
this.set("connectors", renderedConnectorsFor("extra-nav-item", null, this));
|
||||
},
|
||||
|
||||
@discourseComputed("filterMode", "navItems")
|
||||
selectedNavItem(filterMode, navItems) {
|
||||
const filterModeParts = filterMode.split("/");
|
||||
if (
|
||||
filterModeParts.length >= 2 &&
|
||||
filterModeParts[filterModeParts.length - 2] === "top"
|
||||
) {
|
||||
filterModeParts.pop();
|
||||
filterMode = filterModeParts.join("/");
|
||||
}
|
||||
|
||||
@discourseComputed("filterType", "navItems")
|
||||
selectedNavItem(filterType, navItems) {
|
||||
let item = navItems.find(i => i.active === true);
|
||||
|
||||
item =
|
||||
item || navItems.find(i => i.get("filterMode").indexOf(filterMode) === 0);
|
||||
item = item || navItems.find(i => i.get("filterType") === filterType);
|
||||
|
||||
if (!item) {
|
||||
let connectors = this.connectors;
|
||||
|
@ -45,7 +35,7 @@ export default Component.extend(FilterModeMixin, {
|
|||
typeof (c.connectorClass.displayName === "function")
|
||||
) {
|
||||
let path = c.connectorClass.path(category);
|
||||
if (path.indexOf(filterMode) > 0) {
|
||||
if (path.indexOf(filterType) > 0) {
|
||||
item = {
|
||||
displayName: c.connectorClass.displayName()
|
||||
};
|
||||
|
|
|
@ -17,15 +17,12 @@ export default Component.extend(
|
|||
hidden: false,
|
||||
rerenderTriggers: ["content.count"],
|
||||
|
||||
@discourseComputed("content.filterMode", "filterMode", "content.active")
|
||||
active(contentFilterMode, filterMode, active) {
|
||||
@discourseComputed("content.filterType", "filterType", "content.active")
|
||||
active(contentFilterType, filterType, active) {
|
||||
if (active !== undefined) {
|
||||
return active;
|
||||
}
|
||||
return (
|
||||
contentFilterMode === filterMode ||
|
||||
filterMode.indexOf(contentFilterMode) === 0
|
||||
);
|
||||
return contentFilterType === filterType;
|
||||
},
|
||||
|
||||
buildBuffer(buffer) {
|
||||
|
|
|
@ -65,11 +65,11 @@ export default Controller.extend(BulkTopicSelection, FilterModeMixin, {
|
|||
"q"
|
||||
],
|
||||
|
||||
@discourseComputed("category", "tag.id", "filterMode", "noSubcategories")
|
||||
navItems(category, tagId, filterMode, noSubcategories) {
|
||||
@discourseComputed("category", "tag.id", "filterType", "noSubcategories")
|
||||
navItems(category, tagId, filterType, noSubcategories) {
|
||||
return NavItem.buildList(category, {
|
||||
tagId,
|
||||
filterMode,
|
||||
filterType,
|
||||
noSubcategories
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue