You must give a reason for suspending a user

This commit is contained in:
Neil Lalonde 2014-02-04 11:03:35 -05:00
parent 612001aa74
commit dc77e7e27c
2 changed files with 6 additions and 1 deletions

View File

@ -9,8 +9,13 @@
**/
Discourse.AdminSuspendUserController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
submitDisabled: function() {
return (!this.get('reason') || this.get('reason').length < 1);
}.property('reason'),
actions: {
suspend: function() {
if (this.get('submitDisabled')) return;
var duration = parseInt(this.get('duration'), 10);
if (duration > 0) {
var self = this;

View File

@ -10,6 +10,6 @@
</form>
</div>
<div class="modal-footer">
<button class='btn btn-danger' {{action suspend}}><i class='fa fa-ban'></i>{{i18n admin.user.suspend}}</button>
<button class='btn btn-danger' {{action suspend}} {{bind-attr disabled="submitDisabled"}}><i class='fa fa-ban'></i>{{i18n admin.user.suspend}}</button>
<a {{action closeModal}}>{{i18n cancel}}</a>
</div>