discourse/app/assets/javascripts/admin/controllers/admin_user_controller.js

34 lines
834 B
JavaScript
Raw Normal View History

/**
A controller related to viewing a user in the admin section
@class AdminUserController
@extends Discourse.ObjectController
@namespace Discourse
@module Discourse
**/
Discourse.AdminUserController = Discourse.ObjectController.extend({
editingTitle: false,
2013-09-16 14:08:55 -04:00
showApproval: function() {
return Discourse.SiteSettings.must_approve_users;
}.property(),
2013-09-16 14:08:55 -04:00
actions: {
toggleTitleEdit: function() {
this.toggleProperty('editingTitle');
},
2013-09-16 14:08:55 -04:00
saveTitle: function() {
Discourse.ajax("/users/" + this.get('username').toLowerCase(), {
data: {title: this.get('title')},
type: 'PUT'
}).then(null, function(e){
bootbox.alert(I18n.t("generic_error_with_reason", {error: "http: " + e.status + " - " + e.body}));
});
this.send('toggleTitleEdit');
}
}
});