Teak table design and sorting

This commit is contained in:
Rachid Mrad 2024-04-25 18:44:00 -04:00
parent 87e8310c6d
commit 8a8a6491f9
No known key found for this signature in database
3 changed files with 29 additions and 7 deletions

View file

@ -112,12 +112,20 @@ html[data-theme="light"] {
.change-list .usa-table--borderless thead th, .change-list .usa-table--borderless thead th,
.change-list .usa-table thead td, .change-list .usa-table thead td,
.change-list .usa-table thead th, .change-list .usa-table thead th,
.change-form .usa-table,
.change-form .usa-table--striped tbody tr:nth-child(odd) td,
.change-form .usa-table--borderless thead th,
.change-form .usa-table thead td,
.change-form .usa-table thead th,
body.dashboard, body.dashboard,
body.change-list, body.change-list,
body.change-form, body.change-form,
.analytics { .analytics {
color: var(--body-fg); color: var(--body-fg);
} }
.usa-table td {
background-color: transparent;
}
} }
// Firefox needs this to be specifically set // Firefox needs this to be specifically set
@ -127,11 +135,20 @@ html[data-theme="dark"] {
.change-list .usa-table--borderless thead th, .change-list .usa-table--borderless thead th,
.change-list .usa-table thead td, .change-list .usa-table thead td,
.change-list .usa-table thead th, .change-list .usa-table thead th,
.change-form .usa-table,
.change-form .usa-table--striped tbody tr:nth-child(odd) td,
.change-form .usa-table--borderless thead th,
.change-form .usa-table thead td,
.change-form .usa-table thead th,
body.dashboard, body.dashboard,
body.change-list, body.change-list,
body.change-form { body.change-form,
.analytics {
color: var(--body-fg); color: var(--body-fg);
} }
.usa-table td {
background-color: transparent;
}
} }
#branding h1 a:link, #branding h1 a:visited { #branding h1 a:link, #branding h1 a:visited {

View file

@ -1,5 +1,6 @@
{% extends "admin/fieldset.html" %} {% extends "admin/fieldset.html" %}
{% load static url_helpers %} {% load static url_helpers %}
{% load custom_filters %}
{% comment %} {% comment %}
This is using a custom implementation fieldset.html (see admin/fieldset.html) This is using a custom implementation fieldset.html (see admin/fieldset.html)
@ -80,18 +81,16 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
<table class="usa-table usa-table--borderless"> <table class="usa-table usa-table--borderless">
<thead> <thead>
<tr> <tr>
<th data-sortable scope="col" role="columnheader">From</th> <th>Status</th>
<th data-sortable scope="col" role="columnheader">To</th> <th>User</th>
<th data-sortable scope="col" role="columnheader">Changed By</th> <th>Changed at</th>
<th data-sortable scope="col" role="columnheader" aria-sort="ascending">Change Date</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for log_entry in original_object.history.all %} {% for log_entry in original_object.history.all|reverse_list %}
{% for key, value in log_entry.changes_display_dict.items %} {% for key, value in log_entry.changes_display_dict.items %}
{% if key == "status" %} {% if key == "status" %}
<tr> <tr>
<td>{{ value.0|default:"None" }}</td>
<td>{{ value.1|default:"None" }}</td> <td>{{ value.1|default:"None" }}</td>
<td>{{ log_entry.actor|default:"None" }}</td> <td>{{ log_entry.actor|default:"None" }}</td>
<td>{{ log_entry.timestamp|default:"None" }}</td> <td>{{ log_entry.timestamp|default:"None" }}</td>

View file

@ -67,3 +67,9 @@ def get_organization_long_name(generic_org_type):
@register.filter(name="has_permission") @register.filter(name="has_permission")
def has_permission(user, permission): def has_permission(user, permission):
return user.has_perm(permission) return user.has_perm(permission)
@register.filter(name='reverse_list')
def reverse_list(value):
return reversed(value)