rename gelocation, and move the request to nominatim server side

This commit is contained in:
sedum
2022-09-08 20:37:20 +02:00
parent dcdefec6de
commit 6e182b5de1
8 changed files with 28 additions and 28 deletions

View File

@@ -30,7 +30,7 @@ v-row
:label="$t('common.address')"
@change="changeAddress"
:value="value.address")
v-combobox.mr-4(ref='detailsView' v-if='settings.allow_geolocalization'
v-combobox.mr-4(ref='detailsView' v-if='settings.allow_geolocation'
:prepend-icon='mdiMapSearch'
:disabled='disableDetails'
@input.native='searchCoordinates'
@@ -47,7 +47,7 @@ v-row
v-list-item-content(two-line v-if='item')
v-list-item-title(v-text='item.display_name')
v-list-item-subtitle(v-text='`${item.lat}`+`,`+`${item.lon}`')
v-text-field(ref='details' v-show='false' v-if='settings.allow_geolocalization')
v-text-field(ref='details' v-show='false' v-if='settings.allow_geolocation')
</template>
<script>
@@ -110,7 +110,7 @@ export default {
if (typeof p === 'object' && !p.create) {
this.place.name = p.name.trim()
this.place.address = p.address
if (this.settings.allow_geolocalization) {
if (this.settings.allow_geolocation) {
this.place.details = p.details
}
this.place.id = p.id
@@ -128,7 +128,7 @@ export default {
} else {
delete this.place.id
this.place.address = ''
if (this.settings.allow_geolocalization) {
if (this.settings.allow_geolocation) {
this.place.details = p.details
}
this.disableAddress = false
@@ -158,9 +158,12 @@ export default {
},
searchCoordinates: debounce(async function(ev) {
this.loading = true
const searchCoordinates = ev.target.value.trim().toLowerCase()
// this.detailsList = await this.$axios.$get(`placeNominatim?search=${searchCoordinates}`)
this.detailsList = await this.$axios.$get(`https://nominatim.openstreetmap.org/search?limit=3&format=json&namedetails=1&q=${searchCoordinates}` )
const pre_searchCoordinates = ev.target.value.trim().toLowerCase()
// allow pasting coordinates lat/lon
const searchCoordinates = pre_searchCoordinates.replace('/', ',')
if (searchCoordinates.length) {
this.detailsList = await this.$axios.$get(`placeNominatim/${searchCoordinates}`)
}
if (this.detailsList) {
this.loading = false;
}

View File

@@ -25,7 +25,7 @@ v-container
v-model='place.address'
:placeholder='$t("common.address")')
v-textarea(v-if="settings.allow_geolocalization"
v-textarea(v-if="settings.allow_geolocation"
row-height="15"
:disabled="true"
:label="$t('common.details')"
@@ -83,7 +83,7 @@ export default {
editPlace (item) {
this.place.name = item.name
this.place.address = item.address
if (this.settings.allow_geolocalization) {
if (this.settings.allow_geolocation) {
this.place.details = JSON.parse(item.details)
}
this.place.id = item.id

View File

@@ -48,9 +48,9 @@ v-container
inset
:label="$t('admin.recurrent_event_visible')")
v-switch.mt-1(v-model='allow_geolocalization'
v-switch.mt-1(v-model='allow_geolocation'
inset
:label="$t('admin.allow_geolocalization')")
:label="$t('admin.allow_geolocation')")
v-dialog(v-model='showSMTP' destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly')
SMTP(@close='showSMTP = false')
@@ -111,9 +111,9 @@ export default {
get () { return this.settings.recurrent_event_visible },
set (value) { this.setSetting({ key: 'recurrent_event_visible', value }) }
},
allow_geolocalization: {
get () { return this.settings.allow_geolocalization },
set (value) { this.setSetting({ key: 'allow_geolocalization', value }) }
allow_geolocation: {
get () { return this.settings.allow_geolocation },
set (value) { this.setSetting({ key: 'allow_geolocation', value }) }
},
filteredTimezones () {
const current_timezone = moment.tz.guess()