Fix sidebar

It is not entirely fixed, but it's at least generated from django data
now. Should make it fairly easier to make it behave better.
This commit is contained in:
Marcel Plch 2024-11-30 01:50:45 +01:00
parent 3455ffa89f
commit 8752197c2c
Signed by: dormouse
GPG key ID: 2CA77596BC4BDFFE
2 changed files with 38 additions and 24 deletions

View file

@ -22,23 +22,14 @@
<body onload="init()"> <body onload="init()">
{# NAVBAR #} {# NAVBAR #}
<section class="navbar" id="nav"> <section class="navbar" id="nav">
{% for path in paths %}
<a href="/"> <a href="{{ path.href }}">
<div class="navbar-block"> <div class="navbar-block">
Home {{ path.name }}
</div> </div>
</a> </a>
{% endfor %}
<a href="/curriculum-vitae">
<div class="navbar-block">
Curriculum Vitae
</div>
<a href="/ukraine">
<div class="navbar-block">
<img src="{% static "base_app/img/ukraine.png" %}" width="16" style="display:inline">
Ukraine
</div>
</a>
<div class="navbar-button" <div class="navbar-button"
onclick="navbar_click()" onclick="navbar_click()"
> >

View file

@ -16,25 +16,48 @@ def get_domains():
# Create your views here. # Create your views here.
class IndexView(TemplateView):
class GenericView(TemplateView):
def cx_handle_get(self, request, template, *args, **kwargs):
paths = [
{"href": "/",
"name": "Home"},
{"href": "/curriculum-vitae",
"name": "Curriculum Vitae"},
{"href": "/ukraine",
"name": "Ukraine"},
]
return render(request, template, {"paths" : paths})
class IndexView(GenericView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
return render(request, "index.html", {}) paths = [
{"href": "/",
"name": "Home"},
{"href": "/curriculum-vitae",
"name": "Curriculum Vitae"},
{"href": "/ukraine",
"name": "Ukraine"},
class CVView(TemplateView): ]
return self.cx_handle_get(request, "index.html", {"paths" : paths})
class CVView(GenericView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
return render(request, "CV.html", {}) return self.cx_handle_get(request, "CV.html", {})
class LoremView(TemplateView): class LoremView(GenericView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
return render(request, "lorem.html", {}) return self.cx_handle_get(request, "lorem.html", {})
class UkraineView(TemplateView): class UkraineView(GenericView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
domains = get_domains() domains = get_domains()
return render(request, "ukraine.html", {"domains" : domains}) return self.cx_handle_get(request, "ukraine.html", {"domains" : domains})