Factorize about link

This commit is contained in:
Yohan Boniface 2023-08-01 14:42:12 +02:00
parent 3d45242684
commit 56cb4b44d0

View file

@ -788,12 +788,8 @@ L.U.Map.include({
L.bind(appendAll, this)()
L.DomEvent.on(filter, 'input', appendAll, this)
L.DomEvent.on(filter, 'input', resetLayers, this)
const link = L.DomUtil.create('li', '')
L.DomUtil.create('i', 'umap-icon-16 umap-caption', link)
const label = L.DomUtil.create('span', '', link)
label.textContent = label.title = L._('About')
L.DomEvent.on(link, 'click', this.displayCaption, this)
this.ui.openPanel({ data: { html: browserContainer }, actions: [link] })
this.ui.openPanel({ data: { html: browserContainer }, actions: [this._aboutLink()] })
},
_openFilter: function () {
@ -890,7 +886,8 @@ L.U.Map.include({
datalayer.resetLayer(true)
if (datalayer.hasDataVisible()) found = true
})
if (!found) this.ui.alert({content: L._('No results for these filters'), level: 'info'})
if (!found)
this.ui.alert({ content: L._('No results for these filters'), level: 'info' })
}
propertiesContainer.innerHTML = ''
@ -898,12 +895,16 @@ L.U.Map.include({
L.bind(addProperty, this)(property)
})
this.ui.openPanel({ data: { html: filterContainer }, actions: [this._aboutLink()] })
},
_aboutLink: function () {
const link = L.DomUtil.create('li', '')
L.DomUtil.create('i', 'umap-icon-16 umap-caption', link)
const label = L.DomUtil.create('span', '', link)
label.textContent = label.title = L._('About')
L.DomEvent.on(link, 'click', this.displayCaption, this)
this.ui.openPanel({ data: { html: filterContainer }, actions: [link] })
return link
},
displayCaption: function () {