added delete all posts button

wired up the ability to enable all themes
This commit is contained in:
Sam Saffron
2013-02-07 18:11:56 +11:00
parent 8f4417f962
commit 85973ce6b0
13 changed files with 93 additions and 17 deletions

View File

@@ -1,10 +1,14 @@
window.Discourse.AdminUser = Discourse.Model.extend
deleteAllPosts: ->
@set('can_delete_all_posts', false)
$.ajax "/admin/users/#{@get('id')}/delete_all_posts", type: 'PUT'
# Revoke the user's admin access
revokeAdmin: ->
@set('admin',false)
@set('can_grant_admin',true)
@set('can_revoke_admin',false)
@set('can_revoke_admin',false)
$.ajax "/admin/users/#{@get('id')}/revoke_admin", type: 'PUT'
grantAdmin: ->
@@ -18,13 +22,11 @@ window.Discourse.AdminUser = Discourse.Model.extend
type: 'POST'
bootbox.alert("Message sent to all clients!")
approve: ->
@set('can_approve', false)
@set('approved', true)
@set('approved_by', Discourse.get('currentUser'))
$.ajax "/admin/users/#{@get('id')}/approve", type: 'PUT'
$.ajax "/admin/users/#{@get('id')}/approve", type: 'PUT'
username_lower:(->
@get('username').toLowerCase()

View File

@@ -38,7 +38,7 @@
<tr>
<td></td>
<td class='message'>
<div>{{avatar user imageSize="small"}} {{message}}</div>
<div><a href="/admin{{unbound user.path}}">{{avatar user imageSize="small"}}</a> {{message}}</div>
</td>
<td></td>
<td></td>

View File

@@ -139,6 +139,14 @@
<div class='display-row'>
<div class='field'>{{i18n admin.user.post_count}}</div>
<div class='value'>{{content.post_count}}</div>
<div class='controls'>
{{#if content.can_delete_all_posts}}
<button class='btn' {{action deleteAllPosts target="content"}}>
<i class='icon icon-trash'></i>
{{i18n admin.user.delete_all_posts}}
</button>
{{/if}}
</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n admin.user.posts_read_count}}</div>