Skip to content

Commit

Permalink
Merge pull request #3 from bear-rsg/dev
Browse files Browse the repository at this point in the history
Week 3-5
  • Loading branch information
mike-allaway authored Mar 8, 2024
2 parents a930400 + ca75bf3 commit 58b3129
Show file tree
Hide file tree
Showing 21 changed files with 885 additions and 23 deletions.
7 changes: 7 additions & 0 deletions django/.pa11yci
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
]
}
3 changes: 3 additions & 0 deletions django/core/local_settings.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
3 changes: 3 additions & 0 deletions django/core/local_settings.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]'
Expand Down
79 changes: 79 additions & 0 deletions django/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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:
Expand Down
79 changes: 69 additions & 10 deletions django/core/static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
15 changes: 8 additions & 7 deletions django/core/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load static settings_value i18n %}
{% get_current_language as LANGUAGE_CODE %}

<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -43,7 +44,7 @@
<!-- Navigation bar -->
<nav class="navbar fixed-top navbar-expand-lg">

<a class="navbar-brand{% if request.path == "/" or request.path == '/en/' %} xhidden{% endif %}" href="#">
<a class="navbar-brand{% if request.path == "/" or request.path == '/en/' %} xhidden{% endif %}" href="/{{ LANGUAGE_CODE }}/">
<h1>{% translate 'ProjectTitle' %}</h1>
</a>

Expand All @@ -56,31 +57,31 @@ <h1>{% translate 'ProjectTitle' %}</h1>
<ul class="navbar-nav ml-auto">
<!-- Welcome -->
<li class="nav-item">
<a class="nav-link{% if request.path == "/" or request.path == '/en/' %} active{% endif %}" href="#">
<a class="nav-link{% if request.path == "/{{ LANGUAGE_CODE }}/" %} active{% endif %}" href="/{{ LANGUAGE_CODE }}/">
{% translate 'Welcome' %}
</a>
</li>
<!-- Photographs -->
<li class="nav-item">
<a class="nav-link{% if "/photographs/" in request.path %} active{% endif %}" href="#">
<a class="nav-link{% if "/{{ LANGUAGE_CODE }}/photographs/" in request.path %} active{% endif %}" href="#">
{% translate 'Photographs' %}
</a>
</li>
<!-- About -->
<li class="nav-item">
<a class="nav-link{% if request.path == "/about/" %} active{% endif %}" href="#">
<a class="nav-link{% if request.path == "/{{ LANGUAGE_CODE }}/about/" %} active{% endif %}" href="/{{ LANGUAGE_CODE }}/about/">
{% translate 'About' %}
</a>
</li>
<!-- Updates -->
<li class="nav-item">
<a class="nav-link{% if request.path == "/projectupdates/" %} active{% endif %}" href="#">
<a class="nav-link{% if request.path == "/{{ LANGUAGE_CODE }}/updates/" %} active{% endif %}" href="/{{ LANGUAGE_CODE }}/updates/">
{% translate 'Updates' %}
</a>
</li>
<!-- Get Involved -->
<li class="nav-item">
<a class="nav-link{% if request.path == "/getinvolved/" %} active{% endif %}" href="#">
<a class="nav-link{% if request.path == "/{{ LANGUAGE_CODE }}/get-involved/" %} active{% endif %}" href="/{{ LANGUAGE_CODE }}/get-involved/">
{% translate 'Get Involved' %}
</a>
</li>
Expand Down Expand Up @@ -108,7 +109,7 @@ <h1>{% translate 'ProjectTitle' %}</h1>
<a href="https://www.birmingham.ac.uk/university/governance/policies-regs/information/index.aspx" target="_blank">{% translate 'Freedom of Information' %}</a> |
<a href="{% url 'general:cookies' %}">{% translate 'Cookies' %}</a> |
<a href="https://accessibility.bear.bham.ac.uk/statements-cal.html" target="_blank">{% translate 'Accessibility' %}</a>
</p>
</p>
<p>
© University of Birmingham {% now "Y" %}
</p>
Expand Down
16 changes: 10 additions & 6 deletions django/core/urls.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf.urls.i18n import i18n_patterns
from django.conf import settings

urlpatterns = i18n_patterns(

# General app's urls
# General app
path('', include('general.urls')),

# Don't show the default language in the URL
prefix_default_language=False

# CKEditor file uploads
path('ckeditor/', include('ckeditor_uploader.urls')),
# Django admin
path('dashboard/', admin.site.urls),
# Debug Toolbar
path('__debug__/', include('debug_toolbar.urls')),
# Pages urls (must appear at bottom)
path('', include('pages.urls')),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Empty file added django/pages/__init__.py
Empty file.
Loading

0 comments on commit 58b3129

Please sign in to comment.