make 1 more button instant

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-11-07 08:32:30 +02:00
parent 4b3b52013a
commit c915142089
2 changed files with 13 additions and 2 deletions

View File

@ -304,7 +304,7 @@ def remove_mod(v, sub):
)
g.db.add(ma)
return redirect(f'/h/{sub}/mods')
return {"message": f"@{user.username} has been removed as a mod!"}
@app.get("/create_hole")
@is_not_permabanned

View File

@ -1,5 +1,16 @@
{% extends "default.html" %}
{% block content %}
<script>
function removeMod(e) {
sendFormXHR(e,
() => {
e.target.parentElement.parentElement.remove();
}
)
}
</script>
<h5 class="mt-2">/h/{{sub}} Mods</h5>
<div class="overflow-x-auto mt-1"><table class="table table-striped mb-5">
<thead class="bg-primary text-white">
@ -17,7 +28,7 @@
<td data-time="{{mod.created_utc}}"></td>
<td>
{% if v.id == user.id or v.mod_date(sub.name) and v.mod_date(sub.name) < mod.created_utc %}
<form action="/h/{{sub}}/remove_mod" method="post">
<form action="/h/{{sub}}/remove_mod" method="post" onsubmit="removeMod(event)">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="uid" value="{{user.id}}">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" onclick="disable(this)" value="{% if v.id == user.id %}Resign{% else %}Remove Mod{% endif %}">