Show why a user can't be deleted on the page instead of as a tooltip

This commit is contained in:
Neil Lalonde 2013-12-20 11:36:43 -05:00
parent 6135d1d214
commit f91cb11666
3 changed files with 14 additions and 7 deletions

View File

@ -238,9 +238,13 @@ Discourse.AdminUser = Discourse.User.extend({
return (!this.get('can_be_deleted') || this.get('post_count') > 0); return (!this.get('can_be_deleted') || this.get('post_count') > 0);
}.property('post_count'), }.property('post_count'),
deleteButtonTitle: function() { deleteExplanation: function() {
if (this.get('deleteForbidden')) { if (this.get('deleteForbidden')) {
if (this.get('staff')) {
return I18n.t('admin.user.delete_forbidden_because_staff');
} else {
return I18n.t('admin.user.delete_forbidden', {count: Discourse.SiteSettings.delete_user_max_age}); return I18n.t('admin.user.delete_forbidden', {count: Discourse.SiteSettings.delete_user_max_age});
}
} else { } else {
return null; return null;
} }

View File

@ -313,9 +313,13 @@
<section> <section>
<hr/> <hr/>
<button class="btn btn-danger pull-right" {{action destroy target="content"}} {{bindAttr disabled="deleteForbidden"}} {{bindAttr title="deleteButtonTitle"}}> <button {{bindAttr class=":btn :btn-danger :pull-right deleteForbidden:hidden"}} {{action destroy target="content"}} {{bindAttr disabled="deleteForbidden"}} {{bindAttr}}>
<i class="fa fa-exclamation-triangle"></i> <i class="fa fa-exclamation-triangle"></i>
{{i18n admin.user.delete}} {{i18n admin.user.delete}}
</button> </button>
{{#if deleteExplanation}}
<div class="clearfix"></div>
<div class="pull-right"><i class="fa fa-exclamation-triangle"></i> {{deleteExplanation}}</div>
{{/if}}
</section> </section>
<div class="clearfix"></div> <div class="clearfix"></div>

View File

@ -1410,12 +1410,11 @@ en:
flags_received_count: Flags Received flags_received_count: Flags Received
approve: 'Approve' approve: 'Approve'
approved_by: "approved by" approved_by: "approved by"
approve_success: "User approved and email sent with activation approve_success: "User approved and email sent with activation instructions."
instructions." approve_bulk_success: "Success! All selected users have been approved and notified."
approve_bulk_success: "Success! All selected users have been approved
and notified."
time_read: "Read Time" time_read: "Read Time"
delete: "Delete User" delete: "Delete User"
delete_forbidden_because_staff: "Admins and moderators can't be deleted."
delete_forbidden: delete_forbidden:
one: "Users can't be deleted if they registered more than %{count} day ago, or if they have posts. Delete all posts before trying to delete a user." one: "Users can't be deleted if they registered more than %{count} day ago, or if they have posts. Delete all posts before trying to delete a user."
other: "Users can't be deleted if they registered more than %{count} days ago, or if they have posts. Delete all posts before trying to delete a user." other: "Users can't be deleted if they registered more than %{count} days ago, or if they have posts. Delete all posts before trying to delete a user."