From 0aafd810a2a476ae249c13f5d10240787e772839 Mon Sep 17 00:00:00 2001 From: TLSM Date: Sun, 29 May 2022 00:52:40 -0400 Subject: [PATCH] assetcache: Add dynamic file parameter, apply more. Assetcache macro improvement: to support assets in folders which are dynamically referenced by e.g. ID or name, the `asset` macro now accepts an optional second parameter to be included in the path but not to be used for versioning the class of assets. To support recent commits, assetcache now applies for: - images/badges/*.webp - js/: award_modal.js, bootstrap.js, header.js --- files/templates/admin/badge_grant.html | 2 +- files/templates/admin/badge_remove.html | 2 +- files/templates/award_modal.html | 2 +- files/templates/badges.html | 2 +- files/templates/chat.html | 2 +- files/templates/default.html | 2 +- files/templates/header.html | 2 +- files/templates/login.html | 2 +- files/templates/patrons.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/submit.html | 2 +- files/templates/util/assetcache.html | 10 +++++++--- 15 files changed, 21 insertions(+), 17 deletions(-) diff --git a/files/templates/admin/badge_grant.html b/files/templates/admin/badge_grant.html index f60ccaab3..f2c745479 100644 --- a/files/templates/admin/badge_grant.html +++ b/files/templates/admin/badge_grant.html @@ -60,7 +60,7 @@ - + {{badge.name}} {{badge.description}} diff --git a/files/templates/admin/badge_remove.html b/files/templates/admin/badge_remove.html index d7e77a0fe..5c60889ad 100644 --- a/files/templates/admin/badge_remove.html +++ b/files/templates/admin/badge_remove.html @@ -60,7 +60,7 @@ - + {{badge.name}} {{badge.description}} diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 3545b94aa..b61bbeb3e 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -44,4 +44,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/files/templates/badges.html b/files/templates/badges.html index 774945855..f0925a6d5 100644 --- a/files/templates/badges.html +++ b/files/templates/badges.html @@ -27,7 +27,7 @@ {{loop.index}} {{badge.name}} - {{badge.name}} + {{badge.name}} {{badge.description}} {%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %} {{ ct[0] }} diff --git a/files/templates/chat.html b/files/templates/chat.html index 103c25798..a5ec6d6e2 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -106,7 +106,7 @@ - + {% include "header.html" %} diff --git a/files/templates/default.html b/files/templates/default.html index ba8af03f2..797500b51 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -10,7 +10,7 @@ {% endif %} - + {% if v %} diff --git a/files/templates/header.html b/files/templates/header.html index 5d2c5fbfd..01ee43810 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -271,7 +271,7 @@ - + {% if v and not err %}
{{v.formkey}}
diff --git a/files/templates/login.html b/files/templates/login.html index ec9ac71a0..479a8b9a9 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -8,7 +8,7 @@ - + diff --git a/files/templates/patrons.html b/files/templates/patrons.html index f59e5ac54..caf02a318 100644 --- a/files/templates/patrons.html +++ b/files/templates/patrons.html @@ -14,7 +14,7 @@ {{loop.index}} {{u.username}} - 2{{u.patron}} + 2{{u.patron}} {% endfor %} diff --git a/files/templates/settings.html b/files/templates/settings.html index 62d63e739..c94fffd62 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -5,7 +5,7 @@ - + diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 538e54b2e..6e896472e 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -6,7 +6,7 @@ - + diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index dc8c2526c..3f12d4968 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -7,7 +7,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index cf03492c2..32a6fcd04 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -8,7 +8,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 67fec2350..f5a6aa688 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -5,7 +5,7 @@ - + diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 5910d01df..b2e3feec4 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -1,8 +1,12 @@ {%- set CACHE_VER = { - 'css/main.css': 278, + 'css/main.css': 279, + 'js/award_modal.js': 250, + 'js/bootstrap.js': 256, + 'js/header.js': 267, + 'images/badges/': 1017, } -%} -{%- macro asset(name) -%} -/assets/{{name}}?v={{ CACHE_VER[name] }} +{%- macro asset(name, file='') -%} +/assets/{{name}}{{file}}?v={{ CACHE_VER[name] }} {%- endmacro -%}