forked from rDrama/rDrama
add "give badge" button to profiles for easier badging
parent
9300ac617b
commit
32966cbc62
|
@ -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)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@admin_level_required(PERMS['USER_BADGES'])
|
@admin_level_required(PERMS['USER_BADGES'])
|
||||||
def badge_grant_get(v):
|
def badge_grant_get(v):
|
||||||
grant = request.url.endswith("grant")
|
grant = request.path.endswith("grant")
|
||||||
badge_types = admin_badges_grantable_list(v)
|
badge_types = admin_badges_grantable_list(v)
|
||||||
|
|
||||||
return render_template("admin/badge_admin.html", v=v,
|
return render_template("admin/badge_admin.html", v=v,
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<label for="input-usernames">Usernames</label>
|
<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 %}
|
{% if grant %}
|
||||||
<label class="mt-2" for="input-url">URL</label>
|
<label class="mt-2" for="input-url">URL</label>
|
||||||
|
|
|
@ -85,6 +85,10 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="actionbtns my-3">
|
<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 %}
|
{% 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>
|
<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 %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue