diff --git a/umap/static/umap/js/modules/caption.js b/umap/static/umap/js/modules/caption.js
index 7e316945..e44c2e50 100644
--- a/umap/static/umap/js/modules/caption.js
+++ b/umap/static/umap/js/modules/caption.js
@@ -3,13 +3,14 @@ import * as Utils from './utils.js'
const TEMPLATE = `
-
-
-
-
-
-
-
+
@@ -65,6 +66,17 @@ export default class Caption extends Utils.WithTemplate {
// Create the legend when the panel is actually on the DOM
this._umap.eachDataLayerReverse((datalayer) => datalayer.renderLegend())
})
+ if (this._umap.properties.created_at) {
+ const created_at = translate('Created at {date}', {
+ date: new Date(this._umap.properties.created_at).toLocaleDateString(),
+ })
+ const modified_at = translate('Modified at {date}', {
+ date: new Date(this._umap.properties.modified_at).toLocaleDateString(),
+ })
+ this.elements.dates.innerHTML = `${created_at} - ${modified_at}`
+ } else {
+ this.elements.dates.hidden = true
+ }
}
addDataLayer(datalayer, parent) {
diff --git a/umap/static/umap/map.css b/umap/static/umap/map.css
index 156dd791..838faa33 100644
--- a/umap/static/umap/map.css
+++ b/umap/static/umap/map.css
@@ -694,8 +694,14 @@ a.umap-control-caption,
.datalayer-name {
cursor: pointer;
}
-.umap-caption .umap-map-author {
- padding-inline-start: 31px;
+.umap-caption .dates {
+ color: var(--color-mediumGray);
+}
+.umap-caption .header {
+ display: flex;
+}
+.umap-caption .header i.icon {
+ flex-shrink: 0;
}
.umap-browser .main-toolbox {
padding-left: 4px; /* Align with toolbox below */
diff --git a/umap/tests/integration/test_caption.py b/umap/tests/integration/test_caption.py
index 8e378584..f6896647 100644
--- a/umap/tests/integration/test_caption.py
+++ b/umap/tests/integration/test_caption.py
@@ -25,6 +25,7 @@ def test_caption(live_server, page, map):
panel.locator(".caption-item .off").get_by_text(non_loaded.name)
).to_be_visible()
expect(panel.locator(".caption-item").get_by_text(hidden.name)).to_be_hidden()
+ expect(panel.get_by_text("Created at")).to_be_visible()
def test_caption_should_display_owner_as_author(live_server, page, map):
diff --git a/umap/views.py b/umap/views.py
index 08de5a7a..22787556 100644
--- a/umap/views.py
+++ b/umap/views.py
@@ -614,6 +614,13 @@ class MapDetailMixin(SessionMixin):
"defaultLabelKeys": settings.UMAP_LABEL_KEYS,
}
created = bool(getattr(self, "object", None))
+ if created:
+ properties.update(
+ {
+ "created_at": self.object.created_at,
+ "modified_at": self.object.modified_at,
+ }
+ )
if (created and self.object.owner) or (not created and not user.is_anonymous):
edit_statuses = Map.EDIT_STATUS
datalayer_statuses = DataLayer.EDIT_STATUS