discourse/app/assets/javascripts/admin/addon/templates/badges-award.hbs
Osama Sayegh 31aa701518
FEATURE: Add option to grant badge multiple times to users using Bulk Award (#13571)
Currently when bulk-awarding a badge that can be granted multiple times, users in the CSV file are granted the badge once no matter how many times they're listed in the file and only if they don't have the badge already.

This PR adds a new option to the Badge Bulk Award feature so that it's possible to grant users a badge even if they already have the badge and as many times as they appear in the CSV file.
2021-07-15 05:53:26 +03:00

77 lines
2.6 KiB
Handlebars

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