forked from data.coop/membersystem
Some template work.
This commit is contained in:
parent
aac3de1bb3
commit
85e2fd76c0
|
@ -28,6 +28,7 @@ INSTALLED_APPS = [
|
|||
"debug_toolbar",
|
||||
"allauth",
|
||||
"allauth.account",
|
||||
"utils",
|
||||
"accounting",
|
||||
"membership",
|
||||
]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{% load utils %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
<!doctype html>
|
||||
|
@ -134,23 +135,52 @@
|
|||
<div class="position-sticky pt-3">
|
||||
<ul class="nav flex-column">
|
||||
<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" %}
|
||||
</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 "Services" %}</span>
|
||||
</h6>
|
||||
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
{% trans "Profile" %}
|
||||
</a>
|
||||
</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 class="nav-link {% active_path "services-overview" "active" %}"
|
||||
href="{% url "services-overview" %}">
|
||||
{% trans "Overview" %}
|
||||
</a>
|
||||
</li>
|
||||
</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
|
||||
|
||||
from . import views
|
||||
from .views import index, services_overview
|
||||
|
||||
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("admin/", admin.site.urls),
|
||||
path("__debug__/", include(debug_toolbar.urls)),
|
||||
|
|
|
@ -3,3 +3,7 @@ from django.shortcuts import render
|
|||
|
||||
def index(request):
|
||||
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