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

This commit is contained in:
Jeff Wong 2018-06-12 23:08:03 -07:00 committed by Guo Xiang Tan
parent 12fd0b827e
commit 0c2f590c64
2 changed files with 8 additions and 2 deletions

View File

@ -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}`;

View File

@ -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 });