Skip to content

Commit

Permalink
logos
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed Jul 24, 2023
1 parent a0ba1eb commit e666907
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 12 deletions.
11 changes: 8 additions & 3 deletions obl_microsites/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from django.contrib.staticfiles import finders

searched_locations = finders.searched_locations


def obl_microsites(request):
return {
"LOCALITY": request.obl_locality,
}
if not hasattr(request, "microsite"):
return {}
return {"MICROSITE": request.microsite}
20 changes: 12 additions & 8 deletions obl_microsites/middleware.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from django.http import Http404
from django.shortcuts import get_object_or_404

Expand All @@ -14,14 +15,17 @@ def __call__(self, request):
host = request.get_host()

if host.startswith("127.0.0.1") or host.startswith("localhost"):
# TODO: falls back to CPT for debugging
code = "cpt"
else:
if "." in host:
host = host.split(".", 1)[0]
code = {"bergrivier": "wc013"}.get(host, None)
if not code:
host = "bergrivier"
elif "." in host:
host = host.split(".", 1)[0]

microsite = settings.MICROSITES.get(host)
if not microsite:
raise Http404

request.obl_locality = get_object_or_404(Locality.objects, code=code)
if "locality" not in microsite:
microsite["locality"] = get_object_or_404(
Locality.objects, code=microsite["code"]
)
request.microsite = microsite
return self.get_response(request)
7 changes: 7 additions & 0 deletions obl_microsites/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
TEMPLATES[0]["OPTIONS"]["context_processors"].append( # noqa
"obl_microsites.context_processors.obl_microsites"
)

MICROSITES = {
"bergrivier": {
"code": "cpt",
"website": "https://www.bergmun.org.za/",
},
}
1 change: 1 addition & 0 deletions obl_microsites/static/images/openup-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions obl_microsites/templates/peachjam/_footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends 'peachjam/_footer.html' %}
{% load static %}
{% block newsletter-form %}{% endblock %}
{% block social-media %}{% endblock %}
{% block first-content-column %}
<h5>{{ MICROSITE.locality.name }} By-laws</h5>
<ul class="list-unstyled">
<li>
<a href="{% url 'home_page' %}">By-laws</a>
</li>
<li>
<a href="{{ MICROSITE.website }}">{{ MICROSITE.locality.name }} website</a>
</li>
</ul>
<img src="{% static 'images/municipalities/'|add:MICROSITE.code|add:"-logo.png" %}"
alt="{{ MICROSITE.locality.name }}"/>
{% endblock %}
{% block second-content-column %}{% endblock %}
{% block third-content-column %}
<p>
The by-laws are published through a partnership between {{ MICROSITE.locality.name }} Municipality and
<a href="https://openup.org.za">OpenUp</a>.
</p>
<img src="{% static 'images/openup-logo.svg' %}"
alt="OpenUp"
style="height: 40px"/>
{% endblock %}
{% block footer-logos %}{% endblock %}
2 changes: 1 addition & 1 deletion obl_microsites/templates/peachjam/_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{% block nav-items %}
<li class="nav-item">
<a class="nav-link"
href="{% url 'municipal_by_laws' code=LOCALITY.code %}">{{ LOCALITY.name }} By-laws</a>
href="{% url 'municipal_by_laws' code=MICROSITE.locality.code %}">{{ MICROSITE.locality.name }} By-laws</a>
</li>
{% endblock %}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e666907

Please sign in to comment.