FIX: buttons in user admin page weren't working
This commit is contained in:
parent
3c3008fec3
commit
c302ffe08f
|
@ -31,6 +31,29 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||||
}.property('model.user_fields.[]'),
|
}.property('model.user_fields.[]'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
|
impersonate() { return this.get("model").impersonate(); },
|
||||||
|
logOut() { return this.get("model").logOut(); },
|
||||||
|
resetBounceScore() { return this.get("model").resetBounceScore(); },
|
||||||
|
refreshBrowsers() { return this.get("model").refreshBrowsers(); },
|
||||||
|
approve() { return this.get("model").approve(); },
|
||||||
|
deactivate() { return this.get("model").deactivate(); },
|
||||||
|
sendActivationEmail() { return this.get("model").sendActivationEmail(); },
|
||||||
|
activate() { return this.get("model").activate(); },
|
||||||
|
revokeAdmin() { return this.get("model").revokeAdmin(); },
|
||||||
|
grantAdmin() { return this.get("model").grantAdmin(); },
|
||||||
|
revokeModeration() { return this.get("model").revokeModeration(); },
|
||||||
|
grantModeration() { return this.get("model").grantModeration(); },
|
||||||
|
saveTrustLevel() { return this.get("model").saveTrustLevel(); },
|
||||||
|
restoreTrustLevel() { return this.get("model").restoreTrustLevel(); },
|
||||||
|
lockTrustLevel(locked) { return this.get("model").lockTrustLevel(locked); },
|
||||||
|
unsuspend() { return this.get("model").unsuspend(); },
|
||||||
|
unblock() { return this.get("model").unblock(); },
|
||||||
|
block() { return this.get("model").block(); },
|
||||||
|
deleteAllPosts() { return this.get("model").deleteAllPosts(); },
|
||||||
|
anonymize() { return this.get('model').anonymize(); },
|
||||||
|
destroy() { return this.get('model').destroy(); },
|
||||||
|
|
||||||
toggleTitleEdit() {
|
toggleTitleEdit() {
|
||||||
this.set('userTitleValue', this.get('model.title'));
|
this.set('userTitleValue', this.get('model.title'));
|
||||||
this.toggleProperty('editingTitle');
|
this.toggleProperty('editingTitle');
|
||||||
|
@ -107,14 +130,6 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||||
if (result) { self.get('model').revokeApiKey(); }
|
if (result) { self.get('model').revokeApiKey(); }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
|
||||||
|
|
||||||
anonymize() {
|
|
||||||
this.get('model').anonymize();
|
|
||||||
},
|
|
||||||
|
|
||||||
destroy() {
|
|
||||||
this.get('model').destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ const AdminUser = Discourse.User.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
log_out() {
|
logOut() {
|
||||||
return ajax("/admin/users/" + this.id + "/log_out", {
|
return ajax("/admin/users/" + this.id + "/log_out", {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: { username_or_email: this.get('username') }
|
data: { username_or_email: this.get('username') }
|
||||||
|
|
|
@ -9,16 +9,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if model.active}}
|
{{#if model.active}}
|
||||||
{{#if model.can_impersonate}}
|
{{#if model.can_impersonate}}
|
||||||
<button class='btn btn-danger' {{action "impersonate" target="content"}} title="{{i18n 'admin.impersonate.help'}}">
|
{{d-button class="btn-danger" action="impersonate" icon="crosshairs" label="admin.impersonate.title" title="admin.impersonate.help"}}
|
||||||
{{fa-icon "crosshairs"}}
|
|
||||||
{{i18n 'admin.impersonate.title'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if currentUser.admin}}
|
{{#if currentUser.admin}}
|
||||||
<button class='btn' {{action "log_out" target="content"}}>
|
{{d-button action="logOut" icon="power-off" label="admin.user.log_out"}}
|
||||||
{{fa-icon "power-off"}}
|
|
||||||
{{i18n 'admin.user.log_out'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +43,7 @@
|
||||||
{{#if model.email}}
|
{{#if model.email}}
|
||||||
<a href="mailto:{{unbound model.email}}">{{model.email}}</a>
|
<a href="mailto:{{unbound model.email}}">{{model.email}}</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<button class="btn" title="{{i18n 'admin.users.check_email.title'}}" {{action "checkEmail" model}}>{{fa-icon "envelope-o"}} {{i18n 'admin.users.check_email.text'}}</button>
|
{{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,9 +53,7 @@
|
||||||
<div class='value'>{{model.bounceScore}}</div>
|
<div class='value'>{{model.bounceScore}}</div>
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#if model.canResetBounceScore}}
|
{{#if model.canResetBounceScore}}
|
||||||
<button class='btn' {{action "resetBounceScore" target="content"}} title={{i18n "admin.user.reset_bounce_score.title"}}>
|
{{d-button action="resetBounceScore" label="admin.user.reset_bounce_score.label" title="admin.user.reset_bounce_score.title"}}
|
||||||
{{i18n "admin.user.reset_bounce_score.label"}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{model.bounceScoreExplanation}}
|
{{model.bounceScoreExplanation}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,7 +65,7 @@
|
||||||
{{#if model.associated_accounts}}
|
{{#if model.associated_accounts}}
|
||||||
{{model.associated_accounts}}
|
{{model.associated_accounts}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<button class="btn" title="{{i18n 'admin.users.check_email.title'}}" {{action "checkEmail" model}}>{{fa-icon "envelope-o"}} {{i18n 'admin.users.check_email.text'}}</button>
|
{{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,9 +100,7 @@
|
||||||
<div class='value'>{{model.ip_address}}</div>
|
<div class='value'>{{model.ip_address}}</div>
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#if currentUser.staff}}
|
{{#if currentUser.staff}}
|
||||||
<button class='btn' {{action "refreshBrowsers" target="content"}}>
|
{{d-button action="refreshBrowsers" label="admin.user.refresh_browsers"}}
|
||||||
{{i18n 'admin.user.refresh_browsers'}}
|
|
||||||
</button>
|
|
||||||
{{ip-lookup ip=model.ip_address userId=model.id}}
|
{{ip-lookup ip=model.ip_address userId=model.id}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -176,10 +166,7 @@
|
||||||
{{i18n 'admin.user.approve_success'}}
|
{{i18n 'admin.user.approve_success'}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if model.can_approve}}
|
{{#if model.can_approve}}
|
||||||
<button class='btn' {{action "approve" target="content"}}>
|
{{d-button action="approve" icon="check" label="admin.user.approve"}}
|
||||||
{{fa-icon "check"}}
|
|
||||||
{{i18n 'admin.user.approve'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -198,21 +185,15 @@
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#if model.active}}
|
{{#if model.active}}
|
||||||
{{#if model.can_deactivate}}
|
{{#if model.can_deactivate}}
|
||||||
<button class='btn' {{action "deactivate" target="content"}}>{{i18n 'admin.user.deactivate_account'}}</button>
|
{{d-button action="deactivate" label="admin.user.deactivate_account"}}
|
||||||
{{i18n 'admin.user.deactivate_explanation'}}
|
{{i18n 'admin.user.deactivate_explanation'}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if model.can_send_activation_email}}
|
{{#if model.can_send_activation_email}}
|
||||||
<button class='btn' {{action "sendActivationEmail" target="content"}}>
|
{{d-button action="sendActivationEmail" icon="envelope" label="admin.user.send_activation_email"}}
|
||||||
{{fa-icon "envelope"}}
|
|
||||||
{{i18n 'admin.user.send_activation_email'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if model.can_activate}}
|
{{#if model.can_activate}}
|
||||||
<button class='btn' {{action "activate" target="content"}}>
|
{{d-button action="activate" icon="check" label="admin.user.activate"}}
|
||||||
{{fa-icon "check"}}
|
|
||||||
{{i18n 'admin.user.activate'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -243,16 +224,10 @@
|
||||||
<div class='value'>{{model.admin}}</div>
|
<div class='value'>{{model.admin}}</div>
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#if model.can_revoke_admin}}
|
{{#if model.can_revoke_admin}}
|
||||||
<button class='btn' {{action "revokeAdmin" target="content"}}>
|
{{d-button action="revokeAdmin" icon="shield" label="admin.user.revoke_admin"}}
|
||||||
{{fa-icon "shield"}}
|
|
||||||
{{i18n 'admin.user.revoke_admin'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if model.can_grant_admin}}
|
{{#if model.can_grant_admin}}
|
||||||
<button class='btn' {{action "grantAdmin" target="content"}}>
|
{{d-button action="grantAdmin" icon="shield" label="admin.user.grant_admin"}}
|
||||||
{{fa-icon "shield"}}
|
|
||||||
{{i18n 'admin.user.grant_admin'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -262,16 +237,10 @@
|
||||||
<div class='value'>{{model.moderator}}</div>
|
<div class='value'>{{model.moderator}}</div>
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#if model.can_revoke_moderation}}
|
{{#if model.can_revoke_moderation}}
|
||||||
<button class='btn' {{action "revokeModeration" target="content"}}>
|
{{d-button action="revokeModeration" icon="shield" label="admin.user.revoke_moderation"}}
|
||||||
{{fa-icon "shield"}}
|
|
||||||
{{i18n 'admin.user.revoke_moderation'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if model.can_grant_moderation}}
|
{{#if model.can_grant_moderation}}
|
||||||
<button class='btn' {{action "grantModeration" target="content"}}>
|
{{d-button action="grantModeration" icon="shield" label="admin.user.grant_moderation"}}
|
||||||
{{fa-icon "shield"}}
|
|
||||||
{{i18n 'admin.user.grant_moderation'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -282,17 +251,17 @@
|
||||||
{{combo-box content=site.trustLevels value=model.trust_level nameProperty="detailedName"}}
|
{{combo-box content=site.trustLevels value=model.trust_level nameProperty="detailedName"}}
|
||||||
{{#if model.dirty}}
|
{{#if model.dirty}}
|
||||||
<div>
|
<div>
|
||||||
<button class='btn ok no-text' {{action "saveTrustLevel" target="content"}}>{{fa-icon "check"}}</button>
|
{{d-button class="ok no-text" action="saveTrustLevel" icon="check"}}
|
||||||
<button class='btn cancel no-text' {{action "restoreTrustLevel" target="content"}}>{{fa-icon "times"}}</button>
|
{{d-button class="cancel no-text" action="restoreTrustLevel" icon="times"}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{#if model.canLockTrustLevel}}
|
{{#if model.canLockTrustLevel}}
|
||||||
{{#if model.trust_level_locked}}
|
{{#if model.trust_level_locked}}
|
||||||
<i title='{{i18n 'admin.user.trust_level_locked_tip'}}' {{action "lockTrustLevel" false target="model"}} class='fa fa-lock'></i> <button class="btn" {{action "lockTrustLevel" false target="model"}}>{{i18n 'admin.user.unlock_trust_level'}}</button>
|
<i title='{{i18n 'admin.user.trust_level_locked_tip'}}' class='fa fa-lock'></i> {{d-button action="lockTrustLevel" actionParam=false label="admin.user.unlock_trust_level"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<i title='{{i18n 'admin.user.trust_level_unlocked_tip'}}' class='fa fa-unlock'></i> <button class="btn" {{action "lockTrustLevel" true target="model"}}>{{i18n 'admin.user.lock_trust_level'}}</button>
|
<i title='{{i18n 'admin.user.trust_level_unlocked_tip'}}' class='fa fa-unlock'></i> {{d-button action="lockTrustLevel" actionParam=true label="admin.user.lock_trust_level"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if model.tl3Requirements}}
|
{{#if model.tl3Requirements}}
|
||||||
|
@ -306,18 +275,12 @@
|
||||||
<div class='value'>{{model.isSuspended}}</div>
|
<div class='value'>{{model.isSuspended}}</div>
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#if model.isSuspended}}
|
{{#if model.isSuspended}}
|
||||||
<button class='btn btn-danger' {{action "unsuspend" target="content"}}>
|
{{d-button class="btn-danger" action="unsuspend" icon="ban" label="admin.user.unsuspend"}}
|
||||||
{{fa-icon "ban"}}
|
|
||||||
{{i18n 'admin.user.unsuspend'}}
|
|
||||||
</button>
|
|
||||||
{{suspendDuration}}
|
{{suspendDuration}}
|
||||||
{{i18n 'admin.user.suspended_explanation'}}
|
{{i18n 'admin.user.suspended_explanation'}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if model.canSuspend}}
|
{{#if model.canSuspend}}
|
||||||
<button class='btn btn-danger' {{action "showSuspendModal" model}}>
|
{{d-button class="btn-danger" action="showSuspendModal" actionParam=model icon="ban" label="admin.user.suspend"}}
|
||||||
{{fa-icon "ban"}}
|
|
||||||
{{i18n 'admin.user.suspend'}}
|
|
||||||
</button>
|
|
||||||
{{i18n 'admin.user.suspended_explanation'}}
|
{{i18n 'admin.user.suspended_explanation'}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -344,16 +307,10 @@
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#conditional-loading-spinner size="small" condition=model.blockingUser}}
|
{{#conditional-loading-spinner size="small" condition=model.blockingUser}}
|
||||||
{{#if model.blocked}}
|
{{#if model.blocked}}
|
||||||
<button class='btn' {{action "unblock" target="content"}}>
|
{{d-button action="unblock" icon="thumbs-o-up" label="admin.user.unblock"}}
|
||||||
{{fa-icon "thumbs-o-up"}}
|
|
||||||
{{i18n 'admin.user.unblock'}}
|
|
||||||
</button>
|
|
||||||
{{i18n 'admin.user.block_explanation'}}
|
{{i18n 'admin.user.block_explanation'}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<button class='btn' {{action "block" target="content"}}>
|
{{d-button action="block" icon="ban" label="admin.user.block"}}
|
||||||
{{fa-icon "ban"}}
|
|
||||||
{{i18n 'admin.user.block'}}
|
|
||||||
</button>
|
|
||||||
{{i18n 'admin.user.block_explanation'}}
|
{{i18n 'admin.user.block_explanation'}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/conditional-loading-spinner}}
|
{{/conditional-loading-spinner}}
|
||||||
|
@ -423,10 +380,7 @@
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
{{#if model.can_delete_all_posts}}
|
{{#if model.can_delete_all_posts}}
|
||||||
{{#if model.post_count}}
|
{{#if model.post_count}}
|
||||||
<button class='btn btn-danger' {{action "deleteAllPosts" target="content"}}>
|
{{d-button class="btn-danger" action="deleteAllPosts" icon="trash-o" label="admin.user.delete_all_posts"}}
|
||||||
{{fa-icon "trash-o"}}
|
|
||||||
{{i18n 'admin.user.delete_all_posts'}}
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{model.deleteAllPostsExplanation}}
|
{{model.deleteAllPostsExplanation}}
|
||||||
|
|
Loading…
Reference in New Issue