Do not use the form for the owner property.
Only add the owner property to defaultProperties, if there is a user. In other words the user can use the map without logging in.
This commit is contained in:
parent
9c89c50560
commit
e2b789e575
2 changed files with 7 additions and 4 deletions
|
@ -1565,7 +1565,11 @@ L.U.Editable = L.Editable.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDefaultProperties: function() {
|
_getDefaultProperties: function() {
|
||||||
return { geojson: { properties: { owner: this.map.options.user.id } } }
|
const result = {}
|
||||||
|
if (this.map.options.hasOwnProperty('user')) {
|
||||||
|
result.geojson = { properties: { owner: this.map.options.user.id } }
|
||||||
|
}
|
||||||
|
return result
|
||||||
},
|
},
|
||||||
|
|
||||||
connectCreatedToMap: function (layer) {
|
connectCreatedToMap: function (layer) {
|
||||||
|
|
|
@ -105,15 +105,14 @@ L.U.FeatureMixin = {
|
||||||
let property
|
let property
|
||||||
for (let i = 0; i < this.datalayer._propertiesIndex.length; i++) {
|
for (let i = 0; i < this.datalayer._propertiesIndex.length; i++) {
|
||||||
property = this.datalayer._propertiesIndex[i]
|
property = this.datalayer._propertiesIndex[i]
|
||||||
if (L.Util.indexOf(['name', 'description', 'owner'], property) !== -1) {
|
if (L.Util.indexOf(['name', 'description'], property) !== -1) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
properties.push([`properties.${property}`, { label: property }])
|
properties.push([`properties.${property}`, { label: property }])
|
||||||
}
|
}
|
||||||
// We always want name, description, owner for now (properties management to come)
|
// We always want name and description for now (properties management to come)
|
||||||
properties.unshift('properties.description')
|
properties.unshift('properties.description')
|
||||||
properties.unshift('properties.name')
|
properties.unshift('properties.name')
|
||||||
properties.unshift('properties.owner')
|
|
||||||
builder = new L.U.FormBuilder(this, properties, {
|
builder = new L.U.FormBuilder(this, properties, {
|
||||||
id: 'umap-feature-properties',
|
id: 'umap-feature-properties',
|
||||||
callback: this._redraw, // In case we have dynamic options…
|
callback: this._redraw, // In case we have dynamic options…
|
||||||
|
|
Loading…
Reference in a new issue