From c1e82e7442ee129bb2bab96c4bd20c2c3206c9c1 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 13 Nov 2018 13:35:45 +0100 Subject: [PATCH] FIX: category row title (#6597) --- .../select-kit/components/category-row.js.es6 | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/select-kit/components/category-row.js.es6 b/app/assets/javascripts/select-kit/components/category-row.js.es6 index e9150dda8ce..b67b0f9f4e3 100644 --- a/app/assets/javascripts/select-kit/components/category-row.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-row.js.es6 @@ -20,10 +20,9 @@ export default SelectKitRowComponent.extend({ return displayCategoryDescription; }, - @computed("description", "category.name") - title(categoryDescription, categoryName) { - if (categoryDescription) return categoryDescription; - return categoryName; + @computed("descriptionText", "description", "category.name") + title(descriptionText, description, name) { + return descriptionText || description || name; }, @computed("computedContent.value", "computedContent.name") @@ -84,12 +83,23 @@ export default SelectKitRowComponent.extend({ return displayCategoryDescription && description && description !== "null"; }, + @computed("category.description_text") + descriptionText(description) { + if (description) { + return this._formatCategoryDescription(description); + } + }, + @computed("category.description") description(description) { if (description) { - return `${description.substr(0, 200)}${ - description.length > 200 ? "…" : "" - }`; + return this._formatCategoryDescription(description); } + }, + + _formatCategoryDescription(description) { + return `${description.substr(0, 200)}${ + description.length > 200 ? "…" : "" + }`; } });