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; return !automatic && isGroupOwner;
}, },
@computed('model.name') @computed('model.name', 'model.title')
groupName(name) { groupName(name, title) {
return name.capitalize(); return (title || name).capitalize();
}, },
@computed('model.name', 'model.flair_url', 'model.flair_bg_color', 'model.flair_color') @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="container group">
<div class='group-details-container'> <div class='group-details-container'>
<div class='group-details'> <div class='group-details'>
<span>
<h1 class='group-header'>
{{#if model.flair_url}} {{#if model.flair_url}}
<span class='group-avatar-flair'> <span class='group-avatar-flair'>
{{avatar-flair {{avatar-flair
@ -12,18 +10,27 @@
groupName=model.name}} groupName=model.name}}
</span> </span>
{{/if}} {{/if}}
<span class='group-name'>{{groupName}}</span>
<span>
<h1 class='group-header'>
<span class='group-title'>{{groupName}}</span>
</h1> </h1>
{{#if model.title}}
<h3 class='group-name'>@{{model.name}}</h3>
{{/if}}
</span> </span>
{{#if canEditGroup}} {{#if canEditGroup}}
<span> <span class="group-edit">
{{d-button action="showGroupEditor" label="group.edit.title" class="group-edit-btn" icon="pencil"}} {{d-button action="showGroupEditor" label="group.edit.title" class="group-edit-btn" icon="pencil"}}
</span> </span>
{{/if}} {{/if}}
</div> </div>
{{#if model.bio_cooked}} {{#if model.bio_cooked}}
<hr/>
<div class='group-bio'> <div class='group-bio'>
<p>{{{model.bio_cooked}}}</p> <p>{{{model.bio_cooked}}}</p>
</div> </div>

View File

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

View File

@ -39,7 +39,9 @@ test("Admin Browsing Groups", () => {
visit("/groups/discourse"); visit("/groups/discourse");
andThen(() => { 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'); click('.group-edit-btn');

View File

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