diff --git a/django/.pa11yci b/django/.pa11yci index 4dc6cc0..5dd1407 100644 --- a/django/.pa11yci +++ b/django/.pa11yci @@ -6,6 +6,13 @@ } }, "urls": [ + "http://127.0.0.1:8000/", + { + "url": "http://127.0.0.1:8000/", + "actions": [ + "click element #cookie-message-popup-accept" + ] + }, "http://127.0.0.1:8000/cookies/" ] } diff --git a/django/core/local_settings.example.py b/django/core/local_settings.example.py index 2143154..7ce00e9 100644 --- a/django/core/local_settings.example.py +++ b/django/core/local_settings.example.py @@ -16,6 +16,9 @@ # Set to True if in development, or False is in production DEBUG = True/False +# Used by Django Debug Toolbar (comment out to disable DDT) +INTERNAL_IPS = ["127.0.0.1"] if DEBUG else [] + # Set to ['*'] if in development, or specific IP addresses and domains if in production ALLOWED_HOSTS = ['*']/['cristero-war.bham.ac.uk'] diff --git a/django/core/local_settings.test.py b/django/core/local_settings.test.py index 0f6f1f2..74e3390 100644 --- a/django/core/local_settings.test.py +++ b/django/core/local_settings.test.py @@ -13,6 +13,9 @@ DEBUG = True +# Used by Django Debug Toolbar (comment out to disable DDT) +# INTERNAL_IPS = ["127.0.0.1"] if DEBUG else [] + ALLOWED_HOSTS = ['*'] ADMIN_EMAIL = 'bear-rsg@contacts.bham.ac.uk' diff --git a/django/core/settings.py b/django/core/settings.py index 67880e7..662ec75 100644 --- a/django/core/settings.py +++ b/django/core/settings.py @@ -18,12 +18,18 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', + # 3rd Party + 'debug_toolbar', + 'ckeditor', + 'ckeditor_uploader', # Custom apps 'account', 'general', + 'pages' ] MIDDLEWARE = [ + 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -117,6 +123,79 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +# CKEditor +# Image File uploads via CKEditor +CKEDITOR_UPLOAD_PATH = 'cke_uploads/' # will be based within MEDIA dir +CKEDITOR_ALLOW_NONIMAGE_FILES = False # only allow images to be uploaded +CKEDITOR_IMAGE_BACKEND = 'ckeditor_uploader.backends.PillowBackend' +CKEDITOR_THUMBNAIL_SIZE = (100, 100) +CKEDITOR_FORCE_JPEG_COMPRESSION = True +CKEDITOR_IMAGE_QUALITY = 90 +SILENCED_SYSTEM_CHECKS = ["ckeditor.W001"] +# Configuration +# For full list of configurations, see: https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html +# For full list of toolbar buttons, see: https://ckeditor.com/latest/samples/toolbarconfigurator/index.html#advanced +CKEDITOR_CONFIGS = { + 'default': { + 'toolbar': [ + { + 'name': 'views', + 'items': ['Maximize', 'Source'] + }, + { + 'name': 'styles', + 'items': ['Format', '-', 'TextColor', 'BGColor', 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'RemoveFormat'] + }, + { + 'name': 'clipboard', + 'items': ['Cut', 'Copy', '-', 'Undo', 'Redo'] + }, + { + 'name': 'paragraph', + 'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'] + }, + { + 'name': 'links', + 'items': ['Link', 'Unlink', 'Anchor'] + }, + { + 'name': 'insert', + 'items': ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] + }, + { + 'name': 'editing', + 'items': ['Find', '-', 'Scayt'] + }, + ], + 'format_tags': 'h2;h3;h4;h5;p', + 'tabSpaces': 4, + 'height': '80vh', + 'width': '100%', + 'allowedContent': True, + 'entities_greek': False, + 'entities_latin': False, + 'scayt_autoStartup': True, + 'scayt_sLang': 'en_GB', + 'uiColor': '#FFFFFF', + 'language': 'en', + 'defaultLanguage': 'en', + 'editorplaceholder': 'Create the content of this page...', + 'removePlugins': ','.join([ + 'language', + 'elementspath', + ]), + 'versionCheck': False, + 'contentsCss': [ + '/static/css/reset.css', + '/static/css/custom.css', + '/static/css/custom_small.css', + '/static/css/custom_large.css', + '/static/css/custom_ckeditor.css', + ], + } +} + + # Import local_settings.py SECRET_KEY = None try: diff --git a/django/core/static/css/custom.css b/django/core/static/css/custom.css index 9cfdf20..21ea35a 100755 --- a/django/core/static/css/custom.css +++ b/django/core/static/css/custom.css @@ -2,19 +2,20 @@ /* ---------- General ---------- */ html, body { - font-family: 'Inter', 'Helvetica', sans-serif; - background: #101010; - color: #EEE; - margin: 0; - font-weight: 300; - - /* Variables */ + /* Color Variables */ --color-primary: #f36112; --color-primary-dark: #b03f02; --color-primary-light: #ff975f; + --color-black: #101010; --color-red: #c23616; --color-green: #27ae60; --color-purple: #8e44ad; + + font-family: 'Inter', 'Helvetica', sans-serif; + background: var(--color-black); + color: #EEE; + margin: 0; + font-weight: 300; } .display-small, @@ -402,7 +403,7 @@ main section { #welcome-banner { color: white; - background-color: var(--color-primary); + background-color: var(--color-black); background-size: 2em 2em; background-image: url('../images/welcome-banner-bg.jpg'); position: relative; @@ -414,7 +415,9 @@ main section { width: fit-content; } -#welcome-banner-content-title { +#welcome-banner-content-title, +#welcome-banner-content-tagline { + background: var(--color-black); line-height: 1em; } @@ -424,7 +427,7 @@ main section { #welcome-banner-content-links a { border-radius: 2em; - background-color: white; + background-color: var(--color-black); color: var(--color-primary); padding: 0.6em 1.3em; width: fit-content; @@ -465,6 +468,62 @@ main section { color: var(--color-primary); } +/* ---------- Pages ---------- */ + +#pages-editinadmin { + position: fixed; + bottom: 1rem; + right: 1rem; + padding: 0.8em; + background: var(--color-primary); + color: black; + font-weight: 600; + font-size: 1.1em; + border-radius: 0.5em; +} + +#pages-editinadmin:hover { + text-decoration: none; + background: var(--color-primary-dark); + color: black; +} + +#pages-editinadmin i { + margin-right: 0.4em; +} + +#pages-mediaviewer { + position: fixed; + bottom: -61vh; + left: 50%; + width: 0; + min-height: 5em; + max-height: 60vh; + background: var(--color-primary); + border-radius: 1em; + transition: all 0.4s ease; + overflow: auto; +} + +#pages-mediaviewer video { + max-width: 80%; + display: block; + margin: 0 auto 2em auto; +} + +#pages-mediaviewer audio { + display: block; + margin: 0 auto 2em auto; +} + +.pages-mediaviewer-close { + color: white; + font-size: 1.5em; + margin: 0.5em; + cursor: pointer; + width: fit-content; +} + /* ---------- Footer ---------- */ footer { diff --git a/django/core/templates/base.html b/django/core/templates/base.html index 5b03957..ac69cc5 100644 --- a/django/core/templates/base.html +++ b/django/core/templates/base.html @@ -1,4 +1,5 @@ {% load static settings_value i18n %} +{% get_current_language as LANGUAGE_CODE %} @@ -43,7 +44,7 @@