move event.locations to more unique event.online_locations, various fixes on insertion workflow, improved locale messages

This commit is contained in:
sedum 2023-02-22 03:11:58 +01:00
parent 3ca86b9a3b
commit cff608c06f
11 changed files with 105 additions and 102 deletions

View file

@ -1,6 +1,6 @@
<template lang="pug"> <template lang="pug">
client-only(placeholder='Loading...' ) client-only(placeholder='Loading...' )
LMap(ref="map" LMap(ref="mapEdit"
id="leaflet-map" id="leaflet-map"
:zoom="zoom" :zoom="zoom"
:options="{attributionControl: false}" :options="{attributionControl: false}"
@ -34,7 +34,7 @@ export default {
mdiWalk, mdiBike, mdiCar, mdiMapMarker, mdiWalk, mdiBike, mdiCar, mdiMapMarker,
url: $store.state.settings.tilelayer_provider || 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', url: $store.state.settings.tilelayer_provider || 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
attribution: $store.state.settings.tilelayer_provider_attribution || "<a target=\"_blank\" href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors", attribution: $store.state.settings.tilelayer_provider_attribution || "<a target=\"_blank\" href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors",
zoom: 14, zoom: 16,
center: [this.place.latitude, this.place.longitude], center: [this.place.latitude, this.place.longitude],
marker: { marker: {
address: this.place.address, address: this.place.address,
@ -54,8 +54,8 @@ export default {
}); });
setTimeout(() => { setTimeout(() => {
if (this.$refs.map && this.$refs.map.mapObject ) { if (this.$refs.mapEdit && this.$refs.mapEdit.mapObject ) {
this.$refs.map.mapObject.invalidateSize(); this.$refs.mapEdit.mapObject.invalidateSize();
} }
}, 200); }, 200);
} }

View file

@ -25,22 +25,8 @@ v-row.mb-4
v-col(cols=12 md=6) v-col(cols=12 md=6)
v-row.mx-0.my-0.align-center.justify-center v-row.mx-0.my-0.align-center.justify-center
v-combobox.mr-4(v-model="virtualLocations" v-if="settings.allow_event_only_online && value.name === 'online'"
:prepend-icon='mdiLink'
:hint="$t('event.online_locations_help')"
:label="$t('event.online_locations_url')"
clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
:delimiters="[',', ';', '; ']"
:items="virtualLocations"
@change='selectLocations')
template(v-slot:selection="{ item, on, attrs, selected, parent }")
v-chip(v-bind="attrs" close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)'
:input-value="selected" label small) {{ item }}
template(v-slot:append)
v-icon(v-text='mdiCog' :disabled='!value.name' @click="whereInputAdvancedDialog = true")
v-text-field.mr-4(v-if="value.name !== 'online'" v-text-field.mr-4(ref='address' v-if="value.name !== 'online'"
ref='address'
v-model='value.address' v-model='value.address'
:prepend-icon='mdiMap' :prepend-icon='mdiMap'
:disabled='disableAddress' :disabled='disableAddress'
@ -52,12 +38,27 @@ v-row.mb-4
v-icon(v-text='mdiCog' :disabled='!(value.name && settings.allow_event_also_online) && !(value.isNew && settings.allow_geolocation)' v-icon(v-text='mdiCog' :disabled='!(value.name && settings.allow_event_also_online) && !(value.isNew && settings.allow_geolocation)'
@click="whereInputAdvancedDialog = true") @click="whereInputAdvancedDialog = true")
v-combobox.mr-4(v-model="onlineLocations" v-if="settings.allow_event_only_online && value.name === 'online'"
:prepend-icon='mdiLink'
:hint="$t('event.online_locations_help')"
:label="$t('event.online_locations_url')"
clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
:delimiters="[',', ';', '; ']"
:items="onlineLocations"
@change='selectLocations')
template(v-slot:selection="{ item, index, on, attrs, selected, parent }")
v-chip(v-bind="attrs" :outlined='index !== 0'
close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)'
:input-value="selected" label small) {{ item }}
template(v-slot:append)
v-icon(v-text='mdiCog' :disabled='!value.name' @click="whereInputAdvancedDialog = true")
v-dialog(v-model='whereInputAdvancedDialog' :key="whereAdvancedId" destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly' dense) v-dialog(v-model='whereInputAdvancedDialog' :key="whereAdvancedId" destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly' dense)
WhereInputAdvanced(ref='whereAdvanced' :place.sync='value' :event='event' @close='whereInputAdvancedDialog = false && this.$refs.address.blur()' WhereInputAdvanced(ref='whereAdvanced' :place.sync='value' :event='event' @close='whereInputAdvancedDialog = false && this.$refs.address.blur()'
:virtualLocations.sync="virtualLocations" :onlineLocations.sync="onlineLocations"
:event_only_online_value.sync='event_only_online' :event_only_online_value.sync='event_only_online'
@update:onlineEvent="changeOnlineEvent" @update:onlineEvent="changeEventOnlyOnline"
@update:virtualLocations="selectLocations" @update:onlineLocations="selectLocations"
) )
@ -85,7 +86,7 @@ export default {
disableAddress: true, disableAddress: true,
whereInputAdvancedDialog: false, whereInputAdvancedDialog: false,
hideWhereInputAdvancedDialogButton: !$store.state.settings.allow_event_also_online && !$store.state.settings.allow_geolocation, hideWhereInputAdvancedDialogButton: !$store.state.settings.allow_event_also_online && !$store.state.settings.allow_geolocation,
virtualLocations: this.event.locations || [], onlineLocations: this.event.online_locations || [],
event_only_online: (this.value.name === 'online') ? true : false, event_only_online: (this.value.name === 'online') ? true : false,
whereAdvancedId: 1 whereAdvancedId: 1
} }
@ -173,38 +174,42 @@ export default {
} }
// Prevent to provide link for 'event only online' if not allowed: reset locations // Prevent to provide link for 'event only online' if not allowed: reset locations
if (!this.settings.allow_event_only_online && this.place.name === 'online') { if (!this.settings.allow_event_only_online && this.place.name === 'online') {
this.event.locations = [] this.event.online_locations = []
} }
this.disableAddress = false this.disableAddress = false
this.$refs.place.blur() this.$refs.place.blur()
this.$refs.address.focus() this.$nextTick(() => { this.$refs.address.focus() })
} }
} }
this.$emit('input', { ...this.place }) this.$emit('input', { ...this.place })
}, },
selectLocations () { selectLocations () {
this.event.locations = [] this.event.online_locations = []
// Insert up to 3 online location: the main one and 2 fallback
if (this.virtualLocations && this.virtualLocations.length > 3) { if (this.onlineLocations) {
this.$nextTick(() => this.virtualLocations.pop()) // Insert up to 3 online location: the main one and 2 fallback
} if (this.onlineLocations.length > 3) {
this.virtualLocations && this.virtualLocations.forEach((item, i) => { this.$nextTick(() => this.onlineLocations = this.onlineLocations.slice(0, 3))
if (!item.startsWith('http')) {
this.virtualLocations[i] = `https://${item}`
} }
this.event.locations[i] = {'type': 'virtualLocation', 'url': this.virtualLocations[i] } // Remove duplicates
}) this.$nextTick(() => this.onlineLocations = [...new Set(this.onlineLocations)])
this.onlineLocations.forEach((item, i) => {
if (!item.startsWith('http')) { this.onlineLocations[i] = `https://${item}` }
this.event.online_locations[i] = this.onlineLocations[i]
})
}
}, },
changeOnlineEvent(v) { changeEventOnlyOnline(v) {
this.event_only_online = v this.event_only_online = v
// console.log(this.event_only_online) // console.log(this.event_only_online)
if (this.event_only_online) { this.place.name = this.place.address = 'online' } if (this.event_only_online) { this.place.name = this.place.address = 'online' }
if (!this.event_only_online) { this.place.name = this.place.address = '' } if (!this.event_only_online) { this.place.name = this.place.address = ''; this.onlineLocations = [] }
this.place.latitude = null this.place.latitude = null
this.place.longitude = null this.place.longitude = null
// update virtualLocations // Update onlineLocations
this.event.locations && this.selectLocations() this.event.online_locations && this.selectLocations()
this.$emit('input', { ...this.place }) this.$emit('input', { ...this.place })
}, },
} }

View file

@ -4,31 +4,32 @@ v-card
v-card-subtitle {{ $t('event.where_advanced_options_description') }} v-card-subtitle {{ $t('event.where_advanced_options_description') }}
v-card-text(v-if='settings.allow_event_also_online') v-card-text(v-if='settings.allow_event_also_online')
v-switch.mt-0.mb-4(v-model='event_only_online_update' v-switch.mt-0.mb-0(v-model='event_only_online_update'
v-if='settings.allow_event_only_online' v-if='settings.allow_event_only_online'
persistent-hint persistent-hint
:label="$t('event.event_only_online_label')" :label="$t('event.event_only_online_label')")
:hint="$t('event.event_only_online_help')")
v-combobox.mt-0.mb-0.mr-4.my-5(v-model="virtualLocations_update" v-combobox.mt-0.mb-0.mr-4.my-5(v-model="onlineLocations_update"
v-if="place.name !== 'online' && settings.allow_event_also_online" v-if="place.name !== 'online' && settings.allow_event_also_online"
:prepend-icon='mdiLink' :prepend-icon='mdiLink'
:hint="$t('event.additional_online_locations_help')" :hint="$t('event.online_locations_help')"
:label="$t('event.additional_online_locations')" :label="$t('event.online_locations')"
clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
:delimiters="[',', ';', '; ']" :delimiters="[',', ';', '; ']"
:items="virtualLocations_update") :items="onlineLocations_update")
template(v-slot:selection="{ item, on, attrs, selected, parent }") template(v-slot:selection="{ item, index, on, attrs, selected, parent }")
v-chip(v-bind="attrs" close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)' v-chip(v-bind="attrs" :outlined='index !== 0'
close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)'
:input-value="selected" label small) {{ item }} :input-value="selected" label small) {{ item }}
v-divider(v-if='showGeocoded && showOnline') v-divider(v-if='showGeocoded && showOnline')
v-card-text.mt-5(v-if='showGeocoded') v-card-text.mt-5(v-if='showGeocoded')
v-combobox(ref='geocodedAddress' v-if="settings.allow_geolocation && place.name !== 'online' || (!settings.allow_event_only_online && place.name === 'online')" v-combobox(ref='geocodedAddress' v-if="settings.allow_geolocation && place.name !== 'online' || (!settings.allow_event_only_online && place.name === 'online')"
v-focus
:prepend-icon='mdiMapSearch' :prepend-icon='mdiMapSearch'
@input.native='searchAddress' @input.native='searchAddress'
:label="$t('common.search_address')" :label="$t('common.search_coordinates')"
:value='place.geocodedAddress' :value='place.geocodedAddress'
item-text='address' item-text='address'
persistent-hint hide-no-data clearable no-filter persistent-hint hide-no-data clearable no-filter
@ -47,13 +48,13 @@ v-card
v-list-item-subtitle(v-text='`${item.address}`') v-list-item-subtitle(v-text='`${item.address}`')
v-row.mt-4 v-row.mt-4
v-col.py-0(cols=12 md=6) v-col.py-0(cols=12 sm=6)
v-text-field(v-model="place.latitude" v-text-field(v-model="place.latitude"
:prepend-icon='mdiLatitude' :prepend-icon='mdiLatitude'
:disabled="!settings.allow_geolocation || place.name === 'online'" :disabled="!settings.allow_geolocation || place.name === 'online'"
:label="$t('common.latitude')" :label="$t('common.latitude')"
:rules="$validators.latitude") :rules="$validators.latitude")
v-col.py-0(cols=12 md=6) v-col.py-0(cols=12 sm=6)
v-text-field(v-model="place.longitude" v-text-field(v-model="place.longitude"
:prepend-icon='mdiLongitude' :prepend-icon='mdiLongitude'
:disabled="!settings.allow_geolocation || place.name === 'online'" :disabled="!settings.allow_geolocation || place.name === 'online'"
@ -82,7 +83,7 @@ export default {
place: { type: Object, default: () => ({}) }, place: { type: Object, default: () => ({}) },
event: { type: Object, default: () => null }, event: { type: Object, default: () => null },
event_only_online_value: { type: Boolean, default: false }, event_only_online_value: { type: Boolean, default: false },
virtualLocations: { type: Array, default: [] } onlineLocations: { type: Array, default: [] }
}, },
components: { components: {
[process.client && 'MapEdit']: () => import('@/components/MapEdit.vue') [process.client && 'MapEdit']: () => import('@/components/MapEdit.vue')
@ -92,7 +93,7 @@ export default {
mdiMap, mdiLatitude, mdiLongitude, mdiCog, mdiLink, mdiCloseCircle, mdiMap, mdiLatitude, mdiLongitude, mdiCog, mdiLink, mdiCloseCircle,
mdiMapMarker, mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant, mdiMapMarker, mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant,
showOnline: $store.state.settings.allow_event_also_online, showOnline: $store.state.settings.allow_event_also_online,
showGeocoded: $store.state.settings.allow_geolocation && this.place.isNew, showGeocoded: $store.state.settings.allow_geolocation && this.place.isNew && this.place.name !== 'online',
event_only_online: this.place.name === 'online', event_only_online: this.place.name === 'online',
mapEdit: 1, mapEdit: 1,
addressList: [], addressList: [],
@ -117,10 +118,10 @@ export default {
this.close() this.close()
} }
}, },
virtualLocations_update: { onlineLocations_update: {
get () { return this.virtualLocations }, get () { return this.onlineLocations },
set (value) { set (value) {
this.$emit('update:virtualLocations', value) this.$emit('update:onlineLocations', value)
} }
}, },
}, },

View file

@ -30,7 +30,7 @@ v-container
:disabled="!(settings.allow_geolocation && place.name !== 'online')" :disabled="!(settings.allow_geolocation && place.name !== 'online')"
:prepend-icon='mdiMapSearch' :prepend-icon='mdiMapSearch'
@input.native='searchAddress' @input.native='searchAddress'
:label="$t('common.search_address')" :label="$t('common.search_coordinates')"
:value='place.latitude && place.longitude && place.geocodedAddress' :value='place.latitude && place.longitude && place.geocodedAddress'
persistent-hint hide-no-data clearable no-filter persistent-hint hide-no-data clearable no-filter
:loading='loading' :loading='loading'
@ -40,10 +40,10 @@ v-container
:hint="$t('event.address_description_osm')") :hint="$t('event.address_description_osm')")
template(v-slot:message="{message, key}") template(v-slot:message="{message, key}")
span(v-html='message' :key="key") span(v-html='message' :key="key")
template(v-slot:item="{ item, attrs, on }") template(v-slot:item="{ item, attrs, on, selected }")
v-list-item(v-bind='attrs' v-on='on') v-list-item(v-bind='attrs' v-on='on')
v-icon.pr-4(v-text='loadCoordinatesResultIcon(item)') v-icon.pr-4(v-text='loadCoordinatesResultIcon(item)')
v-list-item-content(two-line v-if='item') v-list-item-content(two-line v-if='item' :input-value="selected" )
v-list-item-title(v-text='item.name') v-list-item-title(v-text='item.name')
v-list-item-subtitle(v-text='`${item.address}`') v-list-item-subtitle(v-text='`${item.address}`')
@ -62,7 +62,7 @@ v-container
:label="$t('common.longitude')" :label="$t('common.longitude')"
:rules="$validators.longitude") :rules="$validators.longitude")
MapEdit.mt-4(:place='place' :key="mapEdit" v-if="settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude") MapEdit.mt-4(:place.sync='place' :key="dialog" v-if="settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude")
v-card-actions v-card-actions
v-spacer v-spacer
@ -79,7 +79,7 @@ v-container
:footer-props='{ prevIcon: mdiChevronLeft, nextIcon: mdiChevronRight }' :footer-props='{ prevIcon: mdiChevronLeft, nextIcon: mdiChevronRight }'
:search='search') :search='search')
template(v-slot:item.map='{ item }') template(v-slot:item.map='{ item }')
span {{item.latitude && item.longitude && 'YEP' }} v-icon(v-if='item.latitude && item.longitude' v-text='mdiMapMarker')
template(v-slot:item.actions='{ item }') template(v-slot:item.actions='{ item }')
v-btn(@click='editPlace(item)' color='primary' icon) v-btn(@click='editPlace(item)' color='primary' icon)
v-icon(v-text='mdiPencil') v-icon(v-text='mdiPencil')
@ -116,7 +116,6 @@ export default {
{ value: 'map', text: 'Map' }, { value: 'map', text: 'Map' },
{ value: 'actions', text: this.$t('common.actions'), align: 'right' } { value: 'actions', text: this.$t('common.actions'), align: 'right' }
], ],
geocoding_provider_type: $store.state.settings.geocoding_provider_type || 'Nominatim',
currentGeocodingProvider: geolocation.getGeocodingProvider($store.state.settings.geocoding_provider_type), currentGeocodingProvider: geolocation.getGeocodingProvider($store.state.settings.geocoding_provider_type),
prevAddress: '', prevAddress: '',
iconsMapper: { iconsMapper: {
@ -124,11 +123,12 @@ export default {
'mdiRoadVariant': mdiRoadVariant, 'mdiRoadVariant': mdiRoadVariant,
'mdiMapMarker': mdiMapMarker, 'mdiMapMarker': mdiMapMarker,
'mdiCityVariant': mdiCityVariant 'mdiCityVariant': mdiCityVariant
}, }
} }
}, },
async fetch() { async fetch() {
this.places = await this.$axios.$get('/places') this.places = await this.$axios.$get('/places')
this.places.splice(this.places.findIndex((p) => p.name === 'online' ), 1)
}, },
computed: { computed: {
...mapState(['settings']), ...mapState(['settings']),
@ -140,7 +140,6 @@ export default {
if (this.settings.allow_geolocation) { if (this.settings.allow_geolocation) {
this.prevAddress = '' this.prevAddress = ''
this.place.geocodedAddress = '' this.place.geocodedAddress = ''
this.mapEdit++
this.place.latitude = item.latitude this.place.latitude = item.latitude
this.place.longitude = item.longitude this.place.longitude = item.longitude
} }
@ -157,22 +156,27 @@ export default {
}, },
selectAddress (v) { selectAddress (v) {
let currentAddress = this.place.address let currentAddress = this.place.address
this.place.geocodedAddress = ''
this.dialog++
if (!v) { return } if (!v) { return }
if (typeof v === 'object') { if (typeof v === 'object') {
this.place.latitude = v.lat this.place.latitude = v.lat
this.place.longitude = v.lon this.place.longitude = v.lon
this.place.geocodedAddress = v.address this.place.geocodedAddress = v.address
this.place.address = v.address this.place.address = v.address
if (currentAddress === this.prevAddress) {
console.log('here')
this.place.address = currentAddress
}
} else { } else {
this.place.address = v this.place.address = v
this.place.latitude = this.place.longitude = null this.place.latitude = this.place.longitude = null
} }
if (currentAddress == '' || currentAddress == this.prevAddress) {
this.place.address = this.place.geocodedAddress
} else {
this.place.address = currentAddress
}
this.prevAddress = this.place.geocodedAddress
this.$emit('input', { ...this.place }) this.$emit('input', { ...this.place })
this.prevAddress = this.geocodedAddress
}, },
searchAddress: debounce(async function(ev) { searchAddress: debounce(async function(ev) {
const pre_searchCoordinates = ev.target.value.trim().toLowerCase() const pre_searchCoordinates = ev.target.value.trim().toLowerCase()
@ -180,7 +184,7 @@ export default {
if (searchCoordinates.length) { if (searchCoordinates.length) {
this.loading = true this.loading = true
const ret = await this.$axios.$get(`placeOSM/${this.geocoding_provider_type}/${searchCoordinates}`) const ret = await this.$axios.$get(`placeOSM/${this.currentGeocodingProvider.commonName}/${searchCoordinates}`)
this.addressList = this.currentGeocodingProvider.mapQueryResults(ret) this.addressList = this.currentGeocodingProvider.mapQueryResults(ret)
this.loading = false this.loading = false
} }

View file

@ -101,7 +101,7 @@
"recurring_event_actions": "Recurring event actions", "recurring_event_actions": "Recurring event actions",
"latitude": "Latitude", "latitude": "Latitude",
"longitude": "Longitude", "longitude": "Longitude",
"search_address": "Search address" "search_coordinates": "Search coordinates"
}, },
"login": { "login": {
"description": "By logging in you can publish new events.", "description": "By logging in you can publish new events.",
@ -143,7 +143,7 @@
"updated": "Event updated", "updated": "Event updated",
"where_description": "Where's the event? If not present you can create it.", "where_description": "Where's the event? If not present you can create it.",
"address_description": "What is the address?", "address_description": "What is the address?",
"address_description_osm": "What is the address? (<a href='http://osm.org/copyright'>OpenStreetMap</a> contributors)", "address_description_osm": "Search tiping the address. (<a href='http://osm.org/copyright'>OpenStreetMap</a> contributors)",
"confirmed": "Event confirmed", "confirmed": "Event confirmed",
"not_found": "Could not find event", "not_found": "Could not find event",
"remove_confirmation": "Are you sure you want to remove this event?", "remove_confirmation": "Are you sure you want to remove this event?",
@ -183,19 +183,15 @@
"remove_media_confirmation": "Do you confirm the image removal?", "remove_media_confirmation": "Do you confirm the image removal?",
"download_flyer": "Download flyer", "download_flyer": "Download flyer",
"where_advanced_options": "Place - Advanced options", "where_advanced_options": "Place - Advanced options",
"where_advanced_options_description": "Define here additional place properties to the event", "where_advanced_options_description": "Define here additional place properties",
"event_only_online": "Online event", "event_only_online": "Online event",
"event_only_online_label": "Event only online", "event_only_online_label": "The event is only online",
"event_only_online_help": "For online-only event, the default place name 'online' is applied",
"event_also_online": "Partecipate remotely", "event_also_online": "Partecipate remotely",
"online_locations": "Online locations",
"online_locations_help": "For instance a url to a videconference room, and a fallback url (max. 3)",
"online_locations_url": "Online locations", "online_locations_url": "Online locations",
"online_locations_fallback_urls": "Fallback links", "online_locations_fallback_urls": "Fallback links",
"additional_online_locations": "Additional online locations", "address_geocoded_disclaimer": "If you cannot find the <strong>street address</strong> or the <strong>housenumber</strong> you are looking for in the geocoding results, you can manually insert them in the 'Address' field without loose the coordinates. Consider also that the <a target=\"_blank\" href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> project is open to contributions. If you have Android, we recommend <a target=\"_blank\" href=\"https://f-droid.org/en/packages/de.westnordost.streetcomplete/\">StreetComplete</a> "
"additional_online_locations_help": "Online locations, for instance a url to a videconference room",
"address_geocoded_disclaimer": "Didn't you found the address or housenumber you are looking for? The <a target=\"_blank\" href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> project is open to contributions. If you have Android, we recommend <a target=\"_blank\" href=\"https://f-droid.org/en/packages/de.westnordost.streetcomplete/\">StreetComplete</a> ",
"address_overwrite": "Overwrite Address",
"address_overwrite_help": "Overwrite the geocoded address, for instance to add missing housenumber or a floor information",
"online_locations_help": "Online locations, for instance a url to a videconference room"
}, },
"admin": { "admin": {
"place_description": "If you have gotten the place or address wrong, you can change it.<br/>All current and past events associated with this place will change address.", "place_description": "If you have gotten the place or address wrong, you can change it.<br/>All current and past events associated with this place will change address.",

View file

@ -127,7 +127,7 @@ export default {
data.event.place.address = event.place.address || '' data.event.place.address = event.place.address || ''
data.event.place.latitude = event.place.latitude || '' data.event.place.latitude = event.place.latitude || ''
data.event.place.longitude = event.place.longitude || '' data.event.place.longitude = event.place.longitude || ''
data.event.locations = event.locations || [] data.event.online_locations = event.online_locations || []
const from = dayjs.unix(event.start_datetime).tz() const from = dayjs.unix(event.start_datetime).tz()
const due = event.end_datetime && dayjs.unix(event.end_datetime).tz() const due = event.end_datetime && dayjs.unix(event.end_datetime).tz()
data.date = { data.date = {
@ -157,7 +157,7 @@ export default {
openImportDialog: false, openImportDialog: false,
event: { event: {
place: { name: '', address: '', latitude: null, longitude: null }, place: { name: '', address: '', latitude: null, longitude: null },
locations: [], online_locations: [],
title: '', title: '',
description: '', description: '',
tags: [], tags: [],
@ -245,12 +245,8 @@ export default {
formData.append('place_longitude', this.event.place.longitude || '') formData.append('place_longitude', this.event.place.longitude || '')
} }
if (this.event.locations.length) { if (this.event.online_locations) {
this.event.locations.forEach(location => formData.append('locations[]', location.url)) this.event.online_locations.forEach(l => formData.append('online_locations[]', l))
} else {
// delete
this.event.locations = []
formData.append('locations', this.event.locations )
} }
formData.append('description', this.event.description) formData.append('description', this.event.description)

View file

@ -37,19 +37,19 @@ v-container#event.pa-0.pa-sm-2
outlined :key='tag' :to='`/tag/${encodeURIComponent(tag)}`') {{tag}} outlined :key='tag' :to='`/tag/${encodeURIComponent(tag)}`') {{tag}}
//- online events //- online events
v-divider(v-if='onlineSectionEnabled && event.locations && event.locations.length') v-divider(v-if='onlineSectionEnabled && event.online_locations && event.online_locations.length')
div(v-if='onlineSectionEnabled && event.locations && event.locations.length') div(v-if='onlineSectionEnabled && event.online_locations && event.online_locations.length')
v-card-text.text-caption.pb-0(v-text="event.place.name === 'online' && $t('event.event_only_online') || $t('event.event_also_online') ") v-card-text.text-caption.pb-0(v-text="event.place.name === 'online' && $t('event.event_only_online') || $t('event.event_also_online') ")
v-list-item(target='_blank' :href='`${event.locations[0]}`') v-list-item(target='_blank' :href='`${event.online_locations[0]}`')
v-list-item-icon v-list-item-icon
v-icon.my-auto(v-text='mdiMonitorAccount') v-icon.my-auto(v-text='mdiMonitorAccount')
v-list-item-content.py-0 v-list-item-content.py-0
v-list-item-title.text-caption(v-text='`${event.locations[0]}`') v-list-item-title.text-caption(v-text='`${event.online_locations[0]}`')
div(v-if='onlineSectionEnabled && event.locations && event.locations.length > 1') div(v-if='onlineSectionEnabled && event.online_locations && event.online_locations.length > 1')
v-card-text.text-caption.pt-0.pb-0(v-text="$t('event.online_locations_fallback_urls')") v-card-text.text-caption.pt-0.pb-0(v-text="$t('event.online_locations_fallback_urls')")
v-list-item v-list-item
v-list-item-content v-list-item-content
v-chip(v-for='(item, index) in event.locations' v-if="index > 0" target='_blank' :href="`${item}`" v-chip(v-for='(item, index) in event.online_locations' v-if="index > 0" target='_blank' :href="`${item}`"
v-bind:key="index" small label v-text="`${item}`" outlined ) v-bind:key="index" small label v-text="`${item}`" outlined )
v-divider v-divider

View file

@ -401,7 +401,7 @@ const eventController = {
multidate: body.multidate, multidate: body.multidate,
start_datetime: body.start_datetime, start_datetime: body.start_datetime,
end_datetime: body.end_datetime, end_datetime: body.end_datetime,
locations: body.locations, online_locations: body.online_locations,
recurrent, recurrent,
// publish this event only if authenticated // publish this event only if authenticated
is_visible: !!req.user is_visible: !!req.user
@ -486,7 +486,7 @@ const eventController = {
multidate: body.multidate, multidate: body.multidate,
start_datetime: body.start_datetime || event.start_datetime, start_datetime: body.start_datetime || event.start_datetime,
end_datetime: body.end_datetime || null, end_datetime: body.end_datetime || null,
locations: body.locations, online_locations: body.online_locations,
recurrent recurrent
} }

View file

@ -100,7 +100,7 @@ module.exports = () => {
* @param {string} [query] - search for this string * @param {string} [query] - search for this string
* @param {array} [tags] - List of tags * @param {array} [tags] - List of tags
* @param {array} [places] - List of places id * @param {array} [places] - List of places id
* @param {array} [locations] - List of locations * @param {array} [online_locations] - List of online locations
* @param {integer} [max] - Limit events * @param {integer} [max] - Limit events
* @param {boolean} [show_recurrent] - Show also recurrent events (default: as choosen in admin settings) * @param {boolean} [show_recurrent] - Show also recurrent events (default: as choosen in admin settings)
* @param {integer} [page] - Pagination * @param {integer} [page] - Pagination
@ -124,6 +124,7 @@ module.exports = () => {
* @param {string} [place_address] - the address of the place * @param {string} [place_address] - the address of the place
* @param {float} [place_latitude] - the latitude of the place * @param {float} [place_latitude] - the latitude of the place
* @param {float} [place_longitude] - the longitude of the place * @param {float} [place_longitude] - the longitude of the place
* @param {array} online_locations - List of online locations
* @param {integer} start_datetime - start timestamp * @param {integer} start_datetime - start timestamp
* @param {integer} multidate - is a multidate event? * @param {integer} multidate - is a multidate event?
* @param {array} tags - List of tags * @param {array} tags - List of tags

View file

@ -38,7 +38,7 @@ module.exports = (sequelize, DataTypes) => {
recurrent: DataTypes.JSON, recurrent: DataTypes.JSON,
likes: { type: DataTypes.JSON, defaultValue: [] }, likes: { type: DataTypes.JSON, defaultValue: [] },
boost: { type: DataTypes.JSON, defaultValue: [] }, boost: { type: DataTypes.JSON, defaultValue: [] },
locations: { type: DataTypes.JSON, defaultValue: [] } online_locations: { type: DataTypes.JSON, defaultValue: [] }
}) })
Event.prototype.toAP = function (username, locale, to = []) { Event.prototype.toAP = function (username, locale, to = []) {

View file

@ -10,7 +10,7 @@ module.exports = {
*/ */
return Promise.all( return Promise.all(
[ [
await queryInterface.addColumn('events', 'locations', { type: Sequelize.JSON }), await queryInterface.addColumn('events', 'online_locations', { type: Sequelize.JSON }),
]) ])
}, },
@ -23,7 +23,7 @@ module.exports = {
*/ */
return Promise.all( return Promise.all(
[ [
await queryInterface.removeColumn('events', 'locations'), await queryInterface.removeColumn('events', 'online_locations'),
]) ])
} }
}; };