Replace ModelAdmin history header human readable date

- Snippet header with history appears to be unused, updated anyway
- Update ModelAdmin header with history to use the human readable (more accessible) timesince date, which uses Tippy.js
- Relates to #8565
- Builds on #8697 & #8566
pull/10598/head
LB Johnston 2023-06-28 08:36:26 +10:00 zatwierdzone przez Thibaud Colas
rodzic 7962118dc0
commit 58377402bf
4 zmienionych plików z 21 dodań i 8 usunięć

Wyświetl plik

@ -244,6 +244,25 @@ This will be different to the previous ordering which never intentionally implem
This default ordering is now `["content_type__app_label", "content_type__model", "codename"]`, which can now be customised [](customising_group_views_permissions_order).
### Shared include `wagtailadmin/shared/last_updated.html` is no longer available
The undocumented shared include `wagtailadmin/shared/last_updated.html` is no longer available as it used the legacy Bootstrap tooltips and was not accessible. If you need to achieve a similar output, an element that shows a simple date with a tooltip for the full date, use the `human_readable_date` template tag instead.
**Before**
```html+django
{% include "wagtailadmin/shared/last_updated.html" with last_updated=my_model.timestamp %}
```
**After**
```html+django
{% load wagtailadmin_tags %}
<!-- ... -->
{% human_readable_date my_model.timestamp %}
```
### Tag (Tagit) field usage now relies on data attributes
The `AdminTagWidget` widget has now been migrated to a Stimulus controller, if using this widget in Python, no changes are needed to adopt the new approach.

Wyświetl plik

@ -1,6 +0,0 @@
{% load i18n wagtailadmin_tags %}
{% if last_updated %}
<span title="{{ last_updated }}" data-wagtail-tooltip="{{ last_updated }}" {% if classname %}class="{{ classname }}"{% endif %}>
{% if since_text %}{{ since_text }}{% endif %} {% timesince_last_update last_updated show_time_prefix=show_time_prefix %}
</span>
{% endif %}

Wyświetl plik

@ -8,7 +8,7 @@
<li>
{% avatar user=latest_log_entry.user size="small" tooltip=latest_log_entry.user_display_name %}
{% trans "Last updated" %}
{% include "wagtailadmin/shared/last_updated.html" with last_updated=latest_log_entry.timestamp show_time_prefix=True %}
{% human_readable_date latest_log_entry.timestamp %}
</li>
{% if history_url %}
<li><a href="{{ history_url }}">{% icon "history" classname="default" %} {% trans "History" %}</a></li>

Wyświetl plik

@ -8,7 +8,7 @@
<li>
{% avatar user=latest_log_entry.user size="small" tooltip=latest_log_entry.user_display_name %}
{% trans "Last updated" %}
{% include "wagtailadmin/shared/last_updated.html" with last_updated=latest_log_entry.timestamp show_time_prefix=True %}
{% human_readable_date date=latest_log_entry.timestamp %}
</li>
{% if history_url %}
<li><a href="{{ history_url }}">{% icon "history" classname="default" %} {% trans "History" %}</a></li>