Refactoring things and doing stuff in a MVP way. #15

Merged
valberg merged 23 commits from vidir_refactor into master 2021-03-12 16:20:53 +00:00
8 changed files with 74 additions and 15 deletions
Showing only changes of commit 85e2fd76c0 - Show all commits

View file

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

View file

@ -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>

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
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)),

View file

@ -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
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