Do not make map name and share status label clickable unless user can edit

This commit is contained in:
Yohan Boniface 2023-09-21 10:42:09 +02:00
parent a04acb828d
commit 157146dc04
3 changed files with 8 additions and 4 deletions

View file

@ -1003,11 +1003,13 @@ L.U.Map.include({
} }
update() update()
this.once('saved', L.bind(update, this)) this.once('saved', L.bind(update, this))
name.href = '#'
share_status.href = '#'
logo.href = '/' logo.href = '/'
L.DomEvent.on(name, 'click', this.edit, this) if (this.options.editMode === 'advanced') {
L.DomEvent.on(share_status, 'click', this.permissions.edit, this.permissions) name.href = '#'
share_status.href = '#'
L.DomEvent.on(name, 'click', this.edit, this)
L.DomEvent.on(share_status, 'click', this.permissions.edit, this.permissions)
}
this.on('postsync', L.bind(update, this)) this.on('postsync', L.bind(update, this))
const save = L.DomUtil.create('a', 'leaflet-control-edit-save button', container) const save = L.DomUtil.create('a', 'leaflet-control-edit-save button', container)
save.href = '#' save.href = '#'

View file

@ -1749,6 +1749,7 @@ L.U.Map.include({
edit: function () { edit: function () {
if (!this.editEnabled) return if (!this.editEnabled) return
if (this.options.editMode !== 'advanced') return
const container = L.DomUtil.create('div', 'umap-edit-container'), const container = L.DomUtil.create('div', 'umap-edit-container'),
metadataFields = ['options.name', 'options.description'], metadataFields = ['options.name', 'options.description'],
title = L.DomUtil.create('h3', '', container) title = L.DomUtil.create('h3', '', container)

View file

@ -51,6 +51,7 @@ L.U.MapPermissions = L.Class.extend({
}, },
edit: function () { edit: function () {
if (this.map.options.editMode !== 'advanced') return
if (!this.map.options.umap_id) if (!this.map.options.umap_id)
return this.map.ui.alert({ return this.map.ui.alert({
content: L._('Please save the map first'), content: L._('Please save the map first'),