forked from rDrama/rDrama
Unify template helpers and macros, fix header.
The need for sidebars to have access to macros.random_image means all templates that include header.html (most templates) need to have access to `macros`, because header.html includes sidebar_{SITE_NAME}. Because of how sparse helpers was, we instead unify the two and replace it since I know we had helpers in every top-level template.master
parent
d7d8220a3f
commit
7feddc42f0
|
@ -5,7 +5,7 @@
|
|||
{% else %}
|
||||
<h5 class="mt-3">Alts</h5>
|
||||
{% endif %}
|
||||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
<section class="username-input-section mb-3">
|
||||
<form action="/admin/alts" method="get">
|
||||
<label for="link-input">Username</label>
|
||||
|
@ -16,7 +16,7 @@
|
|||
{% if u %}
|
||||
{% set count=alts|length %}
|
||||
<section class="userinfo-section">
|
||||
<p><a href="/@{{u.username}}">@{{u.username}}</a> created their account {{u.created_utc|timestamp}} and has {{count}} known alt{{help.plural(count)}}.<br>
|
||||
<p><a href="/@{{u.username}}">@{{u.username}}</a> created their account {{u.created_utc|timestamp}} and has {{count}} known alt{{macros.plural(count)}}.<br>
|
||||
They are {% if not u.is_suspended_permanently %}not {% endif %}permanently banned{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %} and they are {% if not u.shadowbanned %}not {% endif %}shadowbanned{% endif %}.</p>
|
||||
</section>
|
||||
<div class="overflow-x-auto">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{% if not request.headers.get("xhr") %}
|
||||
{% if comment_info %}
|
||||
<script>
|
||||
|
@ -139,7 +139,7 @@
|
|||
<i class="fas fa-face-sleeping text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was chudded for this comment {{c.chuddedfor}}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if c.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags(v)}} Report{{help.plural(c.active_flags(v))}}</button>{% endif %}
|
||||
{% if c.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags(v)}} Report{{macros.plural(c.active_flags(v))}}</button>{% endif %}
|
||||
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{c.author.shadowbanned}} for "{{c.author.ban_reason}}"'></i>{% endif %}
|
||||
{% if c.stickied %}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% if request.path == '/' %}
|
||||
|
|
|
@ -227,7 +227,7 @@
|
|||
</div>
|
||||
<div class="text-left pl-2">
|
||||
<div style="color: #{{v.name_color}}" class="text-small font-weight-bold"><span id="header--username" {% if v.patron %}class="patron" style="background-color:#{{v.name_color}}"{% endif %}>{{v.user_name}}</span></div>
|
||||
<div class="header--currency"><img alt="coins" class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{'coins.webp' | asset_siteimg}}" title="Coins" aria-label="coins"><span id="user-coins-amount">{{v.coins}}</span>{% if not FEATURES['PROCOINS'] %} Coin{{help.plural(v.coins)}}{% endif %}</div>
|
||||
<div class="header--currency"><img alt="coins" class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" src="{{'coins.webp' | asset_siteimg}}" title="Coins" aria-label="coins"><span id="user-coins-amount">{{v.coins}}</span>{% if not FEATURES['PROCOINS'] %} Coin{{macros.plural(v.coins)}}{% endif %}</div>
|
||||
{% if FEATURES['PROCOINS'] %}
|
||||
<div class="header--currency"><img alt="marseybux" class="mr-1 ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" src="/i/marseybux.webp?v=2000" title="Marseybux" aria-label="Marseybux"><span id="user-bux-amount">{{v.procoins}}</span></div>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -180,7 +180,7 @@
|
|||
{% if p.is_bot %} <i class="fas fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Bot"></i>{% endif %}
|
||||
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">Draft</span>{% endif %}
|
||||
{% if p.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px"onclick="document.getElementById('flaggers').classList.toggle('d-none')">{{p.active_flags(v)}} Report{{help.plural(p.active_flags(v))}}</button>{% endif %}
|
||||
{% if p.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px"onclick="document.getElementById('flaggers').classList.toggle('d-none')">{{p.active_flags(v)}} Report{{macros.plural(p.active_flags(v))}}</button>{% endif %}
|
||||
|
||||
{% if p.ghost %}
|
||||
<span {% if p.distinguish_level %}class="mod"{% endif %}>👻</span>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
|
||||
{% if v %}
|
||||
{% include "modals/award.html" %}
|
||||
|
@ -157,7 +157,7 @@
|
|||
{% if p.is_blocking and not p.ghost %}<i class="fas fa-user-minus text-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="You're blocking this user, but you can see this post because you're an admin."></i>{% endif %}
|
||||
{% if p.is_blocked %}<i class="fas fa-user-minus text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="This user is blocking you."></i>{% endif %}
|
||||
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">Draft</span>{% endif %}
|
||||
{% if p.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px"onclick="document.getElementById('flaggers-{{p.id}}').classList.toggle('d-none')">{{p.active_flags(v)}} Report{{help.plural(p.active_flags(v))}}</button>{% endif %}
|
||||
{% if p.active_flags(v) %}<button type="button" class="btn btn-primary" style="padding:1px 5px; font-size:10px"onclick="document.getElementById('flaggers-{{p.id}}').classList.toggle('d-none')">{{p.active_flags(v)}} Report{{macros.plural(p.active_flags(v))}}</button>{% endif %}
|
||||
|
||||
{% if p.ghost %}
|
||||
<span {% if p.distinguish_level %}class="mod"{% endif %}>👻</span>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
{%- import 'util/macros.html' as macros with context -%}
|
||||
{%- import 'html_head.html' as html_head with context -%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{%- macro plural(value, suffix='s') -%}
|
||||
{%- if value != 1 -%}
|
||||
{{suffix}}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
|
@ -1,10 +1,16 @@
|
|||
{% macro banner(src, href, alt, expand) %}
|
||||
{%- macro plural(value, suffix='s') -%}
|
||||
{%- if value != 1 -%}
|
||||
{{suffix}}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro banner(src, href, alt, expand) %}
|
||||
<a href="{{href|default(src)}}" rel="nofollow noopener">
|
||||
<img onclick="{{expand|default('expandDesktopImage()')}}" alt="{{alt|default('site banner')}}" src="{{src|default(live_banner())}}">
|
||||
</a>
|
||||
{% endmacro %}
|
||||
{% endmacro -%}
|
||||
|
||||
{% macro live_banner() %}
|
||||
{%- macro live_banner() %}
|
||||
{% set path = "files/assets/images/" + SITE_NAME %}
|
||||
{% if not v and os_path.exists(path + "/cached.webp") %}
|
||||
{{ 'cached.webp' | asset_siteimg }}
|
||||
|
@ -13,9 +19,9 @@
|
|||
{% else %}
|
||||
{{ 'banner.webp' | asset_siteimg }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{% endmacro -%}
|
||||
|
||||
{% macro random_image(assetdir) %}
|
||||
{%- macro random_image(assetdir) %}
|
||||
{% set path = "assets/images/" + SITE_NAME + "/" + assetdir %}
|
||||
{{ "/" + path + "/" + listdir('files/' + path)|random() + '?v=45' }}
|
||||
{% endmacro %}
|
||||
{% endmacro -%}
|
||||
|
|
Loading…
Reference in New Issue