Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a simple user settings page #190

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/argus_htmx/templates/htmx/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
</li>
<li>{% include "htmx/themes/theme_dropdown.html" %}</li>
<li>{% include "htmx/dateformat/_dateformat_dropdown.html" %}</li>
<li>
<a href="{% url 'htmx:user-settings' %}">Settings…</a>
</li>
<li>
<form class="flex" action="{% url "htmx:logout" %}" method="post">
{% csrf_token %}
Expand Down
15 changes: 15 additions & 0 deletions src/argus_htmx/templates/htmx/user/settings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends "htmx/base.html" %}
{% block main %}
<h1 class="sr-only">{{ page_title }}</h1>
<section id="user-settings" class="card">
<h2 class="card-title">User settings</h2>
<ul class="menu card-body">
<li class="menu-title">
Logged in as: <span class="text-info">{{ request.user }}</span>
<div class="divider divider-secondary my-0"></div>
</li>
<li>{% include "htmx/themes/theme_dropdown.html" %}</li>
<li>{% include "htmx/dateformat/_dateformat_dropdown.html" %}</li>
</ul>
</section>
{% endblock main %}
2 changes: 2 additions & 0 deletions src/argus_htmx/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .destinations.urls import urlpatterns as destination_urls
from .themes.urls import urlpatterns as theme_urls
from .dateformat.urls import urlpatterns as dateformat_urls
from .user.urls import urlpatterns as user_urls

app_name = "htmx"
urlpatterns = [
Expand All @@ -20,4 +21,5 @@
path("destinations/", include(destination_urls)),
path("themes/", include(theme_urls)),
path("dateformat/", include(dateformat_urls)),
path("user/", include(user_urls)),
]
1 change: 1 addition & 0 deletions src/argus_htmx/user/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""User settings pages"""
9 changes: 9 additions & 0 deletions src/argus_htmx/user/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.urls import path

from . import views


app_name = "htmx"
urlpatterns = [
path("", views.user_settings, name="user-settings"),
]
7 changes: 7 additions & 0 deletions src/argus_htmx/user/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.shortcuts import render


def user_settings(request):
"""Renders the main settings page for a user"""
context = {"page_title": "User settings"}
return render(request, "htmx/user/settings.html", context=context)
Loading