UX: Display button to add a group when no group has been selected.

https://meta.discourse.org/t/new-button-on-groups/44546
This commit is contained in:
Guo Xiang Tan 2017-03-10 17:15:49 +08:00
parent eb6ef0311e
commit 0e41b1181a
5 changed files with 50 additions and 22 deletions

View File

@ -0,0 +1,11 @@
import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Controller.extend({
adminGroupsType: Ember.inject.controller(),
sortedGroups: Ember.computed.alias("adminGroupsType.sortedGroups"),
@computed("sortedGroups")
messageKey(sortedGroups) {
return `admin.groups.${sortedGroups.length > 0 ? 'none_selected' : 'no_custom_groups'}`;
}
});

View File

@ -0,0 +1,9 @@
<div class="groups-type-index">
<p>{{i18n messageKey}}</p>
<div>
{{#link-to 'adminGroup' 'new' class="btn"}}
{{fa-icon "plus"}} {{i18n 'admin.groups.new'}}
{{/link-to}}
</div>
</div>

View File

@ -1,29 +1,31 @@
<div class='row groups'>
<div class='content-list span6'>
<h3>{{i18n 'admin.groups.edit'}}</h3>
<ul>
{{#each sortedGroups as |group|}}
<li>
{{#link-to "adminGroup" group.type group.name}}{{group.name}}
{{#if group.userCountDisplay}}
<span class="count">{{number group.userCountDisplay}}</span>
{{/if}}
{{#if sortedGroups}}
<div class='content-list span6'>
<h3>{{i18n 'admin.groups.edit'}}</h3>
<ul>
{{#each sortedGroups as |group|}}
<li>
{{#link-to "adminGroup" group.type group.name}}{{group.name}}
{{#if group.userCountDisplay}}
<span class="count">{{number group.userCountDisplay}}</span>
{{/if}}
{{/link-to}}
</li>
{{/each}}
</ul>
<div class='controls'>
{{#if isAuto}}
{{d-button action="refreshAutoGroups" icon="refresh" label="admin.groups.refresh" disabled=refreshingAutoGroups}}
{{else}}
{{#link-to 'adminGroup' 'new' class="btn"}}
{{fa-icon "plus"}} {{i18n 'admin.groups.new'}}
{{/link-to}}
</li>
{{/each}}
</ul>
<div class='controls'>
{{#if isAuto}}
{{d-button action="refreshAutoGroups" icon="refresh" label="admin.groups.refresh" disabled=refreshingAutoGroups}}
{{else}}
{{#link-to 'adminGroup' 'new' class="btn"}}
{{fa-icon "plus"}} {{i18n 'admin.groups.new'}}
{{/link-to}}
{{/if}}
{{/if}}
</div>
</div>
</div>
{{/if}}
<div class='content-editor'>
<div class="span13">
{{outlet}}
</div>
</div>

View File

@ -696,6 +696,10 @@ section.details {
width: 100%;
border-color: dark-light-choose(scale-color($primary, $lightness: 75%), scale-color($secondary, $lightness: 25%));
}
.content-list {
margin-right: 20px;
}
}
// Customise area

View File

@ -2568,6 +2568,8 @@ en:
add_owners: Add owners
incoming_email: "Custom incoming email address"
incoming_email_placeholder: "enter email address"
none_selected: "Select a group to get started"
no_custom_groups: "Create a new custom group"
api:
generate_master: "Generate Master API Key"