Fix some stuff before merging.

This commit is contained in:
Víðir Valberg Guðmundsson 2024-01-13 21:05:16 +01:00
parent 4b78d27bce
commit 6940e2558d
7 changed files with 52 additions and 10 deletions

View File

@ -7,6 +7,7 @@
{% block content %}
<div class="content-view">
<h1>
{{ member.username }}
</h1>
@ -39,5 +40,6 @@
{% else %}
{% trans "No memberships" %}
{% endif %}
</div>
{% endblock %}

View File

@ -70,6 +70,7 @@ def members_admin_detail(request, member_id):
context = {
"member": member,
"subscription_periods": subscription_periods,
"base_path": "admin-members",
}
return render(

View File

@ -8,29 +8,38 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<title>{% block head_title %}{% endblock %} {{ site.name }}</title>
<link rel="stylesheet" href="{% static "/fonts/inter.css" %}">
<link rel="stylesheet" href="{% static "/css/style.css" %}">
<link rel="stylesheet" href="{% static "fonts/inter.css" %}">
<link rel="stylesheet" href="{% static "css/style.css" %}">
</head>
<body>
<header>
<h1> data.coop membersystem </h1>
<a class="logout" href="{% url "account_logout" %}">Log out</a>
</header
</header>
<main>
<aside>
<div>
<figure></figure>
<h2>{{ user }}</h2>
{% if current_membership %}
<dl>
<dt>Membership</dt>
<dd>{% if current_membership %} Active {% endif %}</dd>
<dd>
Active
</dd>
<dt>Period</dt>
<dd>{% if current_membership %} Until {{ current_period.upper }} <span class="time_remaining">({{ current_period.upper|timeuntil }})</span>{% endif %}</dd>
<dd>
Until {{ current_period.upper }} <span class="time_remaining">({{ current_period.upper|timeuntil }})</span>
</dd>
<dt>Membership type</dt>
<dd>Normal member</dd>
</dl>
{% else %}
Your membership status will be displayed here in the future.
{% endif %}
</div>
</aside>
<nav>
@ -41,11 +50,13 @@
</a>
</li>
{% comment %}
<li>
<a href="/services" class="{% active_path "services" "current" %}">
Services
</a>
</li>
{% endcomment %}
<li>
<a href="{% url "account_email" %}" class="{% active_path "account_email" "current" %}">

View File

@ -7,11 +7,22 @@
{% block content %}
<div class="content-view">
<h2>Welcome {{ user }}!</h2>
<p>
This is the new member area.
</p>
<p>
It is very much under construction.
</p>
{% comment %}
<hr>
<br>
<div class="infobox">
<p>
To get you started we need to verify your email!
To get started we need you to verify your email!
</p>
<button>Verify email</button>
</div>
{% endcomment %}
</div>
{% endblock %}

View File

@ -1,6 +1,12 @@
{% extends "base.html" %}
{% block content %}
<div class="content-view">
Coming soon!
</div>
{% comment %}
<div class="content-view">
<h2>Services you subscribe to</h2>
<div class="services">
@ -52,4 +58,5 @@
</div>
</div>
</div>
{% endcomment %}
{% endblock %}

View File

@ -7,6 +7,8 @@
{% block content %}
<div class="content-view">
<h1>
{{ entity_name_plural|capfirst }} <small class="text-muted">{{ total_count }}</small>
</h1>
@ -48,7 +50,6 @@
</table>
{% if is_paginated %}
<nav>
<ul class="pagination justify-content-center">
{% if not page.has_previous %}
@ -101,8 +102,9 @@
{% endif %}
</ul>
</nav>
{% endif %}
</div>
{% endblock %}

View File

@ -5,9 +5,17 @@ register = template.Library()
@register.simple_tag(takes_context=True)
def active_path(context, path_name, class_name):
def active_path(context, path_name, class_name) -> str | None:
"""Return the given class name if the current path matches the given path name."""
path = reverse(path_name)
request_path = context.get("request").path
if path == request_path or ("basepath" in context and context["basepath"] == path):
# Check if the current path matches the given path name.
is_path = path == request_path
# Check if the current path is a sub-path of the given path name.
is_base_path = "base_path" in context and reverse(context["base_path"]) == path
if is_path or is_base_path:
return class_name