feat: pass extra css (#1392)

This commit is contained in:
Markos Gogoulos 2025-09-24 19:01:06 +03:00 committed by GitHub
parent 1c1af489f1
commit 553a25a86f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 10 deletions

View File

@ -105,16 +105,23 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
SITE_ID = 1 SITE_ID = 1
# these are the logos by default. SVG gets a priority # these are the portal logos (dark and light)
# which means it will be used if available # set new paths for svg or png if you want to override
# if you want to override them, set the new paths here # svg has priority over png, so if you want to use
# and place the files on the static/images folder # custom pngs and not svgs, remove the lines with svgs
# or set as empty strings
# example:
# PORTAL_LOGO_DARK_SVG = ""
# PORTAL_LOGO_LIGHT_SVG = ""
# place the files on static/images folder
PORTAL_LOGO_DARK_SVG = "/static/images/logo_dark.svg" PORTAL_LOGO_DARK_SVG = "/static/images/logo_dark.svg"
PORTAL_LOGO_DARK_PNG = "/static/images/logo_dark.png" PORTAL_LOGO_DARK_PNG = "/static/images/logo_dark.png"
PORTAL_LOGO_LIGHT_SVG = "/static/images/logo_light.svg" PORTAL_LOGO_LIGHT_SVG = "/static/images/logo_light.svg"
PORTAL_LOGO_LIGHT_PNG = "/static/images/logo_dark.png" PORTAL_LOGO_LIGHT_PNG = "/static/images/logo_dark.png"
# paths to extra css files to be included, eg "/static/css/custom.css"
# place css inside static/css folder
EXTRA_CSS_PATHS = []
# protection agains anonymous users # protection agains anonymous users
# per ip address limit, for actions as like/dislike/report # per ip address limit, for actions as like/dislike/report
TIME_TO_ACTION_ANONYMOUS = 10 * 60 TIME_TO_ACTION_ANONYMOUS = 10 * 60

View File

@ -13,11 +13,11 @@ def stuff(request):
ret["DEFAULT_THEME"] = settings.DEFAULT_THEME ret["DEFAULT_THEME"] = settings.DEFAULT_THEME
ret["PORTAL_NAME"] = settings.PORTAL_NAME ret["PORTAL_NAME"] = settings.PORTAL_NAME
ret["PORTAL_LOGO_DARK_SVG"] = settings.PORTAL_LOGO_DARK_SVG ret["PORTAL_LOGO_DARK_SVG"] = getattr(settings, 'PORTAL_LOGO_DARK_SVG', "")
ret["PORTAL_LOGO_DARK_PNG"] = settings.PORTAL_LOGO_DARK_PNG ret["PORTAL_LOGO_DARK_PNG"] = getattr(settings, 'PORTAL_LOGO_DARK_PNG', "")
ret["PORTAL_LOGO_LIGHT_SVG"] = settings.PORTAL_LOGO_LIGHT_SVG ret["PORTAL_LOGO_LIGHT_SVG"] = getattr(settings, 'PORTAL_LOGO_LIGHT_SVG', "")
ret["PORTAL_LOGO_LIGHT_PNG"] = settings.PORTAL_LOGO_LIGHT_PNG ret["PORTAL_LOGO_LIGHT_PNG"] = getattr(settings, 'PORTAL_LOGO_LIGHT_PNG', "")
ret["EXTRA_CSS_PATHS"] = getattr(settings, 'EXTRA_CSS_PATHS', [])
ret["PORTAL_DESCRIPTION"] = settings.PORTAL_DESCRIPTION ret["PORTAL_DESCRIPTION"] = settings.PORTAL_DESCRIPTION
ret["LOAD_FROM_CDN"] = settings.LOAD_FROM_CDN ret["LOAD_FROM_CDN"] = settings.LOAD_FROM_CDN
ret["CAN_LOGIN"] = settings.LOGIN_ALLOWED ret["CAN_LOGIN"] = settings.LOGIN_ALLOWED

View File

@ -28,4 +28,9 @@
<link href="{% static "css/_extra.css" %}?v={{ VERSION }}" rel="preload" as="style"> <link href="{% static "css/_extra.css" %}?v={{ VERSION }}" rel="preload" as="style">
<link href="{% static "css/_extra.css" %}?v={{ VERSION }}" rel="stylesheet"> <link href="{% static "css/_extra.css" %}?v={{ VERSION }}" rel="stylesheet">
{% for css_path in EXTRA_CSS_PATHS %}
<link href="{{ css_path }}?v={{ VERSION }}" rel="preload" as="style">
<link href="{{ css_path }}?v={{ VERSION }}" rel="stylesheet">
{% endfor %}
<link href="{% static "js/_commons.js" %}?v={{ VERSION }}" rel="preload" as="script"> <link href="{% static "js/_commons.js" %}?v={{ VERSION }}" rel="preload" as="script">