UX: Display group title if it exists.

This commit is contained in:
Guo Xiang Tan 2016-12-07 10:20:13 +08:00
parent a7ee72649d
commit 8c7a0b7684
5 changed files with 35 additions and 22 deletions

View File

@ -28,9 +28,9 @@ export default Ember.Controller.extend({
return !automatic && isGroupOwner;
},
@computed('model.name')
groupName(name) {
return name.capitalize();
@computed('model.name', 'model.title')
groupName(name, title) {
return (title || name).capitalize();
},
@computed('model.name', 'model.flair_url', 'model.flair_bg_color', 'model.flair_color')

View File

@ -1,8 +1,6 @@
<div class="container group">
<div class='group-details-container'>
<div class='group-details'>
<span>
<h1 class='group-header'>
{{#if model.flair_url}}
<span class='group-avatar-flair'>
{{avatar-flair
@ -12,18 +10,27 @@
groupName=model.name}}
</span>
{{/if}}
<span class='group-name'>{{groupName}}</span>
<span>
<h1 class='group-header'>
<span class='group-title'>{{groupName}}</span>
</h1>
{{#if model.title}}
<h3 class='group-name'>@{{model.name}}</h3>
{{/if}}
</span>
{{#if canEditGroup}}
<span>
<span class="group-edit">
{{d-button action="showGroupEditor" label="group.edit.title" class="group-edit-btn" icon="pencil"}}
</span>
{{/if}}
</div>
{{#if model.bio_cooked}}
<hr/>
<div class='group-bio'>
<p>{{{model.bio_cooked}}}</p>
</div>

View File

@ -3,6 +3,12 @@
font-weight: normal;
}
.group-name {
font-weight: normal;
margin-top: 5px;
color: dark-light-diff($primary, $secondary, 50%, -50%);
}
.group-details-container {
background: rgba(230, 230, 230, 0.3);
padding: 20px;
@ -40,16 +46,14 @@ table.group-members {
width: 100%;
}
.group-header, .group-details {
display: table;
.group-details {
span {
display: table-cell;
display: inline-block;
vertical-align: middle;
}
.avatar-flair {
$size: 40px;
$size: 50px;
background-size: $size;
height: $size;
@ -61,8 +65,7 @@ table.group-members {
}
}
.group-edit-btn {
margin-left: 5px;
.group-edit {
float: right;
}

View File

@ -39,7 +39,9 @@ test("Admin Browsing Groups", () => {
visit("/groups/discourse");
andThen(() => {
ok($('.nav-stacked li').length === 5, 'it should show messages tab if user is admin');
ok(find('.nav-stacked li').length === 5, 'it should show messages tab if user is admin');
equal(find('.group-title').text(), 'Awesome Team', 'it should display the group title');
equal(find('.group-name').text(), '@discourse', 'it should display the group name');
});
click('.group-edit-btn');

View File

@ -4,6 +4,7 @@ export default {
"id":47,
"automatic":false,
"name":"discourse",
"title":"Awesome Team",
"user_count":8,
"alias_level":0,
"visible":true,