mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
feat: add a back button to importers dialog (#2364)

This commit is contained in:
commit
09faa763f9
2 changed files with 10 additions and 2 deletions
|
@ -64,7 +64,10 @@ export default class Importer extends Utils.WithTemplate {
|
||||||
this.TYPES = ['geojson', 'csv', 'gpx', 'kml', 'osm', 'georss', 'umap']
|
this.TYPES = ['geojson', 'csv', 'gpx', 'kml', 'osm', 'georss', 'umap']
|
||||||
this.IMPORTERS = []
|
this.IMPORTERS = []
|
||||||
this.loadImporters()
|
this.loadImporters()
|
||||||
this.dialog = new Dialog({ className: 'importers dark' })
|
this.dialog = new Dialog({
|
||||||
|
className: 'importers dark',
|
||||||
|
back: () => this.showImporters(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
loadImporters() {
|
loadImporters() {
|
||||||
|
@ -172,7 +175,7 @@ export default class Importer extends Utils.WithTemplate {
|
||||||
button.addEventListener('click', () => plugin.open(this))
|
button.addEventListener('click', () => plugin.open(this))
|
||||||
grid.appendChild(button)
|
grid.appendChild(button)
|
||||||
}
|
}
|
||||||
this.dialog.open({ template: element, cancel: false, accept: false })
|
this.dialog.open({ template: element, cancel: false, accept: false, back: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
|
|
@ -6,6 +6,7 @@ const TEMPLATE = `
|
||||||
<form method="dialog" data-ref="form">
|
<form method="dialog" data-ref="form">
|
||||||
<ul class="buttons">
|
<ul class="buttons">
|
||||||
<li><i class="icon icon-16 icon-close" data-close></i></li>
|
<li><i class="icon icon-16 icon-close" data-close></i></li>
|
||||||
|
<li hidden data-ref="back"><i class="icon icon-16 icon-back"></i></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3 data-ref="message" id="${Math.round(Date.now()).toString(36)}"></h3>
|
<h3 data-ref="message" id="${Math.round(Date.now()).toString(36)}"></h3>
|
||||||
<fieldset data-ref="fieldset" role="document">
|
<fieldset data-ref="fieldset" role="document">
|
||||||
|
@ -123,6 +124,10 @@ export default class Dialog extends WithTemplate {
|
||||||
} else {
|
} else {
|
||||||
this.elements.template.innerHTML = dialog.template || ''
|
this.elements.template.innerHTML = dialog.template || ''
|
||||||
}
|
}
|
||||||
|
this.elements.back.hidden = !dialog.back
|
||||||
|
if (dialog.back) {
|
||||||
|
this.elements.back.addEventListener('click', dialog.back)
|
||||||
|
}
|
||||||
|
|
||||||
this.focusable = this.getFocusable()
|
this.focusable = this.getFocusable()
|
||||||
this.hasFormData = this.elements.fieldset.elements.length > 0
|
this.hasFormData = this.elements.fieldset.elements.length > 0
|
||||||
|
|
Loading…
Reference in a new issue