forked from rDrama/rDrama
1
0
Fork 0

remove unnecessary garbage

master
Aevann 2023-11-04 23:50:23 +02:00
parent 799615fe8c
commit 415b245630
4 changed files with 9 additions and 18 deletions

View File

@ -43,19 +43,10 @@ class Hole(Base):
return f'{SITE_FULL_IMAGES}/i/{SITE_NAME}/sidebar.webp?x=6'
@property
@lazy
def banner_urls(self):
return self.bannerurls
@lazy
def random_banner(self):
if not self.banner_urls: return None
return random.choice(self.banner_urls)
@property
@lazy
def has_banners(self):
return bool(self.bannerurls)
if not self.bannerurls: return None
return random.choice(self.bannerurls)
@property
@lazy

View File

@ -581,7 +581,7 @@ def delete_all_hole_banners(v, hole):
hole = get_hole(hole)
if not v.mods(hole.name): abort(403)
for banner in hole.banner_urls:
for banner in hole.bannerurls:
try:
remove_media_using_link(banner)
except FileNotFoundError:

View File

@ -9,17 +9,17 @@
{% block banner %}
{% include "modals/expanded_image.html" %}
{% if err or '@' not in request.path %}
{% if IS_FISTMAS() and not (hole and hole.has_banners) %}
{% if IS_FISTMAS() and not (hole and hole.bannerurls) %}
{% include 'events/fistmas/banner.html' %}
{% elif IS_HOMOWEEN() and not (hole and hole.has_banners) %}
{% elif IS_HOMOWEEN() and not (hole and hole.bannerurls) %}
{% include 'events/homoween/banner.html' %}
{% else %}
{% set path = "files/assets/images/" ~ SITE_NAME %}
{% if err and SITE_NAME == 'rDrama' %}
{% set src = "banner_error.webp" | asset_siteimg %}
{% elif hole and hole.has_banners %}
{% set src = hole.random_banner() %}
{% elif hole and hole.bannerurls %}
{% set src = hole.random_banner %}
{% set alt = ['/h/', hole, ' banner']|join %}
{% set class = 'site-banner-hole' %}
{% elif get_running_orgy(v) and os_path.exists(path ~ "/orgy_banners") %}
@ -62,7 +62,7 @@
<img data-nonce="{{g.nonce}}" data-onclick="{{expand|default('expandImage()')}}" class="{{class|default('site-banner')}}" alt="{{alt|default('site banner')}}" src="{{banner_url}}">
{% endmacro %}
{% if hole and hole.has_banners %}
{% if hole and hole.bannerurls %}
{{img_element()}}
{% else %}
<div class="banner-wrapper">

View File

@ -45,7 +45,7 @@
<h5 class="mt-5">Banners</h5>
<div class="settings-section rounded hole-banner-update-section">
{% for banner in hole.banner_urls %}
{% for banner in hole.bannerurls %}
<section id="hole-banner-update-{{loop.index - 1}}" class="mt-5 d-block hole-settings-subsection">
<img class="mr-3" loading="lazy" alt="/h/{{hole.name}} banner" src="{{banner}}" style="max-height:300px;max-width:100%">
<button class="btn btn-danger hole-banner-delete-button mt-2" id="hole-banner-delete-{{loop.index}}" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/h/{{hole.name}}/settings/banners/delete/{{loop.index - 1}}')">Delete</button>