mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-24 22:42:27 -05:00
fe578f9944
PERF: clean up performance of user badges admin when large number of badges exist
70 lines
2.4 KiB
Handlebars
70 lines
2.4 KiB
Handlebars
<div class='admin-controls'>
|
|
<div class='span15'>
|
|
<ul class='nav nav-pills'>
|
|
<li>{{#link-to 'adminUser' user}}<i class="fa fa-caret-left"></i> {{user.username}}{{/link-to}}</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
{{#loading-spinner condition=loading}}
|
|
<div class='admin-container user-badges'>
|
|
<h2>{{i18n 'admin.badges.grant_badge'}}</h2>
|
|
<br>
|
|
{{#if noBadges}}
|
|
<p>{{i18n 'admin.badges.no_badges'}}</p>
|
|
{{else}}
|
|
<form class="form-horizontal">
|
|
<div>
|
|
<label>{{i18n 'admin.badges.badge'}}</label>
|
|
{{combo-box valueAttribute="id" value=controller.selectedBadgeId content=controller.grantableBadges}}
|
|
</div>
|
|
<label>
|
|
<label>{{i18n 'admin.badges.reason'}}</label>
|
|
{{input type="text" value=badgeReason}}<br><small>{{i18n 'admin.badges.reason_help'}}</small>
|
|
</label>
|
|
<button class='btn btn-primary' {{action "grantBadge" controller.selectedBadgeId}}>{{i18n 'admin.badges.grant'}}</button>
|
|
</form>
|
|
{{/if}}
|
|
|
|
<table id='user-badges'>
|
|
<tr>
|
|
<th>{{i18n 'admin.badges.badge'}}</th>
|
|
<th>{{i18n 'admin.badges.granted_by'}}</th>
|
|
<th class='reason'>{{i18n 'admin.badges.reason'}}</th>
|
|
<th>{{i18n 'admin.badges.granted_at'}}</th>
|
|
<th></th>
|
|
</tr>
|
|
|
|
{{#each userBadge in groupedBadges}}
|
|
<tr>
|
|
<td>{{user-badge badge=userBadge.badge count=userBadge.count}}</td>
|
|
<td>
|
|
{{#link-to 'adminUser' userBadge.badge.granted_by}}
|
|
{{avatar userBadge.granted_by imageSize="tiny"}}
|
|
{{userBadge.granted_by.username}}
|
|
{{/link-to}}
|
|
</td>
|
|
<td class='reason'>
|
|
{{#if userBadge.postUrl}}
|
|
<a href="{{unbound userBadge.postUrl}}">{{userBadge.topic_title}}</a>
|
|
{{/if}}
|
|
</td>
|
|
<td>{{age-with-tooltip userBadge.granted_at}}</td>
|
|
<td>
|
|
{{#if userBadge.grouped}}
|
|
<button class='btn' {{action "expandGroup" userBadge}}>{{{i18n 'admin.badges.expand'}}}</button>
|
|
{{else}}
|
|
<button class='btn btn-danger' {{action "revokeBadge" userBadge}}>{{i18n 'admin.badges.revoke'}}</button>
|
|
{{/if}}
|
|
</td>
|
|
</tr>
|
|
{{else}}
|
|
<tr>
|
|
<td colspan="5">
|
|
<p>{{i18n 'admin.badges.no_user_badges' name=user.username}}</p>
|
|
</td>
|
|
</tr>
|
|
{{/each}}
|
|
</table>
|
|
</div>
|
|
{{/loading-spinner}}
|