Show staff count on invites page, don't warn if you have 3
This commit is contained in:
parent
62e1f88adc
commit
a95bb6006d
|
@ -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: {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
@computed('field.value')
|
||||
showStaffCount: staffCount => staffCount > 1
|
||||
});
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{{#if showStaffCount}}
|
||||
<div class='staff-count'>
|
||||
{{i18n "wizard.staff_count" count=field.value}}
|
||||
</div>
|
||||
{{/if}}
|
|
@ -48,6 +48,10 @@ body.wizard {
|
|||
z-index: 10;
|
||||
}
|
||||
|
||||
.staff-count {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.wizard-step-emoji {
|
||||
|
||||
.radio-area {
|
||||
|
|
|
@ -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 haven’t invited any staff. Are you sure you want to continue?"
|
||||
|
|
|
@ -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|
|
||||
|
|
Loading…
Reference in New Issue