From 7feddc42f0b7624c0481f65fd53649c562f63e30 Mon Sep 17 00:00:00 2001 From: TLSM Date: Wed, 16 Nov 2022 04:25:50 -0500 Subject: [PATCH] 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. --- files/templates/admin/alts.html | 4 ++-- files/templates/authforms.html | 2 +- files/templates/chat.html | 2 +- files/templates/comments.html | 4 ++-- files/templates/default.html | 3 +-- files/templates/header.html | 2 +- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 2 +- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_listing.html | 4 ++-- files/templates/submit.html | 2 +- files/templates/util/helpers.html | 5 ----- files/templates/util/macros.html | 18 ++++++++++++------ 17 files changed, 30 insertions(+), 30 deletions(-) delete mode 100644 files/templates/util/helpers.html diff --git a/files/templates/admin/alts.html b/files/templates/admin/alts.html index cfb935b64..fc78dbffa 100644 --- a/files/templates/admin/alts.html +++ b/files/templates/admin/alts.html @@ -5,7 +5,7 @@ {% else %}
Alts
{% endif %} -{%- import 'util/helpers.html' as help -%} +{%- import 'util/macros.html' as macros with context -%}
@@ -16,7 +16,7 @@ {% if u %} {% set count=alts|length %}
-

@{{u.username}} created their account {{u.created_utc|timestamp}} and has {{count}} known alt{{help.plural(count)}}.
+

@{{u.username}} created their account {{u.created_utc|timestamp}} and has {{count}} known alt{{macros.plural(count)}}.
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 %}.

diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 285aeb960..1b6d57c64 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -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 -%} diff --git a/files/templates/chat.html b/files/templates/chat.html index 7724a6a65..ec6b5edc4 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -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 -%} diff --git a/files/templates/comments.html b/files/templates/comments.html index 79f08797c..46f9d06c0 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -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 %}