FIX: category row title (#6597)

This commit is contained in:
Joffrey JAFFEUX 2018-11-13 13:35:45 +01:00 committed by GitHub
parent 4a12cfaecb
commit c1e82e7442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 7 deletions

View File

@ -20,10 +20,9 @@ export default SelectKitRowComponent.extend({
return displayCategoryDescription; return displayCategoryDescription;
}, },
@computed("description", "category.name") @computed("descriptionText", "description", "category.name")
title(categoryDescription, categoryName) { title(descriptionText, description, name) {
if (categoryDescription) return categoryDescription; return descriptionText || description || name;
return categoryName;
}, },
@computed("computedContent.value", "computedContent.name") @computed("computedContent.value", "computedContent.name")
@ -84,12 +83,23 @@ export default SelectKitRowComponent.extend({
return displayCategoryDescription && description && description !== "null"; return displayCategoryDescription && description && description !== "null";
}, },
@computed("category.description_text")
descriptionText(description) {
if (description) {
return this._formatCategoryDescription(description);
}
},
@computed("category.description") @computed("category.description")
description(description) { description(description) {
if (description) { if (description) {
return this._formatCategoryDescription(description);
}
},
_formatCategoryDescription(description) {
return `${description.substr(0, 200)}${ return `${description.substr(0, 200)}${
description.length > 200 ? "…" : "" description.length > 200 ? "…" : ""
}`; }`;
} }
}
}); });