mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
1c87bb7fe9
1. Use `this.` instead of `{{action}}` where applicable 2. Use `{{fn}}` instead of `@actionParam` where applicable 3. Use non-`@` versions of class/type/tabindex/aria-controls/aria-expanded 4. Remove `btn` class (it's added automatically to all DButtons) 5. Remove `type="button"` (it's the default) 6. Use `concat-class` helper
99 lines
3.1 KiB
Handlebars
99 lines
3.1 KiB
Handlebars
<div class="admin-controls">
|
|
<nav>
|
|
<ul class="nav nav-pills">
|
|
<li><LinkTo @route="adminUser" @model={{this.user}}>{{d-icon
|
|
"caret-left"
|
|
}}
|
|
{{this.user.username}}</LinkTo></li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
|
|
<ConditionalLoadingSpinner @condition={{this.loading}}>
|
|
<div class="admin-container user-badges">
|
|
<h2>{{i18n "admin.badges.grant_badge"}}</h2>
|
|
<br />
|
|
{{#if this.noGrantableBadges}}
|
|
<p>{{i18n "admin.badges.no_badges"}}</p>
|
|
{{else}}
|
|
<form class="form-horizontal">
|
|
<div class="control-group">
|
|
<label>{{i18n "admin.badges.badge"}}</label>
|
|
<ComboBox
|
|
@value={{this.selectedBadgeId}}
|
|
@content={{this.grantableBadges}}
|
|
@onChange={{action (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"
|
|
/>
|
|
</form>
|
|
{{/if}}
|
|
|
|
<table id="user-badges">
|
|
<tbody>
|
|
<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 this.groupedBadges as |userBadge|}}
|
|
<tr>
|
|
<td><UserBadge
|
|
@badge={{userBadge.badge}}
|
|
@count={{userBadge.count}}
|
|
/></td>
|
|
<td>
|
|
<LinkTo @route="adminUser" @model={{userBadge.badge.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>
|
|
</div>
|
|
</ConditionalLoadingSpinner> |