delete all route add to thing and also idk ig buttons yay

pull/59/head
justcool393 2022-12-09 22:31:54 -06:00
parent a33660166f
commit 3b8ff5cc96
3 changed files with 11 additions and 6 deletions

View File

@ -6440,3 +6440,7 @@ div.markdown {
font-size: 10px;
}
}
.sub-banner-update-section .sub-settings-subsection {
margin-bottom: 1em;
}

View File

@ -499,7 +499,7 @@ def delete_sub_banner(v:User, sub:str, index:int):
ma = SubAction(
sub=sub.name,
kind='delete_banner',
note=index,
_note=index,
user_id=v.id
)
g.db.add(ma)
@ -507,8 +507,8 @@ def delete_sub_banner(v:User, sub:str, index:int):
return {"message": f"Deleted banner {index} from /h/{sub} successfully"}
@app.delete("/h/<sub>/settings/banners/")
@limiter.limit("1/10 second;10/day")
@ratelimit_user("1/10 second;10/day")
@limiter.limit("1/10 second;30/day")
@ratelimit_user("1/10 second;30/day")
def delete_all_sub_banners(v:User, sub:str):
sub = get_sub_by_name(sub)
if not v.mods(sub.name): abort(403)
@ -524,7 +524,7 @@ def delete_all_sub_banners(v:User, sub:str):
ma = SubAction(
sub=sub.name,
kind='delete_banner',
note='all',
_note='all',
user_id=v.id
)
g.db.add(ma)

View File

@ -61,7 +61,7 @@
</div>
<h5 class="mt-5">Banners</h5>
<div class="settings-section rounded">
<div class="settings-section rounded sub-banner-update-section">
{% for banner in sub.banner_urls %}
<section id="sub-banner-update-{{loop.index - 1}}" class="d-flex sub-settings-subsection">
<div class="title w-lg-75 text-md-center">
@ -69,7 +69,7 @@
</div>
<div class="body w-lg-100 my-auto">
<div class="d-flex">
<button class="btn btn-danger sub-banner-delete-button" id="sub-banner-delete-{{loop.index}}" onclick="areyousure(this)" data-click-2="postToastReload(this, '/h/{{sub.name}}/settings/banners/{{loop.index - 1}}', 'DELETE');">Delete</button>
<button class="btn btn-danger sub-banner-delete-button" id="sub-banner-delete-{{loop.index}}" onclick="areyousure(this)" data-click2="postToastReload(this, '/h/{{sub.name}}/settings/banners/{{loop.index - 1}}', 'DELETE');">Delete</button>
</div>
</div>
</section>
@ -89,6 +89,7 @@
Upload New Banner<input autocomplete="off" type="file" accept="image/*" hidden name="banner" onchange="form.submit()">
</label>
</form>
<button class="btn btn-danger sub-banner-delete-button" id="sub-banner-delete-all" onclick="areyousure(this)" data-click2="postToastReload(this, '/h/{{sub.name}}/settings/banners/', 'DELETE');">Delete All Banners</button>
</div>
</div>
<div class="text-small text-muted mt-3">All image files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.</div>