From 9032e23182cd8108c79c040e1e7040a2aed11ad0 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 25 Aug 2022 22:34:05 +0200 Subject: [PATCH] add patron icons for WPD --- files/classes/user.py | 15 +++++++++++++++ files/helpers/const.py | 3 +++ files/templates/admin/badge_grant.html | 2 +- files/templates/admin/badge_remove.html | 2 +- files/templates/badges.html | 2 +- files/templates/comments.html | 4 ++++ files/templates/patrons.html | 2 +- files/templates/submission.html | 4 ++++ files/templates/submission_listing.html | 4 ++++ files/templates/userpage.html | 16 ++++++++++++---- files/templates/util/assetcache.html | 4 ++-- 11 files changed, 48 insertions(+), 10 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 93d3685c5..303002058 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -792,3 +792,18 @@ class User(Base): elif self.patron: # Patrons get profile views as a perk return True return False + + @property + @lazy + def patron_tooltip(self): + if self.patron == 1: + return 'Contributed at least $5' + if self.patron == 2: + return 'Contributed at least $10' + if self.patron == 3: + return 'Contributed at least $20' + if self.patron == 4: + return 'Contributed at least $50' + if self.patron == 5: + return 'Contributed at least $100' + return '' \ No newline at end of file diff --git a/files/helpers/const.py b/files/helpers/const.py index 6d3947780..04f6824cf 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -176,6 +176,7 @@ FEATURES = { 'USERS_SUICIDE': True, 'MARKUP_COMMANDS': True, 'REPOST_DETECTION': True, + 'PATRON_ICONS': False, } EMOJI_MARSEYS = True @@ -316,6 +317,8 @@ elif SITE == 'pcmemes.net': LOTTERY_TICKET_COST = 12 LOTTERY_SINK_RATE = -8 elif SITE == 'watchpeopledie.co': + FEATURES['PATRON_ICONS'] = True + PERMS['HOLE_CREATE'] = 2 PERMS['CONTENT_THREADS'] = 2 diff --git a/files/templates/admin/badge_grant.html b/files/templates/admin/badge_grant.html index 166b14860..a3cf2e268 100644 --- a/files/templates/admin/badge_grant.html +++ b/files/templates/admin/badge_grant.html @@ -62,7 +62,7 @@ {{badge.name}} diff --git a/files/templates/admin/badge_remove.html b/files/templates/admin/badge_remove.html index 02300c403..9106afc6b 100644 --- a/files/templates/admin/badge_remove.html +++ b/files/templates/admin/badge_remove.html @@ -62,7 +62,7 @@ {{badge.name}} diff --git a/files/templates/badges.html b/files/templates/badges.html index ab26047e0..44208ec8b 100644 --- a/files/templates/badges.html +++ b/files/templates/badges.html @@ -28,7 +28,7 @@ {{loop.index}} {{badge.name}} - {{badge.name}} + {{badge.name}} {{badge.description}} {%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %} diff --git a/files/templates/comments.html b/files/templates/comments.html index 291328a2d..894216550 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -197,6 +197,10 @@ {% if c.ghost %} 👻 {% else %} + {% if FEATURES['PATRON_ICONS'] and c.author.patron %} + {{c.author.patron_tooltip}} + {% endif %} + {% if FEATURES['HOUSES'] and c.author.house %} House {{c.author.house}} {% endif %} diff --git a/files/templates/patrons.html b/files/templates/patrons.html index 6791d7351..d5b302fff 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/submission.html b/files/templates/submission.html index 1e83fc28e..8b47430ab 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -663,6 +663,10 @@ {% if p.ghost %} 👻 {% else %} + {% if FEATURES['PATRON_ICONS'] and p.author.patron %} + {{p.author.patron_tooltip}} + {% endif %} + {% if FEATURES['HOUSES'] and p.author.house %} House {{p.author.house}} {% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 10f696a6f..72d418fde 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -199,6 +199,10 @@ {% if p.ghost %} 👻 {% else %} + {% if FEATURES['PATRON_ICONS'] and p.author.patron %} + {{p.author.patron_tooltip}} + {% endif %} + {% if FEATURES['HOUSES'] and p.author.house %} House {{p.author.house}} {% endif %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 69e75eada..3b5f3a697 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -66,6 +66,10 @@ {% endif %} + {% if FEATURES['PATRON_ICONS'] and u.patron %} + {{u.patron_tooltip}} + {% endif %} + {% if FEATURES['HOUSES'] and u.house %} House {{u.house}} {% endif %} @@ -367,10 +371,10 @@ {% for b in u.badges %} {% if b.url %} - {{b.name}} + {{b.name}} {% else %} - {{b.name}} + {{b.name}} {% endif %} {% endfor %} @@ -417,6 +421,10 @@ {% endif %} + {% if FEATURES['PATRON_ICONS'] and u.patron %} + {{u.patron_tooltip}} + {% endif %} + {% if FEATURES['HOUSES'] and u.house %} House {{u.house}} {% endif %} @@ -517,10 +525,10 @@ {% for b in u.badges %} {% if b.url %} - {{b.name}} + {{b.name}} {% else %} - {{b.name}} + {{b.name}} {% endif %} {% endfor %} diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 5dadf7568..110f27c5b 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -37,6 +37,6 @@ set CACHE_VER = { /assets/{{name}}{{file}}?v={{ CACHE_VER[name] }} {%- endmacro -%} -{%- macro asset_siteimg(name, file='') -%} - /i/{{SITE_NAME}}/{{name}}{{file}}?v=3009 +{%- macro asset_siteimg(name) -%} + /i/{{SITE_NAME}}/{{name}}?v=3009 {%- endmacro -%}