Fix #879: Admins can now add custom CSS from their pod settings

This commit is contained in:
Eliot Berriot 2019-07-03 11:06:13 +02:00
parent 78ab153734
commit 7897c8ac7f
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
5 changed files with 84 additions and 1 deletions

View file

@ -4,6 +4,7 @@ from dynamic_preferences.registries import global_preferences_registry
raven = types.Section("raven")
instance = types.Section("instance")
ui = types.Section("ui")
@global_preferences_registry.register
@ -98,3 +99,19 @@ class InstanceNodeinfoStatsEnabled(types.BooleanPreference):
"Disable this if you don't want to share usage and library statistics "
"in the nodeinfo endpoint but don't want to disable it completely."
)
@global_preferences_registry.register
class CustomCSS(types.StringPreference):
show_in_api = True
section = ui
name = "custom_css"
verbose_name = "Custom CSS code"
default = ""
help_text = (
"Custom CSS code, to be included in a <style> tag on all pages. "
"Loading third-party resources such as fonts or images can affect the performance "
"of the app and the privacy of your users."
)
widget = widgets.Textarea
field_kwargs = {"required": False}