human_readable_date - update template tag to support tooltip position

pull/10887/head
rohitsrma 2023-09-11 12:02:14 +00:00 zatwierdzone przez LB (Ben Johnston)
rodzic 3a86efaf12
commit 0a977cc54d
5 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -45,6 +45,7 @@ Changelog
* Maintenance: Migrate form submission listing checkbox toggling to the shared `w-bulk` Stimulus implementation (LB (Ben) Johnston)
* Maintenance: Allow viewsets to define a common set of view kwargs (Matt Westcott)
* Maintenance: Migrate the editor unsaved messages popup to be driven by Stimulus using the shared `w-message` controller (LB (Ben) Johnston, Hussain Saherwala)
* Maintenance: Add support for tooltip position in `human_readable_date` tooltip (Rohit Sharma)
5.1.2 (xx.xx.20xx) - IN DEVELOPMENT

Wyświetl plik

@ -730,6 +730,7 @@
* Hatim Makki Hoho
* Hussain Saherwala
* Faishal Manzar
* Rohit Sharma
## Translators

Wyświetl plik

@ -64,6 +64,7 @@ depth: 1
* Migrate form submission listing checkbox toggling to the shared `w-bulk` Stimulus implementation (LB (Ben) Johnston)
* Allow viewsets to define a common set of view kwargs (Matt Westcott)
* Migrate the editor unsaved messages popup to be driven by Stimulus using the shared `w-message` controller (LB (Ben) Johnston, Hussain Saherwala)
* Add support for tooltip position in `human_readable_date` tooltip (Rohit Sharma)
## Upgrade considerations - changes affecting all projects

Wyświetl plik

@ -1,6 +1,6 @@
{% load wagtailadmin_tags i18n %}
<button type="button" class="w-human-readable-date" data-tippy-content="{{ date|date:"DATETIME_FORMAT" }}">
<button type="button" class="w-human-readable-date" data-tippy-content="{{ date|date:"DATETIME_FORMAT" }}" data-tippy-placement="{{ position }}">
<time class="w-human-readable-date__date" datetime="{{ date|date:"c" }}">
{{ date|timesince_simple|capfirst }}
</time>

Wyświetl plik

@ -1196,8 +1196,9 @@ def workflow_status_with_date(workflow_state):
@register.inclusion_tag("wagtailadmin/shared/human_readable_date.html")
def human_readable_date(date, description=None):
def human_readable_date(date, description=None, position="top"):
return {
"date": date,
"description": description,
"position": position,
}