Sortable table and dashboard_view styling

This commit is contained in:
Neil Martinsen-Burrell 2023-01-27 11:51:30 -06:00
parent 5dd4da2d5f
commit 69533a2f80
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
4 changed files with 31 additions and 8 deletions

View file

@ -130,7 +130,7 @@ section.dashboard {
}
}
#wrapper {
#wrapper.dashboard {
background-color: color('primary-lightest');
}

View file

@ -128,11 +128,13 @@
<div class="usa-navbar">
{% block logo %}
<div class="usa-logo" id="extended-logo">
<a href="{% url 'home' %}">
<img
src="{% static 'img/dottedgov-round.svg' %}"
alt="Home"
width="48px"
/>
</a>
</div>
{% endblock %}
<button type="button" class="usa-menu-btn">Menu</button>
@ -162,7 +164,7 @@
</div>
</header>
{% endblock banner %}
<div id="wrapper">
<div id="wrapper" {% if dashboard_view %}class="dashboard"{% endif %}>
{% block messages %}
{% if messages %}
<ul class="messages">

View file

@ -1,5 +1,7 @@
{% extends 'base.html' %}
{% load static %}
{% block title %} Hello {% endblock %}
{% block content %}
@ -30,19 +32,36 @@
<caption class="sr-only">Your domain applications</caption>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th data-sortable scope="col" role="columnheader">Domain name</th>
<th data-sortable scope="col" role="columnheader">Date created</th>
<th data-sortable scope="col" role="columnheader">Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for application in domain_applications %}
<tr>
<th>
<a href="{% url 'edit-application' application.pk %}">
<th th scope="row" role="rowheader">
{{ application.requested_domain.name|default:"New domain request" }}
</a>
</th>
<td>{{ application.status }}</td>
<td data-sort-value="{{ application.created_at|date:"U" }}">{{ application.created_at|date }}</td>
<td>{{ application.status|title }}</td>
<td>
<a href="{% url 'edit-application' application.pk %}">
{% if application.status == "started" %}
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img">
<use xlink:href="{%static 'img/sprite.svg'%}#edit"></use>
</svg>
Edit
{% else %}
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img">
<use xlink:href="{%static 'img/sprite.svg'%}#settings"></use>
</svg>
Manage
{% endif %}
</a>
</td>
</tr>
{% endfor %}
</tbody>

View file

@ -7,6 +7,8 @@ def index(request):
"""This page is available to anyone without logging in."""
context = {}
if request.user.is_authenticated:
# the logged-in index view IS the dashboard
context["dashboard_view"] = True
applications = DomainApplication.objects.filter(creator=request.user)
context["domain_applications"] = applications
return render(request, "home.html", context)