FIX: Display group avatar flair on user page.

This commit is contained in:
Guo Xiang Tan 2016-11-29 13:42:47 +08:00
parent 1939104d46
commit 0d4f71e90b
6 changed files with 39 additions and 3 deletions

View File

@ -28,6 +28,16 @@ export default Ember.Controller.extend({
return name.capitalize(); return name.capitalize();
}, },
@computed('model.name', 'model.flair_url', 'model.flair_bg_color', 'model.flair_color')
avatarFlairAttributes(groupName, flairURL, flairBgColor, flairColor) {
return {
primary_group_flair_url: flairURL,
primary_group_flair_bg_color: flairBgColor,
primary_group_flair_color: flairColor,
primary_group_name: groupName
};
},
@observes('counts') @observes('counts')
countsChanged() { countsChanged() {
const counts = this.get('counts'); const counts = this.get('counts');

View File

@ -17,7 +17,14 @@
<section class='user-right groups'> <section class='user-right groups'>
<section class='about group'> <section class='about group'>
<div class='details'> <div class='details'>
<h1>{{groupName}}</h1> <h1 class='group-header'>
{{#if model.flair_url}}
<span class='group-avatar-flair'>
{{mount-widget widget="avatar-flair" args=avatarFlairAttributes}}
</span>
{{/if}}
<span class='group-name'>{{groupName}}</span>
</h1>
</div> </div>
</section> </section>
{{outlet}} {{outlet}}

View File

@ -0,0 +1,16 @@
.groups {
.group-header {
display: table;
}
.avatar-flair {
background-size: 40px;
height: 40px;
width: 40px;
}
.group-avatar-flair, .group-name {
display: table-cell;
vertical-align: middle;
}
}

View File

@ -4,7 +4,9 @@ acceptance("Groups");
test("Browsing Groups", () => { test("Browsing Groups", () => {
visit("/groups/discourse"); visit("/groups/discourse");
andThen(() => { andThen(() => {
ok(count('.avatar-flair .fa-adjust') === 1, "it displays the group's avatar flair");
ok(count('.group-members tr') > 0, "it lists group members"); ok(count('.group-members tr') > 0, "it lists group members");
}); });

View File

@ -6,7 +6,8 @@ export default {
"name":"discourse", "name":"discourse",
"user_count":8, "user_count":8,
"alias_level":0, "alias_level":0,
"visible":true "visible":true,
"flair_url": 'fa-adjust'
} }
}, },
"/groups/discourse/counts.json":{ "/groups/discourse/counts.json":{