Show staff count on invites page, don't warn if you have 3

This commit is contained in:
Robin Ward 2016-09-21 17:15:57 -04:00
parent 62e1f88adc
commit a95bb6006d
6 changed files with 29 additions and 1 deletions

View File

@ -29,7 +29,11 @@ export default Ember.Component.extend({
const users = this.get('users');
this.set('field.value', JSON.stringify(users));
this.set('field.warning', users.length ? null : 'invites.none_added');
const staffCount = this.get('step.fieldsById.staff_count.value');
const showWarning = (staffCount < 3 && users.length === 0);
this.set('field.warning', showWarning ? 'invites.none_added' : null);
},
actions: {

View File

@ -0,0 +1,7 @@
import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
@computed('field.value')
showStaffCount: staffCount => staffCount > 1
});

View File

@ -0,0 +1,5 @@
{{#if showStaffCount}}
<div class='staff-count'>
{{i18n "wizard.staff_count" count=field.value}}
</div>
{{/if}}

View File

@ -48,6 +48,10 @@ body.wizard {
z-index: 10;
}
.staff-count {
font-weight: bold;
}
.wizard-step-emoji {
.radio-area {

View File

@ -3236,6 +3236,10 @@ en:
uploading: "Uploading..."
quit: "Maybe Later"
staff_count:
one: "Your forum currently has 1 staff member. "
other: "Your forum currently has %{count} staff members."
invites:
add_user: "add"
none_added: "You havent invited any staff. Are you sure you want to continue?"

View File

@ -209,6 +209,10 @@ class Wizard
end
@wizard.append_step('invites') do |step|
staff_count = User.where("moderator = true or admin = true").where("id <> ?", Discourse.system_user.id).count
step.add_field(id: 'staff_count', type: 'component', value: staff_count)
step.add_field(id: 'invite_list', type: 'component')
step.on_update do |updater|