FIX: Mobile top topic list with a period and a category or tag

This commit is contained in:
Daniel Waterworth 2019-11-21 10:16:19 +00:00
parent 5ad6dc01c1
commit 026832fb80
2 changed files with 15 additions and 5 deletions

View File

@ -29,9 +29,13 @@ export default Component.extend({
@discourseComputed("filterMode", "category", "noSubcategories")
navItems(filterMode, category, noSubcategories) {
// we don't want to show the period in the navigation bar since it's in a dropdown
if (filterMode.indexOf("top/") === 0) {
filterMode = "top";
const filterModeParts = filterMode.split("/");
if (
filterModeParts.length >= 2 &&
filterModeParts[filterModeParts.length - 2] === "top"
) {
filterModeParts.pop();
filterMode = filterModeParts.join("/");
}
let params;

View File

@ -19,9 +19,15 @@ export default Component.extend({
@discourseComputed("filterMode", "navItems")
selectedNavItem(filterMode, navItems) {
if (filterMode.indexOf("top/") === 0) {
filterMode = "top";
const filterModeParts = filterMode.split("/");
if (
filterModeParts.length >= 2 &&
filterModeParts[filterModeParts.length - 2] === "top"
) {
filterModeParts.pop();
filterMode = filterModeParts.join("/");
}
let item = navItems.find(i => i.active === true);
item =