use d-buttons, and other small tweaks

This commit is contained in:
Neil Lalonde 2015-03-10 13:06:08 -04:00
parent b5263b9b9b
commit be446b7e50
4 changed files with 26 additions and 10 deletions

View File

@ -92,6 +92,14 @@ export default ObjectController.extend(CanCheckEmails, {
self.get('model').revokeApiKey();
}
});
},
anonymize: function() {
this.get('model').anonymize();
},
destroy: function() {
this.get('model').destroy();
}
}

View File

@ -336,7 +336,6 @@ Discourse.AdminUser = Discourse.User.extend({
var performAnonymize = function() {
Discourse.ajax("/admin/users/" + user.get('id') + '/anonymize.json', {type: 'PUT'}).then(function(data) {
if (data.success) {
bootbox.alert(I18n.t("admin.user.anonymize_successful"));
if (data.username) {
document.location = "/admin/users/" + data.username;
} else {

View File

@ -450,17 +450,27 @@
<section>
<hr/>
<button {{bind-attr class=":btn :btn-danger :pull-right anonymizeForbidden:hidden"}} {{action "anonymize" target="content"}} {{bind-attr disabled="anonymizeForbidden"}}>
<i class="fa fa-exclamation-triangle"></i>
{{i18n 'admin.user.anonymize'}}
</button>
<div class="pull-right">
{{#unless anonymizeForbidden}}
{{d-button label="admin.user.anonymize"
icon="exclamation-triangle"
class="btn btn-danger"
disabled=anonymizeForbidden
action="anonymize"}}
{{/unless}}
{{#unless deleteForbidden}}
{{d-button label="admin.user.delete"
icon="exclamation-triangle"
class="btn btn-danger"
disabled=deleteForbidden
action="destroy"}}
{{/unless}}
</div>
<button {{bind-attr class=":btn :btn-danger :pull-right deleteForbidden:hidden"}} {{action "destroy" target="content"}} {{bind-attr disabled="deleteForbidden"}}>
<i class="fa fa-exclamation-triangle"></i>
{{i18n 'admin.user.delete'}}
</button>
{{#if deleteExplanation}}
<div class="clearfix"></div>
<br/>
<div class="pull-right"><i class="fa fa-exclamation-triangle"></i> {{deleteExplanation}}</div>
{{/if}}
</section>

View File

@ -2052,7 +2052,6 @@ en:
anonymize: "Anonymize User"
anonymize_confirm: "Are you SURE you want to anonymize this account? This will change the username and email, and reset all profile information."
anonymize_yes: "Yes, anonymize this account"
anonymize_successful: "The user was anonymized successfully."
anonymize_failed: "There was a problem anonymizing the account."
delete: "Delete User"
delete_forbidden_because_staff: "Admins and moderators can't be deleted."