FIX: Display empty message when no groups can be shown.

This commit is contained in:
Guo Xiang Tan 2016-12-20 14:47:39 +08:00
parent 502e114c60
commit c15bf62b43
5 changed files with 63 additions and 57 deletions

View File

@ -1,6 +1,6 @@
export default Discourse.Route.extend({
titleToken() {
return I18n.t('groups.index');
return I18n.t('groups.index.title');
},
model(params) {

View File

@ -1,5 +1,5 @@
<div class="container group">
{{#link-to "groups" class='group-breadcrumb'}}{{fa-icon 'arrow-left'}} {{i18n 'groups.index'}}{{/link-to}}
{{#link-to "groups" class='group-breadcrumb'}}{{fa-icon 'arrow-left'}} {{i18n 'groups.index.title'}}{{/link-to}}
<div class='group-details-container'>
<div class='group-info'>

View File

@ -1,61 +1,65 @@
{{#d-section pageClass="groups"}}
{{#load-more selector=".groups-table .groups-table-row" action="loadMore"}}
<h1>{{i18n "groups.index"}}</h1>
<h1>{{i18n "groups.index.title"}}</h1>
<div class='container'>
<table class="groups-table">
<thead>
<th></th>
<th>{{i18n "groups.user_count"}}</th>
<th>{{i18n "groups.membership"}}</th>
</thead>
{{#if groups}}
{{#load-more selector=".groups-table .groups-table-row" action="loadMore"}}
<div class='container'>
<table class="groups-table">
<thead>
<th></th>
<th>{{i18n "groups.user_count"}}</th>
<th>{{i18n "groups.membership"}}</th>
</thead>
<tbody>
{{#each groups as |group|}}
<tr class="groups-table-row">
<td class="groups-info">
{{#link-to "group.members" group.name}}
{{#if group.flair_url}}
<span class='group-avatar-flair'>
{{avatar-flair
flairURL=group.flair_url
flairBgColor=group.flair_bg_color
flairColor=group.flair_color
groupName=group.name}}
<tbody>
{{#each groups as |group|}}
<tr class="groups-table-row">
<td class="groups-info">
{{#link-to "group.members" group.name}}
{{#if group.flair_url}}
<span class='group-avatar-flair'>
{{avatar-flair
flairURL=group.flair_url
flairBgColor=group.flair_bg_color
flairColor=group.flair_color
groupName=group.name}}
</span>
{{/if}}
<span>
<span class='groups-info-name'>{{group.name}}</span>
{{#if group.full_name}}
<span class='groups-info-full-name'>{{group.full_name}}</span>
{{/if}}
{{#if group.title}}
<div>
<span class='groups-info-title'>{{group.title}}</span>
</div>
{{/if}}
</span>
{{/if}}
{{/link-to}}
</td>
<span>
<span class='groups-info-name'>{{group.name}}</span>
<td class="groups-user-count">{{group.user_count}}</td>
{{#if group.full_name}}
<span class='groups-info-full-name'>{{group.full_name}}</span>
{{/if}}
<td>
{{#group-membership-button model=group createNewMessageViaParams='createNewMessageViaParams'}}
{{d-button icon="ban"
label=(if group.automatic 'groups.automatic_group' 'groups.closed_group')
disabled=true}}
{{/group-membership-button}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/load-more}}
{{#if group.title}}
<div>
<span class='groups-info-title'>{{group.title}}</span>
</div>
{{/if}}
</span>
{{/link-to}}
</td>
<td class="groups-user-count">{{group.user_count}}</td>
<td>
{{#group-membership-button model=group createNewMessageViaParams='createNewMessageViaParams'}}
{{d-button icon="ban"
label=(if group.automatic 'groups.automatic_group' 'groups.closed_group')
disabled=true}}
{{/group-membership-button}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/load-more}}
{{conditional-loading-spinner condition=groups.loadingMore}}
{{conditional-loading-spinner condition=groups.loadingMore}}
{{else}}
<p>{{i18n "groups.index.empty"}}</p>
{{/if}}
{{/d-section}}

View File

@ -103,7 +103,7 @@ export default createWidget('hamburger-menu', {
links.push({ route: 'users', className: 'user-directory-link', label: 'directory.title' });
}
links.push({ route: 'groups', className: 'groups-link', label: 'groups.index' });
links.push({ route: 'groups', className: 'groups-link', label: 'groups.index.title' });
if (this.siteSettings.tagging_enabled) {
links.push({ route: 'tags', label: 'tagging.tags' });

View File

@ -425,7 +425,9 @@ en:
selector_placeholder: "Add members"
owner: "owner"
visible: "Group is visible to all users"
index: "Groups"
index:
title: "Groups"
empty: "There are no visible groups."
title:
one: "group"
other: "groups"