FIX: shows parent category name in title anchor (#7576)

This commit is contained in:
Joffrey JAFFEUX 2019-05-21 08:33:22 +02:00 committed by GitHub
parent 8360415453
commit 236adc9ccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -110,14 +110,22 @@ export default (filterArg, params) => {
},
titleToken() {
const category = this.currentModel.category,
filterText = I18n.t(
"filters." + this.filter(category).replace("/", ".") + ".title"
);
const category = this.currentModel.category;
const filterText = I18n.t(
"filters." + this.filter(category).replace("/", ".") + ".title"
);
let categoryName = category.name;
if (category.parent_category_id) {
const list = Category.list();
const parentCategory = list.findBy("id", category.parent_category_id);
categoryName = `${parentCategory.name}/${categoryName}`;
}
return I18n.t("filters.with_category", {
filter: filterText,
category: category.get("name")
category: categoryName
});
},