From 116a17932b128ec17b8304548abba85b19ea51b5 Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 16 Apr 2023 13:48:18 +0200 Subject: [PATCH] feat: site symbol support --- README.md | 1 + src/unfold/settings.py | 1 + src/unfold/sites.py | 3 +++ src/unfold/templates/unfold/helpers/site_icon.html | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 70140f4d..99176e03 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ UNFOLD = { "SITE_HEADER": None, "SITE_URL": "/", "SITE_ICON": lambda request: static("logo.svg"), + "SITE_SYMBOL": "speed", # symbol from icon set "DASHBOARD_CALLBACK": "sample_app.dashboard_callback", "LOGIN": { "image": lambda r: static("sample/login-bg.jpg"), diff --git a/src/unfold/settings.py b/src/unfold/settings.py index adcf1932..d29d57b1 100644 --- a/src/unfold/settings.py +++ b/src/unfold/settings.py @@ -7,6 +7,7 @@ "SITE_HEADER": None, "SITE_URL": "/", "SITE_ICON": None, + "SITE_SYMBOL": None, "COLORS": { "primary": { "50": "250 245 255", diff --git a/src/unfold/sites.py b/src/unfold/sites.py index 019a298d..8ee12ee7 100644 --- a/src/unfold/sites.py +++ b/src/unfold/sites.py @@ -54,6 +54,9 @@ def each_context(self, request): "icon": self._get_value( get_config(self.settings_name)["SITE_ICON"], request ), + "symbol": self._get_value( + get_config(self.settings_name)["SITE_SYMBOL"], request + ), "tab_list": get_config(self.settings_name)["TABS"], "styles": [ self._get_value(style, request) diff --git a/src/unfold/templates/unfold/helpers/site_icon.html b/src/unfold/templates/unfold/helpers/site_icon.html index 5a5efb1e..cb0320d9 100644 --- a/src/unfold/templates/unfold/helpers/site_icon.html +++ b/src/unfold/templates/unfold/helpers/site_icon.html @@ -6,6 +6,6 @@ {% else %} - settings + {% if symbol %}{{ symbol }}{% else %}settings{% endif %} {% endif %}