diff --git a/umap/static/umap/js/modules/data/layer.js b/umap/static/umap/js/modules/data/layer.js index b8f06bb5..dee5dd5b 100644 --- a/umap/static/umap/js/modules/data/layer.js +++ b/umap/static/umap/js/modules/data/layer.js @@ -838,44 +838,36 @@ export class DataLayer extends ServerStored { container, translate('Advanced actions') ) - const advancedButtons = DomUtil.create('div', 'button-bar half', advancedActions) - const deleteButton = Utils.loadTemplate(` - `) - deleteButton.addEventListener('click', () => { + + + + + + ` + const [bar, { del, empty, clone, download }] = Utils.loadTemplateWithRefs(tpl) + advancedActions.appendChild(bar) + del.addEventListener('click', () => { this.del() this._umap.editPanel.close() }) - advancedButtons.appendChild(deleteButton) if (!this.isRemoteLayer()) { - const emptyLink = DomUtil.createButton( - 'button umap-empty', - advancedButtons, - translate('Empty'), - this.empty, - this - ) - } - const cloneLink = DomUtil.createButton( - 'button umap-clone', - advancedButtons, - translate('Clone'), - function () { - const datalayer = this.clone() - datalayer.edit() - }, - this - ) - if (this.createdOnServer) { - const filename = `${Utils.slugify(this.options.name)}.geojson` - const download = Utils.loadTemplate(` - - ${translate('Download')} - `) - advancedButtons.appendChild(download) + empty.hidden = false + empty.addEventListener('click', () => this.empty()) } + clone.addEventListener('click', () => this.clone().edit()) + if (this.createdOnServer) download.hidden = false const backButton = DomUtil.createButtonIcon( undefined, 'icon-back',