Refactoring things and doing stuff in a MVP way. #15
|
@ -28,6 +28,7 @@ INSTALLED_APPS = [
|
||||||
"debug_toolbar",
|
"debug_toolbar",
|
||||||
"allauth",
|
"allauth",
|
||||||
"allauth.account",
|
"allauth.account",
|
||||||
|
"utils",
|
||||||
"accounting",
|
"accounting",
|
||||||
"membership",
|
"membership",
|
||||||
]
|
]
|
||||||
|
|
|
@ -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>
|
||||||
|
|
10
src/project/templates/services_overview.html
Normal file
10
src/project/templates/services_overview.html
Normal 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 %}
|
|
@ -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)),
|
||||||
|
|
|
@ -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
0
src/utils/__init__.py
Normal file
0
src/utils/templatetags/__init__.py
Normal file
0
src/utils/templatetags/__init__.py
Normal file
13
src/utils/templatetags/utils.py
Normal file
13
src/utils/templatetags/utils.py
Normal 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
|
Loading…
Reference in a new issue