Skip to content

A platform for community discussion. Free, open, simple.

Feature - allow user and group specific cards styling (#5989)

Jeff Wong0c2f590c645c
diff --git a/app/assets/javascripts/discourse/components/group-card-contents.js.es6 b/app/assets/javascripts/discourse/components/group-card-contents.js.es6
index e21410fa511..91ca1cc1f85 100644
--- a/app/assets/javascripts/discourse/components/group-card-contents.js.es6
+++ b/app/assets/javascripts/discourse/components/group-card-contents.js.es6
@@ -9,7 +9,7 @@ export default Ember.Component.extend(CardContentsBase, CleansUp, {
elementId: 'group-card',
triggeringLinkClass: 'mention-group',
classNames: ['no-bg'],
- classNameBindings: ['visible:show', 'showBadges', 'hasCardBadgeImage', 'isFixed:fixed'],
+ classNameBindings: ['visible:show', 'showBadges', 'hasCardBadgeImage', 'isFixed:fixed', 'groupClass'],
allowBackgrounds: setting('allow_profile_backgrounds'),
showBadges: setting('enable_badges'),
@@ -23,6 +23,9 @@ export default Ember.Component.extend(CardContentsBase, CleansUp, {
@computed('group.user_count', 'group.members.length')
moreMembersCount: (memberCount, maxMemberDisplay) => memberCount - maxMemberDisplay,
+ @computed('group.name')
+ groupClass: (name) => name ? `group-card-${name}` : '',
+
@computed('group')
groupPath(group) {
return `${Discourse.BaseUri}/groups/${group.name}`;
diff --git a/app/assets/javascripts/discourse/components/user-card-contents.js.es6 b/app/assets/javascripts/discourse/components/user-card-contents.js.es6
index d75bab921a0..473a7eff076 100644
--- a/app/assets/javascripts/discourse/components/user-card-contents.js.es6
+++ b/app/assets/javascripts/discourse/components/user-card-contents.js.es6
@@ -9,7 +9,7 @@ import CleansUp from 'discourse/mixins/cleans-up';
export default Ember.Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
elementId: 'user-card',
triggeringLinkClass: 'mention',
- classNameBindings: ['visible:show', 'showBadges', 'user.card_background::no-bg', 'isFixed:fixed'],
+ classNameBindings: ['visible:show', 'showBadges', 'user.card_background::no-bg', 'isFixed:fixed', 'usernameClass'],
allowBackgrounds: setting('allow_profile_backgrounds'),
showBadges: setting('enable_badges'),
@@ -34,6 +34,9 @@ export default Ember.Component.extend(CardContentsBase, CanCheckEmails, CleansUp
return !this.siteSettings.prioritize_username_in_ux && name && name.trim().length > 0;
},
+ @computed('username')
+ usernameClass : (username) => username ? `user-card-${username}` : '',
+
@computed('username', 'topicPostCount')
togglePostsLabel(username, count) {
return I18n.t("topic.filter_to", { username, count });