diff options
author | Magnus Hagander | 2023-01-10 20:10:41 +0000 |
---|---|---|
committer | Magnus Hagander | 2023-01-10 20:13:17 +0000 |
commit | 80f7097c9d2e6378b0fcd1769b22e52730ccf924 (patch) | |
tree | 1c1f377d20a17c803b93aa5b55d77de886928e58 /postgresqleu/settings.py | |
parent | 0f8c74eb3b92e5043dd57e11cdea656bc158c5b1 (diff) |
Make the location of JS and CSS assets configurable
There is a mix of things loaded off CDNs and things loaded from the
local media directory, which is, ahem, inconsistent. This first step
makes the assets a configurable set that can be overridden in
local_settings.py. It does not at this point change any assets, so the
result remains inconsistent, but that will happen in a future update.
Reviewed by Daniel Gustafsson, along with the associated smaller commits
Diffstat (limited to 'postgresqleu/settings.py')
-rw-r--r-- | postgresqleu/settings.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/postgresqleu/settings.py b/postgresqleu/settings.py index 8ddeb88b..cf27eebc 100644 --- a/postgresqleu/settings.py +++ b/postgresqleu/settings.py @@ -123,6 +123,52 @@ INSTALLED_APPS = [ # Root directory for DejaVu truetype fonts FONTROOT = "/usr/share/fonts/truetype/ttf-dejavu" +# Locations of static assets +ASSETS = { + # Bootstrap 4 is used for the public default site, the default conference site, + # and in the shipment system frontend + "bootstrap4": { + "css": {"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css": "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"}, + "js": {"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js": "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"}, + }, + + # Bootstrap 3 is used in the backend + "bootstrap3": { + "css": "/media/css/bootstrap.min.css", + "js": "/media/js/bootstrap.min.js", + }, + + # JQuery 1.9 is used in the backend and in the twitter and scanning frontends + "jquery1": { + "js": "/media/jq/jquery-1.9.1.min.js", + }, + + # JQuery 3 is used on the default main site + "jquery3": { + "js": {"https://code.jquery.com/jquery-3.2.1.slim.min.js": "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"}, + }, + + # JQuery-ui is used in admin overrides and conference reports + "jqueryui1": { + "css": "/media/jq/jquery-ui.min.css", + "js": "/media/jq/jquery-ui.min.js", + }, + + "fontawesome4": { + "css": "/media/css/font-awesome.css", + }, + + "selectize": { + "css": [ + "/media/css/selectize.css", + "/media/css/selectize.default.css", + ], + "js": "/media/js/selectize.min.js", + }, +} + +ASSETS_OVERRIDE = {} + # List of IP addresses (v4 and v6) that is allowed to access monitoring urls MONITOR_SERVER_IPS = [] @@ -298,6 +344,8 @@ if 'INVOICE_NOTIFICATION_RECEIVER' not in globals(): if 'SCHEDULED_JOBS_EMAIL_SENDER' not in globals(): SCHEDULED_JOBS_EMAIL_SENDER = SCHEDULED_JOBS_EMAIL +ASSETS.update(ASSETS_OVERRIDE) + # NOTE! Turning on the debug toolbar *breaks* manual queries for conferences due to how the # timezones are handled. Access through the django ORM still works. if DEBUG and DEBUG_TOOLBAR: |