diff sat_templates/templates/bulma/chat/chat.html @ 365:9860286068b9

chat/chat.html: display date when there is a date change between 2 messages
author Goffi <goffi@goffi.org>
date Wed, 28 Jun 2023 10:40:53 +0200
parents 095bd5b34080
children 941e4006ab6e
line wrap: on
line diff
--- a/sat_templates/templates/bulma/chat/chat.html	Wed Jun 28 10:40:53 2023 +0200
+++ b/sat_templates/templates/bulma/chat/chat.html	Wed Jun 28 10:40:53 2023 +0200
@@ -28,6 +28,14 @@
         <!-- Messages -->
         <div id="messages" class="box p-4 has-background-white mb-4 is-flex-grow-1 is-flex-direction-column-reverse is-overflow-auto">
             {% for msg in messages %}
+                {% set current_date = msg.timestamp|date_fmt('full', date_only=True) %}
+                {% if loop.changed(current_date) %}
+                    <div class="separator">
+                        <hr class="has-background-light" />
+                        <span class="has-text-grey is-size-7">{{current_date}}</span>
+                        <hr class="has-background-light" />
+                    </div>
+                {% endif %}
                 {% include 'chat/message.html' %}
             {% endfor %}
         </div>