dedup sidebars

master
Aevann 2022-12-25 00:59:43 +02:00
parent da900ede44
commit 0a1effeaf7
7 changed files with 20 additions and 143 deletions

View File

@ -9,7 +9,6 @@ def user_event_darkmode(target, db):
EVENT_JINJA_CONST = {
"EVENT_BANNER": "banner_rDrama.html",
"EVENT_ICONS": True,
"EVENT_SIDEBAR": True,
"EVENT_STYLES": "blizzard.css",
"EVENT_AWARDS": True,
"EVENT_MUSIC": "music.html",

View File

@ -47,7 +47,7 @@
{% block sidebar %}
{% if has_sidebar and (home or p) %}
{% set sidebar = "sidebar_" ~ SITE_NAME ~ ".html" %}
{% include sidebar if not EVENT_SIDEBAR else 'event/' ~ sidebar %}
{% include sidebar %}
{% endif %}
{% endblock %}
</div>

View File

@ -1,77 +0,0 @@
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3" {% if request.path != '/sidebar' %}id="sidebar-content"{% endif %}>
{%- if v -%}
{%- set art_image = macros.random_image("assets/images/" ~ SITE_NAME ~ "/sidebar") -%}
{%- else -%}
{%- set art_image = '/i/' ~ SITE_NAME ~ '/sidebar.webp?v=3000' -%}
{%- endif -%}
{% if request.path != '/sidebar' %}
<a href="{{art_image}}">
<img class="mb-4" alt="sidebar image" onclick="expandDesktopImage()" loading="lazy" src="{{art_image}}" width=100%>
</a>
{% endif %}
<p class="text-center text-md mb-4">
<a class="sidebar-link d-md-none" href="/random_user" data-bs-toggle="tooltip" data-bs-placement="top" title="Random User"><i class="fas fa-music"></i></a>
<a class="sidebar-link" href="/badges" data-bs-toggle="tooltip" data-bs-placement="top" title="Badges"><i class="fas fa-hexagon"></i></a>
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
<a class="sidebar-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
<span class="sidebar-link" onclick="postToastRoastEventDarkmode(this, '/events/fistmas2022/darkmode')" style="display:inline" data-bs-toggle="tooltip" data-bs-placement="top" title="Toggle Dark Mode"><i class="fas fa-moon-over-sun"></i></span>
<script src="{{'event/js/darkmode.js' | asset}}"></script>
</p>
{% if sub and sub.sidebar_html %}
<div class="mb-4">{{sub.sidebar_html|safe}}</div>
{% endif %}
<div class="sidebar-wpd--flairs sidebar-wpd--flairs--3">
<a href="/h/accident">Accident</a>
<a href="/h/suicide">Suicide</a>
<a href="/h/animal">Animal</a>
<a href="/h/beating">Beating</a>
<a href="/h/bladed">Bladed</a>
<a href="/h/beheading">Beheading</a>
<a href="/h/vehicle">Vehicle</a>
<a href="/h/medical">Medical</a>
<a href="/h/shooting">Shooting</a>
<a href="/h/falling">Falling</a>
<a href="/h/explosions">Explosions</a>
<a href="/h/industrial">Industrial</a>
<a href="/h/electricity">Electricity</a>
<a href="/h/burning">Burning</a>
<a href="/h/drowning">Drowning</a>
<a href="/h/cartel">Cartel</a>
<a href="/h/isis">ISIS</a>
<a href="/h/execution">Execution</a>
<a href="/h/maiming">Maiming</a>
<a href="/h/police">Police</a>
<a href="/h/combat">Combat</a>
<a href="/h/other">Other</a>
<a href="/h/compilation">Compilation</a>
<a href="/h/request" class="font-italic">Request</a>
</div>
<hr>
<div class="sidebar-wpd--flairs sidebar-wpd--flairs--3">
<a href="/h/gore">Gore</a>
<a href="/h/aftermath">Aftermath</a>
<a href="/h/selfharm">Self-Harm</a>
</div>
<hr>
<div class="sidebar-wpd--flairs sidebar-wpd--flairs--2 mb-4">
<a href="/h/meta" class="font-weight-bold">Meta</a>
<a href="/h/discussion">Discussion</a>
<a href="/h/social">Social</a>
<a href="/h/music">Music</a>
</div>
<div class="sidebar--rules sidebar--rules--wpd">
{% set rules = "rules_" ~ SITE_NAME ~ ".html" %}
{% include rules %}
</div>
</div>
{% include "event/music.html" %}

View File

@ -1,63 +0,0 @@
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3 pb-5" {% if request.path != '/sidebar' %}id="sidebar-content"{% endif %}>
{% if sub %}
{% set image = sub.sidebar_url %}
{% else %}
{% set sidebar_path = "assets/event/images/sidebar" %}
{% set selected_image = listdir('files/' ~ sidebar_path)|random() %}
{% set image = "/" ~ sidebar_path ~ "/" ~ selected_image ~ '?v=45' %}
{% endif %}
{% if request.path != '/sidebar' %}
<a href="{{image}}" style="text-decoration:none">
<img class="mb-4" alt="sidebar image" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
</a>
{% endif %}
<p class="text-center text-md mb-4">
<a class="sidebar-link d-md-none" href="/random_user" data-bs-toggle="tooltip" data-bs-placement="top" title="Random User"><i class="fas fa-music"></i></a>
<a class="sidebar-link" href="/marseys" data-bs-toggle="tooltip" data-bs-placement="top" title="Marseys"><i class="fas fa-cat"></i></a>
<a class="sidebar-link" href="/badges" data-bs-toggle="tooltip" data-bs-placement="top" title="Badges"><i class="fas fa-hexagon"></i></a>
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
<a class="sidebar-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
<span class="sidebar-link" onclick="postToastRoastEventDarkmode(this, '/events/fistmas2022/darkmode')" style="display:inline" data-bs-toggle="tooltip" data-bs-placement="top" title="Toggle Dark Mode"><i class="fas fa-moon-over-sun"></i></span>
</p>
<script src="{{'event/js/darkmode.js' | asset}}"></script>
{% if sub %}
{% if sub.sidebar_html %}
<div class="mb-4">{{sub.sidebar_html|safe}}</div>
{% endif %}
{% if v %}
<a class="btn btn-primary btn-block mb-3" href="/holes">BROWSE {{HOLE_NAME|upper}}S</a>
{% if v.can_create_hole -%}
<a class="btn btn-primary btn-block mb-3" href="/create_hole">CREATE {{HOLE_NAME|upper}}</a>
{%- endif %}
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/log">{{HOLE_NAME|upper}} LOG</a>
{% if v.mods(sub.name) %}
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/settings">{{HOLE_NAME|upper}} SETTINGS</a>
{% endif %}
{% endif %}
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/mods">{{HOLE_NAME|upper}} MODS</a>
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/exilees">{{HOLE_NAME|upper}} EXILEES</a>
{% else %}
<a id="sidebar--directory--btn" class="btn btn-primary btn-block mb-3" href="/directory">
<span id="sidebar--directory--head">DIRECTORY</span>
<span id="sidebar--directory--subhead">Submit Marseys & Art | Info Megathreads</span>
</a>
<a class="btn btn-primary btn-block mb-3" href="/holes">BROWSE {{HOLE_NAME|upper}}S</a>
{% if v and v.can_create_hole -%}
<a class="btn btn-primary btn-block mb-3" href="/create_hole">CREATE {{HOLE_NAME|upper}}</a>
{%- endif %}
<div class="sidebar--rules sidebar--rules--rdrama">
{% set rules = "rules_" ~ SITE_NAME ~ ".html" %}
{% include rules %}
</div>
{% endif %}
</div>
{% include "event/music.html" %}

View File

@ -344,7 +344,7 @@
<li class="mt-3">
{% if has_sidebar %}
{% set sidebar = "sidebar_" ~ SITE_NAME ~ ".html" %}
{% include sidebar if not EVENT_SIDEBAR else 'event/' ~ sidebar %}
{% include sidebar %}
{% endif %}
</li>
</ul>

View File

@ -19,6 +19,9 @@
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
<a class="sidebar-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
{% if HOLIDAY_EVENT %}
<span class="sidebar-link" onclick="postToastRoastEventDarkmode(this, '/events/fistmas2022/darkmode')" style="display:inline" data-bs-toggle="tooltip" data-bs-placement="top" title="Toggle Dark Mode"><i class="fas fa-moon-over-sun"></i></span>
{% endif %}
</p>
{% if sub and sub.sidebar_html %}
@ -70,3 +73,8 @@
{% include rules %}
</div>
</div>
{% if HOLIDAY_EVENT %}
<script src="{{'event/js/darkmode.js' | asset}}"></script>
{% include "event/music.html" %}
{% endif %}

View File

@ -2,6 +2,8 @@
{% if sub %}
{% set image=sub.sidebar_url %}
{% elif HOLIDAY_EVENT %}
{% set image = macros.random_image("assets/event/images/sidebar") %}
{% else %}
{% set image = macros.random_image("assets/images/" ~ SITE_NAME ~ "/sidebar") %}
{% endif %}
@ -26,6 +28,9 @@
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
<a class="sidebar-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
{% if HOLIDAY_EVENT %}
<span class="sidebar-link" onclick="postToastRoastEventDarkmode(this, '/events/fistmas2022/darkmode')" style="display:inline" data-bs-toggle="tooltip" data-bs-placement="top" title="Toggle Dark Mode"><i class="fas fa-moon-over-sun"></i></span>
{% endif %}
</p>
{% if sub %}
@ -60,3 +65,8 @@
</div>
{% endif %}
</div>
{% if HOLIDAY_EVENT %}
<script src="{{'event/js/darkmode.js' | asset}}"></script>
{% include "event/music.html" %}
{% endif %}