mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Discourse Macro Helpers + Minor Fix to Admin User View
This commit is contained in:
@@ -78,9 +78,7 @@ Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Pres
|
||||
|
||||
@property hasSelection
|
||||
**/
|
||||
hasSelection: function() {
|
||||
return this.get('selectedCount') > 0;
|
||||
}.property('selectedCount'),
|
||||
hasSelection: Em.computed.gt('selectedCount', 0),
|
||||
|
||||
/**
|
||||
Refresh the current list of users.
|
||||
|
||||
@@ -98,19 +98,14 @@ Discourse.AdminUser = Discourse.User.extend({
|
||||
this.set('trustLevel.id', this.get('originalTrustLevel'));
|
||||
},
|
||||
|
||||
isBanned: (function() {
|
||||
return this.get('is_banned') === true;
|
||||
}).property('is_banned'),
|
||||
isBanned: Em.computed.equal('is_banned', true),
|
||||
canBan: Em.computed.not('staff'),
|
||||
|
||||
canBan: (function() {
|
||||
return !this.get('admin') && !this.get('moderator');
|
||||
}).property('admin', 'moderator'),
|
||||
|
||||
banDuration: (function() {
|
||||
banDuration: function() {
|
||||
var banned_at = moment(this.banned_at);
|
||||
var banned_till = moment(this.banned_till);
|
||||
return banned_at.format('L') + " - " + banned_till.format('L');
|
||||
}).property('banned_till', 'banned_at'),
|
||||
}.property('banned_till', 'banned_at'),
|
||||
|
||||
ban: function() {
|
||||
var duration = parseInt(window.prompt(I18n.t('admin.user.ban_duration')), 10);
|
||||
|
||||
@@ -16,11 +16,6 @@ Discourse.AdminUserRoute = Discourse.Route.extend(Discourse.ModelReady, {
|
||||
return Discourse.AdminUser.find(Em.get(params, 'username').toLowerCase());
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
controller.set('model', model);
|
||||
model.setOriginalTrustLevel();
|
||||
},
|
||||
|
||||
renderTemplate: function() {
|
||||
this.render({into: 'admin/templates/admin'});
|
||||
},
|
||||
@@ -28,6 +23,7 @@ Discourse.AdminUserRoute = Discourse.Route.extend(Discourse.ModelReady, {
|
||||
modelReady: function(controller, adminUser) {
|
||||
adminUser.loadDetails();
|
||||
controller.set('model', adminUser);
|
||||
adminUser.setOriginalTrustLevel();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user