2014-03-19 22:27:21 +08:00
|
|
|
<div class="admin-controls">
|
2018-02-15 01:26:05 +08:00
|
|
|
<nav>
|
2014-03-19 22:27:21 +08:00
|
|
|
<ul class="nav nav-pills">
|
2022-07-06 01:41:31 +08:00
|
|
|
<li><LinkTo @route="adminUser" @model={{this.user}}>{{d-icon
|
|
|
|
"caret-left"
|
|
|
|
}}
|
|
|
|
{{this.user.username}}</LinkTo></li>
|
2014-03-19 22:27:21 +08:00
|
|
|
</ul>
|
2018-02-15 01:26:05 +08:00
|
|
|
</nav>
|
2014-03-19 22:27:21 +08:00
|
|
|
</div>
|
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
<ConditionalLoadingSpinner @condition={{this.loading}}>
|
2014-03-19 22:27:21 +08:00
|
|
|
<div class="admin-container user-badges">
|
2014-12-09 05:35:49 +08:00
|
|
|
<h2>{{i18n "admin.badges.grant_badge"}}</h2>
|
2015-02-25 09:52:43 +08:00
|
|
|
<br />
|
2023-09-14 10:05:29 +08:00
|
|
|
{{#if this.noAvailableBadges}}
|
2014-12-09 05:35:49 +08:00
|
|
|
<p>{{i18n "admin.badges.no_badges"}}</p>
|
2014-03-19 22:27:21 +08:00
|
|
|
{{else}}
|
2024-10-24 22:10:10 +08:00
|
|
|
<PluginOutlet
|
|
|
|
@name="badge-granter-form"
|
|
|
|
@outletArgs={{hash
|
|
|
|
availableBadges=this.availableBadges
|
|
|
|
userBadges=this.userBadges
|
2024-11-21 06:22:02 +08:00
|
|
|
user=this.user
|
2024-10-24 22:10:10 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<form class="form-horizontal">
|
|
|
|
<div class="control-group">
|
|
|
|
<label>{{i18n "admin.badges.badge"}}</label>
|
|
|
|
<ComboBox
|
|
|
|
@value={{this.selectedBadgeId}}
|
|
|
|
@content={{this.availableBadges}}
|
|
|
|
@onChange={{fn (mut this.selectedBadgeId)}}
|
|
|
|
@options={{hash filterable=true}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
|
|
<label>{{i18n "admin.badges.reason"}}</label>
|
|
|
|
<Input @type="text" @value={{this.badgeReason}} /><br /><small
|
|
|
|
>{{i18n "admin.badges.reason_help"}}</small>
|
|
|
|
</div>
|
|
|
|
<DButton
|
|
|
|
@action={{this.performGrantBadge}}
|
|
|
|
@label="admin.badges.grant"
|
|
|
|
type="submit"
|
|
|
|
class="btn-primary"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
2024-10-24 22:10:10 +08:00
|
|
|
</form>
|
|
|
|
</PluginOutlet>
|
2014-03-19 22:27:21 +08:00
|
|
|
{{/if}}
|
|
|
|
|
2024-10-24 22:10:10 +08:00
|
|
|
<PluginOutlet
|
|
|
|
@name="badge-granter-table"
|
|
|
|
@outletArgs={{hash
|
|
|
|
groupedBadges=this.groupedBadges
|
|
|
|
revokeBadge=this.revokeBadge
|
|
|
|
expandGroup=this.expandGroup
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<table id="user-badges">
|
|
|
|
<tbody>
|
2020-02-10 15:14:26 +08:00
|
|
|
<tr>
|
2024-10-24 22:10:10 +08:00
|
|
|
<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>
|
2020-02-10 15:14:26 +08:00
|
|
|
</tr>
|
2024-10-24 22:10:10 +08:00
|
|
|
{{#each this.groupedBadges as |userBadge|}}
|
|
|
|
<tr>
|
|
|
|
<td><UserBadge
|
|
|
|
@badge={{userBadge.badge}}
|
|
|
|
@count={{userBadge.count}}
|
|
|
|
/></td>
|
|
|
|
<td>
|
|
|
|
<LinkTo @route="adminUser" @model={{userBadge.granted_by}}>
|
|
|
|
{{avatar userBadge.granted_by imageSize="tiny"}}
|
|
|
|
{{userBadge.granted_by.username}}
|
|
|
|
</LinkTo>
|
|
|
|
</td>
|
|
|
|
<td class="reason">
|
|
|
|
{{#if userBadge.postUrl}}
|
|
|
|
<a href={{userBadge.postUrl}}>{{userBadge.topic_title}}</a>
|
|
|
|
{{/if}}
|
|
|
|
</td>
|
|
|
|
<td>{{age-with-tooltip userBadge.granted_at}}</td>
|
|
|
|
<td>
|
|
|
|
{{#if userBadge.grouped}}
|
|
|
|
<DButton
|
|
|
|
@action={{fn this.expandGroup userBadge}}
|
|
|
|
@label="admin.badges.expand"
|
|
|
|
/>
|
|
|
|
{{else}}
|
|
|
|
<DButton
|
|
|
|
@action={{fn this.revokeBadge userBadge}}
|
|
|
|
@label="admin.badges.revoke"
|
|
|
|
class="btn-danger"
|
|
|
|
/>
|
|
|
|
{{/if}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{else}}
|
|
|
|
<tr>
|
|
|
|
<td colspan="5">
|
|
|
|
<p>{{i18n
|
|
|
|
"admin.badges.no_user_badges"
|
|
|
|
name=this.user.username
|
|
|
|
}}</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{/each}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</PluginOutlet>
|
2014-03-19 22:27:21 +08:00
|
|
|
</div>
|
2022-06-30 18:30:50 +08:00
|
|
|
</ConditionalLoadingSpinner>
|