From 6c6de80ae831bf06d0b083bf731a030872654130 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 25 Oct 2023 13:52:31 +0000 Subject: [PATCH] Add an IPFire logo module so that we can customise it depending on time of year Signed-off-by: Michael Tremer --- Makefile.am | 1 + src/sass/main.sass | 12 ++++++++++-- src/templates/base.html | 8 ++++---- src/templates/modules/ipfire-logo.html | 18 ++++++++++++++++++ src/web/__init__.py | 1 + src/web/ui_modules.py | 5 +++++ 6 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 src/templates/modules/ipfire-logo.html diff --git a/Makefile.am b/Makefile.am index ea3350be..c691f2d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -265,6 +265,7 @@ templates_messagesdir = $(templatesdir)/messages templates_modules_DATA = \ src/templates/modules/christmas-banner.html \ + src/templates/modules/ipfire-logo.html \ src/templates/modules/map.html \ src/templates/modules/progress-bar.html diff --git a/src/sass/main.sass b/src/sass/main.sass index b1292f76..746724f6 100644 --- a/src/sass/main.sass +++ b/src/sass/main.sass @@ -27,10 +27,18 @@ $success-invert: #ffffff $danger: #ac001a $warning: #f3ff50 +// Pride Colours +$pride-red: #e40303 +$pride-orange: #ff8c00 +$pride-yellow: #ffed00 +$pride-green: #008026 +$pride-blue: #24408e +$pride-purple: #732982 + // Custom Colours -$lwl: #6534C8 +$lwl: #6534C8 -$custom-colors: ("secondary" : ($secondary, $secondary-invert), "lwl" : ($lwl, $white)) +$custom-colors: ("secondary" : ($secondary, $secondary-invert), "lwl" : ($lwl, $white), "pride-red" : ($pride-red, $white), "pride-orange" : ($pride-orange, $black), "pride-yellow" : ($pride-yellow, $black), "pride-green" : ($pride-green, $white), "pride-blue" : ($pride-blue, $white), "pride-purple" : ($pride-purple, $white)) // Use the primary colour for links $link: $primary diff --git a/src/templates/base.html b/src/templates/base.html index 0582c181..d5446cef 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -27,13 +27,13 @@ {% if request.path.startswith("/projects/location") %} - IPFire_Location + {% module IPFireLogo("Location") %} {% elif hostname.startswith("fireinfo.") %} - IPFire_Fireinfo + {% module IPFireLogo("Fireinfo") %} {% elif hostname.startswith("nopaste.") %} - IPFire_Nopaste + {% module IPFireLogo("nopaste") %} {% else %} - IPFire_ + {% module IPFireLogo() %} {% end %} diff --git a/src/templates/modules/ipfire-logo.html b/src/templates/modules/ipfire-logo.html new file mode 100644 index 00000000..ac2d64c3 --- /dev/null +++ b/src/templates/modules/ipfire-logo.html @@ -0,0 +1,18 @@ +{% set pride_colors = ("pride-red", "pride-orange", "pride-yellow", "pride-green", "pride-blue", "pride-purple") %} + +{# Christmas #} +{% if now.month == 12 %} + IPFire_{{ suffix or "" }} 🎄 + +{# Halloween #} +{% elif now.month == 10 and now.day >= 28 %} + IPFire_{{ suffix or "" }} 🎃 + +{# Pride Month #} +{% elif now.month == 7 %} + {% for color, i in zip(pride_colors, "IPFire") %}{{ i }}{% end %}_{{ suffix or "" }} + +{# Other times of the year #} +{% else %} + IPFire_{{ suffix or "" }} +{% end %} diff --git a/src/web/__init__.py b/src/web/__init__.py index 35f7fc25..481c32ff 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -97,6 +97,7 @@ class Application(tornado.web.Application): # Misc "ChristmasBanner" : ui_modules.ChristmasBannerModule, + "IPFireLogo" : ui_modules.IPFireLogoModule, "Markdown" : ui_modules.MarkdownModule, "Map" : ui_modules.MapModule, "ProgressBar" : ui_modules.ProgressBarModule, diff --git a/src/web/ui_modules.py b/src/web/ui_modules.py index 43cfd9a6..574f9ac9 100644 --- a/src/web/ui_modules.py +++ b/src/web/ui_modules.py @@ -10,6 +10,11 @@ class UIModule(tornado.web.UIModule): return self.handler.backend +class IPFireLogoModule(UIModule): + def render(self, suffix=None): + return self.render_string("modules/ipfire-logo.html", suffix=suffix) + + class ChristmasBannerModule(UIModule): def render(self): return self.render_string("modules/christmas-banner.html") -- 2.47.2