Add group name classes to tag page so groups can be hidden with CSS (#8118)

This commit is contained in:
Kris 2019-10-21 12:22:19 -04:00 committed by GitHub
parent 835d2be4da
commit 56862f61c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({ export default Ember.Component.extend({
classNameBindings: [":tag-list", "categoryClass"], classNameBindings: [":tag-list", "categoryClass", "tagGroupNameClass"],
isPrivateMessage: false, isPrivateMessage: false,
sortedTags: Ember.computed.sort("tags", "sortProperties"), sortedTags: Ember.computed.sort("tags", "sortProperties"),
@ -19,5 +19,16 @@ export default Ember.Component.extend({
@computed("category.fullSlug") @computed("category.fullSlug")
categoryClass(slug) { categoryClass(slug) {
return slug && `tag-list-${slug}`; return slug && `tag-list-${slug}`;
},
@computed("tagGroupName")
tagGroupNameClass(groupName) {
if (groupName) {
groupName = groupName
.replace(/\s+/g, "-")
.replace(/[!\"#$%&'\(\)\*\+,\.\/:;<=>\?\@\[\\\]\^`\{\|\}~]/g, "")
.toLowerCase();
return groupName && `tag-group-${groupName}`;
}
} }
}); });