discourse/app/assets/javascripts/admin/addon/templates/admin-badges/award.hbs
Ella E. be5c37a6d4
UX: Apply admin UI to Badges (#28724)
* UX: Add a description about badges

* WIP: Apply admin UI guidelines

* FIX: Add routeModels to dbutton

Allows routeModels to be passed to a DButton along
with route, so we can use them as a LinkTo replacement
in more places.

Also fix up badges admin page header.

* UX: Reorder action buttons

* UX: Change header hierarchy to better align page's content structure

* UX: Update copy and remove unnecessary UI elements

* UX: Adjust header's icon spacing

* UX: Fix the header action buttons on mobile

* Apply prettier

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2024-09-04 20:18:23 -06:00

96 lines
2.9 KiB
Handlebars

<section class="award-badge">
<h2>{{i18n "admin.badges.mass_award.title"}}</h2>
<p>{{i18n "admin.badges.mass_award.description"}}</p>
{{#if this.model}}
<form class="form-horizontal">
<div class="badge-preview control-group">
{{#if this.model}}
{{icon-or-image this.model}}
<span class="badge-display-name">{{this.model.name}}</span>
{{else}}
<span class="badge-placeholder">{{i18n
"admin.badges.mass_award.no_badge_selected"
}}</span>
{{/if}}
</div>
<div class="control-group">
<h4>{{i18n "admin.badges.mass_award.upload_csv"}}</h4>
<input
type="file"
id="massAwardCSVUpload"
accept=".csv"
onchange={{action "updateFileSelected"}}
/>
</div>
<div class="control-group">
<label class="checkbox-label">
<Input @type="checkbox" @checked={{this.replaceBadgeOwners}} />
{{i18n "admin.badges.mass_award.replace_owners"}}
</label>
{{#if this.model.multiple_grant}}
<label class="grant-existing-holders">
<Input
@type="checkbox"
@checked={{this.grantExistingHolders}}
class="grant-existing-holders-checkbox"
/>
{{i18n "admin.badges.mass_award.grant_existing_holders"}}
</label>
{{/if}}
</div>
<DButton
@action={{this.massAward}}
@disabled={{this.massAwardButtonDisabled}}
@icon="certificate"
@label="admin.badges.mass_award.perform"
type="submit"
class="btn-primary"
/>
<LinkTo @route="adminBadges.index" class="btn btn-normal">
{{d-icon "times"}}
<span>{{i18n "cancel"}}</span>
</LinkTo>
</form>
{{#if this.saving}}
{{i18n "uploading"}}
{{/if}}
{{#if this.resultsMessage}}
<p>
{{#if this.success}}
{{d-icon "check" class="bulk-award-status-icon success"}}
{{else}}
{{d-icon "times" class="bulk-award-status-icon failure"}}
{{/if}}
{{this.resultsMessage}}
</p>
{{#if this.unmatchedEntries.length}}
<p>
{{d-icon
"exclamation-triangle"
class="bulk-award-status-icon failure"
}}
<span>
{{#if this.unmatchedEntriesTruncated}}
{{i18n
"admin.badges.mass_award.csv_has_unmatched_users_truncated_list"
count=this.unmatchedEntriesCount
}}
{{else}}
{{i18n "admin.badges.mass_award.csv_has_unmatched_users"}}
{{/if}}
</span>
</p>
<ul>
{{#each this.unmatchedEntries as |entry|}}
<li>{{entry}}</li>
{{/each}}
</ul>
{{/if}}
{{/if}}
{{else}}
<span class="badge-required">{{i18n
"admin.badges.mass_award.no_badge_selected"
}}</span>
{{/if}}
</section>