Compare commits

..

1 commit

Author SHA1 Message Date
Yohan Boniface
e47796c75f
Merge ba3a1ccd33 into e01a526935 2024-12-02 19:54:57 +01:00
3 changed files with 5 additions and 8 deletions

View file

@ -2,7 +2,6 @@ import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
import { BaseAjax, SingleMixin } from '../autocomplete.js' import { BaseAjax, SingleMixin } from '../autocomplete.js'
import * as Util from '../utils.js' import * as Util from '../utils.js'
import { AutocompleteCommunes } from './communesfr.js' import { AutocompleteCommunes } from './communesfr.js'
import { translate } from '../i18n.js'
const TEMPLATE = ` const TEMPLATE = `
<h3>Cadastre</h3> <h3>Cadastre</h3>
@ -57,8 +56,6 @@ export class Importer {
.open({ .open({
template: container, template: container,
className: `${this.id} importer dark`, className: `${this.id} importer dark`,
cancel: false,
accept: translate('Choose this data'),
}) })
.then(confirm) .then(confirm)
} }

View file

@ -37,8 +37,8 @@ class Autocomplete extends SingleMixin(BaseAjax) {
} }
export class Importer { export class Importer {
constructor(umap, options = {}) { constructor(map, options = {}) {
this.umap = umap this.map = map
this.name = options.name || 'GeoDataMine' this.name = options.name || 'GeoDataMine'
this.baseUrl = options?.url || 'https://geodatamine.fr' this.baseUrl = options?.url || 'https://geodatamine.fr'
this.id = 'geodatamine' this.id = 'geodatamine'
@ -49,7 +49,7 @@ export class Importer {
let boundaryName = null let boundaryName = null
const container = DomUtil.create('div') const container = DomUtil.create('div')
container.innerHTML = TEMPLATE container.innerHTML = TEMPLATE
const response = await this.umap.request.get(`${this.baseUrl}/themes`) const response = await importer.map.request.get(`${this.baseUrl}/themes`)
const select = container.querySelector('select') const select = container.querySelector('select')
if (response?.ok) { if (response?.ok) {
const { themes } = await response.json() const { themes } = await response.json()

View file

@ -44,12 +44,12 @@ const ControlsMixin = {
new U.DrawToolbar({ map: this }).addTo(this) new U.DrawToolbar({ map: this }).addTo(this)
const editActions = [ const editActions = [
U.EditCaptionAction, U.EditCaptionAction,
U.ImportAction, U.EditPropertiesAction,
U.EditLayersAction, U.EditLayersAction,
U.ChangeTileLayerAction, U.ChangeTileLayerAction,
U.UpdateExtentAction, U.UpdateExtentAction,
U.UpdatePermsAction, U.UpdatePermsAction,
U.EditPropertiesAction, U.ImportAction,
] ]
if (this.options.editMode === 'advanced') { if (this.options.editMode === 'advanced') {
new U.SettingsToolbar({ actions: editActions }).addTo(this) new U.SettingsToolbar({ actions: editActions }).addTo(this)