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

View file

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

View file

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

View file

@ -7,11 +7,22 @@
{% block content %} {% block content %}
<div class="content-view"> <div class="content-view">
<h2>Welcome {{ user }}!</h2> <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"> <div class="infobox">
<p> <p>
To get you started we need to verify your email! To get started we need you to verify your email!
</p> </p>
<button>Verify email</button> <button>Verify email</button>
</div> </div>
{% endcomment %}
</div> </div>
{% endblock %} {% endblock %}

View file

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

View file

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

View file

@ -5,9 +5,17 @@ register = template.Library()
@register.simple_tag(takes_context=True) @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) path = reverse(path_name)
request_path = context.get("request").path 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 return class_name