From a59df23fbf412ce0d2686b951aea0dae1884c3db Mon Sep 17 00:00:00 2001 From: sedum Date: Thu, 27 Apr 2023 00:07:36 +0200 Subject: [PATCH 1/4] refactor of map component, still missing some ignorecache functions to test different geocoding providers --- components/EventMapDialog.vue | 65 ++++++++++++++++++ components/Map.vue | 108 +++++++++++------------------- components/MapEdit.vue | 77 --------------------- components/WhereInputAdvanced.vue | 4 +- components/admin/Geolocation.vue | 92 +++++++++++-------------- components/admin/Places.vue | 4 +- pages/event/_slug.vue | 5 +- 7 files changed, 149 insertions(+), 206 deletions(-) create mode 100644 components/EventMapDialog.vue delete mode 100644 components/MapEdit.vue diff --git a/components/EventMapDialog.vue b/components/EventMapDialog.vue new file mode 100644 index 00000000..378f2719 --- /dev/null +++ b/components/EventMapDialog.vue @@ -0,0 +1,65 @@ + + diff --git a/components/Map.vue b/components/Map.vue index a62b2beb..be67663a 100644 --- a/components/Map.vue +++ b/components/Map.vue @@ -1,43 +1,26 @@ diff --git a/components/WhereInputAdvanced.vue b/components/WhereInputAdvanced.vue index bcaf5bdd..d81faa11 100644 --- a/components/WhereInputAdvanced.vue +++ b/components/WhereInputAdvanced.vue @@ -38,7 +38,7 @@ v-card :rules="$validators.longitude") p.mt-4(v-if='place.isNew' v-html="$t('event.address_geocoded_disclaimer')") - MapEdit.mt-4(:place='place' v-if="(settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude)" ) + Map.mt-4(:place='place' v-if="(settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude)" ) v-divider(v-if='settings.allow_online_event && showGeocoded') @@ -76,7 +76,7 @@ export default { onlineLocations: { type: Array, default: [] } }, components: { - [process.client && 'MapEdit']: () => import('@/components/MapEdit.vue') + [process.client && 'Map']: () => import('@/components/Map.vue') }, data ({$store}) { return { diff --git a/components/admin/Geolocation.vue b/components/admin/Geolocation.vue index f1b23061..0c64a559 100644 --- a/components/admin/Geolocation.vue +++ b/components/admin/Geolocation.vue @@ -49,8 +49,13 @@ v-card :label="$t('admin.tilelayer_provider_attribution')" :placeholder="tilelayer_provider_attribution_default") - div(id="leaflet-map-preview" max-height='10px') - //- Map + Map(:key='mapKey' v-if='mapPreview' + @tileerror='tilelayerTestError' + @tileload='tilelayerTestSuccess' + height="20rem" + showMarker=false + :mapCenter='mapCenter' + :zoom='12') v-card-actions v-spacer @@ -61,19 +66,19 @@ v-card - diff --git a/components/admin/Places.vue b/components/admin/Places.vue index e1d7c11c..ee80662f 100644 --- a/components/admin/Places.vue +++ b/components/admin/Places.vue @@ -62,7 +62,7 @@ v-container :label="$t('common.longitude')" :rules="$validators.longitude") - MapEdit.mt-4(:place.sync='place' :key="dialog" v-if="settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude") + Map.mt-4(:place.sync='place' :key="dialog" v-if="settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude") v-card-actions v-spacer @@ -96,7 +96,7 @@ import geolocation from '../../server/helpers/geolocation/index' export default { components: { - [process.client && 'MapEdit']: () => import('@/components/MapEdit.vue') + [process.client && 'Map']: () => import('@/components/Map.vue') }, data( {$store} ) { return { diff --git a/pages/event/_slug.vue b/pages/event/_slug.vue index b719419b..3991c8ec 100644 --- a/pages/event/_slug.vue +++ b/pages/event/_slug.vue @@ -177,7 +177,7 @@ v-container#event.pa-2.pa-sm-2(itemscope itemtype="https://schema.org/Event" v-t EmbedEvent(:event='event' @close='showEmbed=false') v-dialog(v-show='settings.allow_geolocation && event.place.latitude && event.place.longitude' v-model='mapModal' :fullscreen='$vuetify.breakpoint.xsOnly' destroy-on-close) - Map(:event='event' @close='mapModal=false') + EventMapDialog(:event='event' @close='mapModal=false') diff --git a/components/WhereInputAdvanced.vue b/components/WhereInputAdvanced.vue index d81faa11..d2074761 100644 --- a/components/WhereInputAdvanced.vue +++ b/components/WhereInputAdvanced.vue @@ -38,7 +38,8 @@ v-card :rules="$validators.longitude") p.mt-4(v-if='place.isNew' v-html="$t('event.address_geocoded_disclaimer')") - Map.mt-4(:place='place' v-if="(settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude)" ) + Map.mt-4(:place='place' draggable=true + v-if="(settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude)" ) v-divider(v-if='settings.allow_online_event && showGeocoded') diff --git a/components/admin/Places.vue b/components/admin/Places.vue index ee80662f..7ec8e189 100644 --- a/components/admin/Places.vue +++ b/components/admin/Places.vue @@ -62,7 +62,8 @@ v-container :label="$t('common.longitude')" :rules="$validators.longitude") - Map.mt-4(:place.sync='place' :key="dialog" v-if="settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude") + Map.mt-4(:place.sync='place' :key="dialog" draggable=true + v-if="settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude") v-card-actions v-spacer @@ -109,7 +110,7 @@ export default { addressList: [], address: '', search: '', - place: { name: '', address: '', id: null }, + place: { name: '', address: '', latitude: 0, longitude: 0, id: null }, headers: [ { value: 'name', text: this.$t('common.name') }, { value: 'address', text: this.$t('common.address') }, From c91b7f42cb07b77d475cd79ef8615935251a979d Mon Sep 17 00:00:00 2001 From: sedum Date: Fri, 5 May 2023 07:01:50 +0200 Subject: [PATCH 4/4] fix erroneus filter, do not allow edit the online place --- components/admin/Places.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/admin/Places.vue b/components/admin/Places.vue index 7ec8e189..94172cd4 100644 --- a/components/admin/Places.vue +++ b/components/admin/Places.vue @@ -129,7 +129,8 @@ export default { }, async fetch() { this.places = await this.$axios.$get('/places') - this.places.splice(this.places.findIndex((p) => p.name === 'online' ), 1) + // do not allow edit the online place + this.places = this.places.filter(p => p.name !== 'online') }, computed: { ...mapState(['settings']),