Skip to content

Commit

Permalink
FIX: category row title (#6597)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux committed Nov 13, 2018
1 parent 4a12cfa commit c1e82e7
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions app/assets/javascripts/select-kit/components/category-row.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 ? "…" : ""
}`;
}
});

1 comment on commit c1e82e7

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/tooltip-on-items-in-categories-dropdown-contains-html-as-text/101908/4

Please sign in to comment.