From bbeced68f7329ca328fcd2f3d158b8ac7610943d Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Tue, 8 Jul 2025 14:41:45 +0530 Subject: [PATCH] notifications: Add datetime to each notification - Notifications are displayed in a user-friendly "time ago" format. - Use last_update_time instead of created_time Sunil: - Some notifications don't have app name and app icon. Styling for those notification was different due to the last update time. Revert back to positioning for it. Use CSS float for it. - Use localized, locale specific date/time format for the tooltip. Signed-off-by: Joseph Nuthalapati Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/templates/notifications.html | 44 +++++++++++++++++------------ static/themes/default/css/main.css | 6 ++++ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/plinth/templates/notifications.html b/plinth/templates/notifications.html index 5b9a2c738..25d52c2f2 100644 --- a/plinth/templates/notifications.html +++ b/plinth/templates/notifications.html @@ -12,25 +12,33 @@
    {% for note in notifications %}
  • - {% if note.data.app_name %} -
    - {% if note.data.app_icon %} -
    - {% elif note.data.app_icon_filename %} - {% if note.app_id %} - {{ note.data.app_name }} - {% else %} - {{ note.data.app_name }} - {% endif %} - {% endif %} +
    + + {% blocktrans trimmed with time_since=note.last_update_time|timesince %} + {{ time_since }} ago + {% endblocktrans %} + - {{ note.data.app_name }} -
    - {% endif %} + {% if note.data.app_name %} +
    + {% if note.data.app_icon %} +
    + {% elif note.data.app_icon_filename %} + {% if note.app_id %} + {{ note.data.app_name }} + {% else %} + {{ note.data.app_name }} + {% endif %} + {% endif %} + {{ note.data.app_name }} +
    + {% endif %} +
    {% if note.body %} {{ note.body.content.decode|safe }} diff --git a/static/themes/default/css/main.css b/static/themes/default/css/main.css index a6dee5f3e..a1820d9a4 100644 --- a/static/themes/default/css/main.css +++ b/static/themes/default/css/main.css @@ -1020,6 +1020,12 @@ section.app-description { border-top: 1px solid var(--bs-border-color-translucent); } +.notification-time { + float: right; + font-size: 0.8rem; + color: var(--bs-secondary-color); +} + .notification-title { font-weight: bold; }