add "give badge" button to profiles for easier badging

master
Aevann 2023-08-05 13:24:37 +03:00
parent 9300ac617b
commit 32966cbc62
3 changed files with 7 additions and 2 deletions

View File

@ -455,7 +455,7 @@ def admin_badges_grantable_list(v):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@admin_level_required(PERMS['USER_BADGES'])
def badge_grant_get(v):
grant = request.url.endswith("grant")
grant = request.path.endswith("grant")
badge_types = admin_badges_grantable_list(v)
return render_template("admin/badge_admin.html", v=v,

View File

@ -42,7 +42,8 @@
{% endfor %}
</table>
<label for="input-usernames">Usernames</label>
<input autocomplete="off" id="input-usernames" class="form-control" type="text" name="usernames" placeholder="Required (separated by space)" required>
{% set usernames = request.values.get('usernames') %}
<input autocomplete="off" id="input-usernames" class="form-control" type="text" name="usernames" placeholder="Required (separated by space)" {% if usernames %}value="{{usernames}}"{% endif %} required>
{% if grant %}
<label class="mt-2" for="input-url">URL</label>

View File

@ -85,6 +85,10 @@
{% endif %}
<div class="actionbtns my-3">
{% if FEATURES['BADGES'] and v.admin_level >= PERMS['USER_BADGES'] %}
<a id="give-badge-{{deviceType}}" class="btn btn-primary" style="display:inline-block!important" href="/admin/badge_grant?usernames={{u.username}}">Give Badge</a>
{% endif %}
{% if v.admin_level >= PERMS['ADMIN_ADD'] and not u.admin_level %}
<button type="button" id="add-admin-{{deviceType}}" class="btn btn-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/@{{u.username}}/make_admin','add-admin-{{deviceType}}','remove-admin-{{deviceType}}','d-none')">Make Admin</button>
{% endif %}