diff --git a/umap/static/umap/js/modules/data/layer.js b/umap/static/umap/js/modules/data/layer.js index 761945b0..92808cc2 100644 --- a/umap/static/umap/js/modules/data/layer.js +++ b/umap/static/umap/js/modules/data/layer.js @@ -831,8 +831,9 @@ export class DataLayer extends ServerStored { this ) - if (this._umap.properties.urls.datalayer_versions) + if (this._umap.properties.urls.datalayer_versions) { this.buildVersionsFieldset(container) + } const advancedActions = DomUtil.createFieldset( container, @@ -907,10 +908,15 @@ export class DataLayer extends ServerStored { const appendVersion = (data) => { const date = new Date(Number.parseInt(data.at, 10)) const content = `${date.toLocaleString(U.lang)} (${Number.parseInt(data.size) / 1000}Kb)` - const el = DomUtil.create('div', 'umap-datalayer-version', versionsContainer) - const button = DomUtil.createButton('', el, '', () => this.restore(data.ref)) - button.title = translate('Restore this version') - DomUtil.add('span', '', el, content) + const [el, { button }] = Utils.loadTemplateWithRefs( + `
+ +
` + ) + versionsContainer.appendChild(el) + button.addEventListener('click', () => this.restore(data.ref)) } const versionsContainer = DomUtil.createFieldset(container, translate('Versions'), { diff --git a/umap/static/umap/map.css b/umap/static/umap/map.css index 87ee6c2d..9becf5c5 100644 --- a/umap/static/umap/map.css +++ b/umap/static/umap/map.css @@ -475,22 +475,6 @@ ul.photon-autocomplete { font-style: italic; } - - -.umap-datalayer-version { - padding: 5px 0; - border-bottom: 1px solid #202425; -} -.umap-datalayer-version button { - display: inline-block; - width: 24px; - min-height: 24px; - background-position: -122px -73px; - background-repeat: no-repeat; - background-image: url('./img/16-white.svg'); - margin-inline-end: 10px; -} - .leaflet-toolbar-tip { background-color: var(--color-darkGray); }