Some template work.

This commit is contained in:
Víðir Valberg Guðmundsson 2021-02-28 12:41:10 +01:00
parent aac3de1bb3
commit 85e2fd76c0
8 changed files with 74 additions and 15 deletions

View file

@ -28,6 +28,7 @@ INSTALLED_APPS = [
"debug_toolbar", "debug_toolbar",
"allauth", "allauth",
"allauth.account", "allauth.account",
"utils",
"accounting", "accounting",
"membership", "membership",
] ]

View file

@ -1,3 +1,4 @@
{% load utils %}
{% load i18n %} {% load i18n %}
{% load static %} {% load static %}
<!doctype html> <!doctype html>
@ -134,23 +135,52 @@
<div class="position-sticky pt-3"> <div class="position-sticky pt-3">
<ul class="nav flex-column"> <ul class="nav flex-column">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" aria-current="page" href="#"> <a class="nav-link {% active_path "index" "active" %}"
href="{% url "index" %}">
{% trans "Dashboard" %}
</a>
</li>
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<span>{% trans "Profile" %}</span>
</h6>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="#">
{% trans "Details" %}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% active_path "account_email" "active" %}"
aria-current="page" href="{% url "account_email" %}">
{% trans "Emails" %}
</a>
</li>
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<span>{% trans "Membership" %}</span>
</h6>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="#">
{% trans "Overview" %} {% trans "Overview" %}
</a> </a>
</li> </li>
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<span>{% trans "Services" %}</span>
</h6>
<ul class="nav flex-column">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link {% active_path "services-overview" "active" %}"
{% trans "Profile" %} href="{% url "services-overview" %}">
</a> {% trans "Overview" %}
</li>
<li class="nav-item">
<a class="nav-link" href="#">
{% trans "Membership" %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
{% trans "Services" %}
</a> </a>
</li> </li>
</ul> </ul>

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block content %}
<p>
Services and signup to these will be
</p>
<p>
This is yet to be implemented.
</p>
{% endblock %}

View file

@ -6,10 +6,11 @@ from django.urls import path
import debug_toolbar import debug_toolbar
from . import views from .views import index, services_overview
urlpatterns = [ urlpatterns = [
path("", login_required(views.index)), path("", login_required(index), name="index"),
path("services/", login_required(services_overview), name="services-overview"),
path('accounts/', include('allauth.urls')), path('accounts/', include('allauth.urls')),
path("admin/", admin.site.urls), path("admin/", admin.site.urls),
path("__debug__/", include(debug_toolbar.urls)), path("__debug__/", include(debug_toolbar.urls)),

View file

@ -3,3 +3,7 @@ from django.shortcuts import render
def index(request): def index(request):
return render(request, "index.html") return render(request, "index.html")
def services_overview(request):
return render(request, "services_overview.html")

0
src/utils/__init__.py Normal file
View file

View file

View file

@ -0,0 +1,13 @@
from django import template
from django.urls import reverse
register = template.Library()
@register.simple_tag(takes_context=True)
def active_path(context, path_name, class_name):
path = reverse(path_name)
request_path = context.get("request").path
if path == request_path or ("basepath" in context and context["basepath"] == path):
return class_name