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()
this.once('saved', L.bind(update, this))
logo.href = '/'
if (this.options.editMode === 'advanced') {
name.href = '#'
share_status.href = '#'
logo.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))
const save = L.DomUtil.create('a', 'leaflet-control-edit-save button', container)
save.href = '#'

View file

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

View file

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