FIX: User card spacing was off

This commit is contained in:
Robin Ward 2016-12-14 10:45:51 -05:00
parent 13c344245d
commit 2164d7d21c
1 changed files with 4 additions and 8 deletions

View File

@ -12,7 +12,7 @@ const clickMention = "click.discourse-user-mention";
export default Ember.Component.extend(CleansUp, { export default Ember.Component.extend(CleansUp, {
elementId: 'user-card', elementId: 'user-card',
classNameBindings: ['visible:show', 'showBadges', 'hasCardBadgeImage'], classNameBindings: ['visible:show', 'showBadges', 'hasCardBadgeImage', 'user.card_background::no-bg'],
allowBackgrounds: setting('allow_profile_backgrounds'), allowBackgrounds: setting('allow_profile_backgrounds'),
postStream: Ember.computed.alias('topic.postStream'), postStream: Ember.computed.alias('topic.postStream'),
@ -71,18 +71,14 @@ export default Ember.Component.extend(CleansUp, {
@observes('user.card_background') @observes('user.card_background')
addBackground() { addBackground() {
const url = this.get('user.card_background');
if (!this.get('allowBackgrounds')) { return; } if (!this.get('allowBackgrounds')) { return; }
const $this = this.$(); const $this = this.$();
if (!$this) { return; } if (!$this) { return; }
if (Ember.isEmpty(url)) { const url = this.get('user.card_background');
$this.css('background-image', '').addClass('no-bg'); const bg = Ember.isEmpty(url) ? '' : `url(${Discourse.getURLWithCDN(url)})`;
} else { $this.css('background-image', bg);
$this.css('background-image', `url(${Discourse.getURLWithCDN(url)})`).removeClass('no-bg');
}
}, },
_show(username, $target) { _show(username, $target) {