refactoring online events

This commit is contained in:
lesion
2023-04-05 16:14:55 +02:00
parent 121af4872d
commit 8c8103a5ee
12 changed files with 139 additions and 165 deletions

View File

@@ -1,6 +1,7 @@
<template lang="pug"> <template lang="pug">
v-row.mb-4 v-row.mb-4
v-col(cols=12 md=6) v-col(cols=12 md=6)
//- this is the name used by people
v-combobox(ref='place' v-combobox(ref='place'
:rules="[$validators.required('common.where')]" :rules="[$validators.required('common.where')]"
:label="$t('common.where')" :label="$t('common.where')"
@@ -18,6 +19,8 @@ v-row.mb-4
v-list-item(v-bind='attrs' v-on='on') v-list-item(v-bind='attrs' v-on='on')
v-list-item-content(two-line v-if='item.create') v-list-item-content(two-line v-if='item.create')
v-list-item-title <v-icon color='primary' v-text='mdiPlus' :aria-label='$t("common.add")'></v-icon> {{$t('common.add')}} <strong>{{item.name}}</strong> v-list-item-title <v-icon color='primary' v-text='mdiPlus' :aria-label='$t("common.add")'></v-icon> {{$t('common.add')}} <strong>{{item.name}}</strong>
v-list-item-content(two-line v-else-if='item.online')
v-list-item-title <v-icon color='primary' v-text='mdiLaptopAccount' :aria-label='$t("common.online")'></v-icon> {{$t('common.online')}}
v-list-item-content(two-line v-else) v-list-item-content(two-line v-else)
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')
@@ -34,14 +37,14 @@ v-row.mb-4
:label="$t('common.address')" :label="$t('common.address')"
:hint="$t('event.address_description')" :hint="$t('event.address_description')"
persistent-hint) persistent-hint)
template(v-slot:append v-if="!hideWhereInputAdvancedDialogButton") template(v-slot:append v-if="showAdvancedDialogButton")
v-icon(v-text='mdiCog' :disabled='!(value.name && settings.allow_event_also_online) && !(value.isNew && settings.allow_geolocation)' v-icon(v-text='mdiCog'
@click="whereInputAdvancedDialog = true") @click="whereInputAdvancedDialog = true")
v-combobox.mr-4(v-model="onlineLocations" v-if="settings.allow_event_only_online && value.name === 'online'" v-combobox.mr-4(v-model="onlineLocations" v-else
:prepend-icon='mdiLink' :prepend-icon='mdiLink'
:hint="$t('event.online_locations_help')" :hint="$t('event.online_locations_help')"
:label="$t('event.online_locations_url')" :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="onlineLocations" :items="onlineLocations"
@@ -50,24 +53,21 @@ v-row.mb-4
v-chip(v-bind="attrs" :outlined='index !== 0' v-chip(v-bind="attrs" :outlined='index !== 0'
close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)' close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)'
:input-value="selected" label small) {{ item }} :input-value="selected" label small) {{ item }}
template(v-slot:append) //- template(v-slot:append)
v-icon(v-text='mdiCog' :disabled='!value.name' @click="whereInputAdvancedDialog = true") //- 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' 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()'
:onlineLocations.sync="onlineLocations" :onlineLocations.sync="onlineLocations"
:event_only_online_value.sync='event_only_online' @update:onlineLocations="selectLocations")
@update:onlineEvent="changeEventOnlyOnline"
@update:onlineLocations="selectLocations"
)
</template> </template>
<script> <script>
import { mdiMap, mdiMapMarker, mdiPlus, mdiCog, mdiLink, mdiCloseCircle } from '@mdi/js' import { mdiMap, mdiMapMarker, mdiPlus, mdiCog, mdiLink, mdiCloseCircle, mdiLaptopAccount } from '@mdi/js'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
import get from 'lodash/get'
import WhereInputAdvanced from './WhereInputAdvanced.vue' import WhereInputAdvanced from './WhereInputAdvanced.vue'
export default { export default {
@@ -79,38 +79,45 @@ export default {
components: { WhereInputAdvanced }, components: { WhereInputAdvanced },
data ( {$store} ) { data ( {$store} ) {
return { return {
mdiMap, mdiMapMarker, mdiPlus, mdiCog, mdiLink, mdiCloseCircle, mdiMap, mdiMapMarker, mdiPlus, mdiCog, mdiLink, mdiCloseCircle, mdiLaptopAccount,
places: [], places: [],
place: { }, place: { },
placeName: '', placeName: '',
disableAddress: true, disableAddress: true,
whereInputAdvancedDialog: false, whereInputAdvancedDialog: false,
hideWhereInputAdvancedDialogButton: !$store.state.settings.allow_event_also_online && !$store.state.settings.allow_geolocation,
onlineLocations: this.event.online_locations || [], onlineLocations: this.event.online_locations || [],
event_only_online: (this.value.name === 'online') ? true : false,
whereAdvancedId: 1
} }
}, },
computed: { computed: {
...mapState(['settings']), ...mapState(['settings']),
filteredPlaces () { showAdvancedDialogButton () {
if (!this.placeName) { return this.places }
const placeName = this.placeName.trim().toLowerCase() if (!(this.settings.allow_geolocation || this.settings.allow_online_event)) {
let nameMatch = false return false
const matches = this.places.filter(p => { }
const tmpName = p.name.toLowerCase()
const tmpAddress = p.address.toLowerCase()
if (tmpName.includes(placeName)) { if (!this.place.isNew && !this.settings.allow_online_event) return false
if (tmpName === placeName) { nameMatch = true }
return true return true
} }
return tmpAddress.includes(placeName) // filteredPlaces () {
}) // if (!this.placeName) { return this.places }
if (!nameMatch) { // const placeName = this.placeName.trim().toLowerCase()
matches.unshift({ create: true, name: this.placeName }) // let nameMatch = false
} // const matches = this.places.filter(p => {
return matches // const tmpName = p.name.toLowerCase()
} // const tmpAddress = p.address.toLowerCase()
// if (tmpName.includes(placeName)) {
// if (tmpName === placeName) { nameMatch = true }
// return true
// }
// return tmpAddress.includes(placeName)
// })
// if (!nameMatch) {
// matches.unshift({ create: true, name: this.placeName })
// }
// return matches
// }
}, },
mounted () { mounted () {
this.$nextTick( () => { this.$nextTick( () => {
@@ -120,28 +127,32 @@ export default {
methods: { methods: {
search: debounce(async function(ev) { search: debounce(async function(ev) {
const search = ev ? ev.target.value.trim().toLowerCase() : '' const search = ev ? ev.target.value.trim().toLowerCase() : ''
this.places = await this.$axios.$get(`place?search=${search}`) this.places = await this.$axios.$get('place', { params: { search } })
// Filter out the place with name 'online' if not allowed // Filter out the place with name 'online' if not allowed
if (this.places.length && !this.settings.allow_event_only_online) { if (this.places.length) {
this.places = this.places.filter(p => p.name !== 'online') this.places = this.places.filter(p => p.name !== 'online')
} }
if (this.settings.allow_online_event) {
this.places.push({ online: true, name: 'online' })
}
if (!search && this.places.length) { if (!search && this.places.length) {
return this.places return this.places
} }
const matches = this.places.filter(p => p.name !== 'online').find(p => search === p.name.toLocaleLowerCase()) const matches = this.places.find(p => search === p.name.toLocaleLowerCase())
if (!matches && search) { if (!matches && search) {
this.places.unshift({ create: true, name: ev.target.value.trim() }) this.places.unshift({ create: true, name: ev.target.value.trim() })
} }
}, 200), }, 200),
selectPlace (p) { selectPlace (p) {
// force online events under place: online address: online // force online events under place: online address: online
this.event_only_online = false // this.event_only_online = false
this.place.isNew = false this.place.isNew = false
this.whereAdvancedId++ // this.whereAdvancedId++
if (!p) { return } if (!p) { return }
if (typeof p === 'object' && !p.create) { if (typeof p === 'object' && !p.create && !p.online) {
if (p.id === this.value.id) return if (p.id === this.value.id) return
this.place.name = p.name this.place.name = p.name
this.place.address = p.address this.place.address = p.address
@@ -150,9 +161,9 @@ export default {
this.place.longitude = p.longitude this.place.longitude = p.longitude
} }
this.place.id = p.id this.place.id = p.id
if (this.settings.allow_event_only_online && this.place.name === 'online') { // if (this.settings.allow_event_only_online && this.place.name === 'online') {
this.event_only_online = true // this.event_only_online = true
} // }
this.disableAddress = true this.disableAddress = true
} else { // this is a new place } else { // this is a new place
this.place.isNew = true this.place.isNew = true
@@ -173,15 +184,15 @@ export default {
this.place.longitude = p.longitude this.place.longitude = p.longitude
} }
// If 'event only online' is not allowed: reset place and online_locations // If 'event only online' is not allowed: reset place and online_locations
if (this.place.name === 'online') { // if (this.place.name === 'online') {
if (!this.settings.allow_event_only_online) { // if (!this.settings.allow_event_only_online) {
this.$nextTick(() => { this.$refs.place && this.$refs.place.setValue('') && this.$refs.place.focus() }) // this.$nextTick(() => { this.$refs.place && this.$refs.place.setValue('') && this.$refs.place.focus() })
this.event.online_locations = [] // this.event.online_locations = []
return // return
} else { // } else {
this.event_online_only = true // this.event_online_only = true
} // }
} // }
this.disableAddress = false this.disableAddress = false
this.$refs.place.blur() this.$refs.place.blur()
this.$nextTick(() => { this.$refs.address && this.$refs.address.focus() }) this.$nextTick(() => { this.$refs.address && this.$refs.address.focus() })
@@ -206,18 +217,18 @@ export default {
}) })
} }
}, },
changeEventOnlyOnline(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 = ''; this.onlineLocations = [] } // 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 onlineLocations // // Update onlineLocations
this.event.online_locations && this.selectLocations() // this.event.online_locations && this.selectLocations()
this.$emit('input', { ...this.place }) // this.$emit('input', { ...this.place })
}, // },
} }
} }
</script> </script>

View File

@@ -3,30 +3,8 @@ v-card
v-card-title {{ $t('event.where_advanced_options') }} v-card-title {{ $t('event.where_advanced_options') }}
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='showGeocoded')
v-switch.mt-0.mb-0(v-model='event_only_online_update' v-combobox(ref='geocodedAddress'
v-if='settings.allow_event_only_online'
persistent-hint
:label="$t('event.event_only_online_label')")
v-combobox.mt-0.mb-0.mr-4.my-5(v-model="onlineLocations_update"
v-if="place.name !== 'online' && settings.allow_event_also_online"
:prepend-icon='mdiLink'
:hint="$t('event.online_locations_help')"
:label="$t('event.online_locations')"
clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
:delimiters="[',', ';', '; ']"
:items="onlineLocations_update")
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 }}
v-divider(v-if='showGeocoded && showOnline')
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-focus
:prepend-icon='mdiMapSearch' :prepend-icon='mdiMapSearch'
@input.native='searchAddress' @input.native='searchAddress'
:label="$t('common.search_coordinates')" :label="$t('common.search_coordinates')"
@@ -63,7 +41,23 @@ v-card
:rules="$validators.longitude") :rules="$validators.longitude")
p.mt-4(v-if='place.isNew' v-html="$t('event.address_geocoded_disclaimer')") p.mt-4(v-if='place.isNew' v-html="$t('event.address_geocoded_disclaimer')")
MapEdit.mt-4(:place='place' :key='mapEdit' v-if="(settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude)" ) MapEdit.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')
v-card-text.mt-6(v-if='settings.allow_online_event')
v-combobox(v-model="onlineLocations_update"
:prepend-icon='mdiLink'
:hint="$t('event.online_locations_help')"
:label="$t('event.online_locations')"
clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
:delimiters="[',', ';']"
:items="onlineLocations_update")
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 }}
v-card-actions v-card-actions
v-spacer v-spacer
@@ -75,7 +69,6 @@ import { mdiMap, mdiLatitude, mdiLongitude, mdiCog, mdiLink, mdiCloseCircle, mdi
mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant } from '@mdi/js' mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant } from '@mdi/js'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
import get from 'lodash/get'
import geolocation from '../server/helpers/geolocation/index' import geolocation from '../server/helpers/geolocation/index'
export default { export default {
@@ -83,7 +76,6 @@ export default {
props: { props: {
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 },
onlineLocations: { type: Array, default: [] } onlineLocations: { type: Array, default: [] }
}, },
components: { components: {
@@ -93,18 +85,13 @@ export default {
return { return {
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,
showGeocoded: $store.state.settings.allow_geolocation && this.place.name !== 'online',
disableGeocoded: this.place.name === 'online' || !this.place.isNew,
event_only_online: this.place.name === 'online',
mapEdit: 1,
addressList: [], addressList: [],
loading: false, loading: false,
iconsMapper: { iconsMapper: {
'mdiHome': mdiHome, mdiHome,
'mdiRoadVariant': mdiRoadVariant, mdiRoadVariant,
'mdiMapMarker': mdiMapMarker, mdiMapMarker,
'mdiCityVariant': mdiCityVariant mdiCityVariant
}, },
currentGeocodingProvider: geolocation.getGeocodingProvider($store.state.settings.geocoding_provider_type), currentGeocodingProvider: geolocation.getGeocodingProvider($store.state.settings.geocoding_provider_type),
prevAddress: '' prevAddress: ''
@@ -112,12 +99,8 @@ export default {
}, },
computed: { computed: {
...mapState(['settings']), ...mapState(['settings']),
event_only_online_update: { showGeocoded () {
get () { return this.event_only_online_value }, return this.settings.allow_geolocation && this.place.name !== 'online' && this.place.isNew
set (value) {
this.$emit('update:onlineEvent', value)
this.close()
}
}, },
onlineLocations_update: { onlineLocations_update: {
get () { return this.onlineLocations }, get () { return this.onlineLocations },
@@ -155,7 +138,6 @@ export default {
} else { } else {
this.place.latitude = this.place.longitude = null this.place.latitude = this.place.longitude = null
} }
this.mapEdit++
this.prevAddress = v.address this.prevAddress = v.address
}, },
} }

View File

@@ -52,18 +52,14 @@ v-container
inset inset
:label="$t('admin.recurrent_event_visible')") :label="$t('admin.recurrent_event_visible')")
v-switch.mt-1(v-model='allow_online_event'
inset
:label="$t('admin.allow_online_event')")
v-switch.mt-1(v-model='allow_geolocation' v-switch.mt-1(v-model='allow_geolocation'
inset inset
:label="$t('admin.allow_geolocation')") :label="$t('admin.allow_geolocation')")
v-switch.mt-1(v-model='allow_event_only_online'
inset
:label="$t('admin.allow_event_only_online')")
v-switch.mt-1(v-model='allow_event_also_online'
inset
:label="$t('admin.allow_event_also_online')")
v-dialog(v-model='showSMTP' destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly') v-dialog(v-model='showSMTP' destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly')
SMTP(@close='showSMTP = false') SMTP(@close='showSMTP = false')
@@ -134,17 +130,9 @@ export default {
get () { return this.settings.allow_geolocation }, get () { return this.settings.allow_geolocation },
set (value) { this.setSetting({ key: 'allow_geolocation', value }) } set (value) { this.setSetting({ key: 'allow_geolocation', value }) }
}, },
allow_event_only_online: { allow_online_event: {
get () { return this.settings.allow_event_only_online }, get () { return this.settings.allow_online_event },
set (value) { this.setSetting({ key: 'allow_event_only_online', value }) set (value) { this.setSetting({ key: 'allow_online_event', value }) }
if (value == true) { this.allow_event_also_online = value }
}
},
allow_event_also_online: {
get () { return this.settings.allow_event_also_online },
set (value) { this.setSetting({ key: 'allow_event_also_online', value })
if (value == false) { this.setSetting({ key: 'allow_event_only_online', value }) }
}
}, },
filteredTimezones () { filteredTimezones () {
const current_timezone = DateTime.local().zoneName const current_timezone = DateTime.local().zoneName

View File

@@ -101,7 +101,8 @@
"recurring_event_actions": "Recurring event actions", "recurring_event_actions": "Recurring event actions",
"latitude": "Latitude", "latitude": "Latitude",
"longitude": "Longitude", "longitude": "Longitude",
"search_coordinates": "Search coordinates" "search_coordinates": "Search coordinates",
"online": "On-line"
}, },
"login": { "login": {
"description": "By logging in you can publish new events.", "description": "By logging in you can publish new events.",
@@ -143,7 +144,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": "Search tiping the address. (<a href='http://osm.org/copyright'>OpenStreetMap</a> contributors)", "address_description_osm": "Search coordinates by typing 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?",
@@ -184,12 +185,8 @@
"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", "where_advanced_options_description": "Define here additional place properties",
"event_only_online": "Online event",
"event_only_online_label": "The event is only online",
"event_also_online": "Partecipate remotely",
"online_locations": "Online locations", "online_locations": "Online locations",
"online_locations_help": "For instance a url to a videconference room, and a fallback url (max. 3)", "online_locations_help": "For instance an url to a videconference room and a fallback url (max. 3)",
"online_locations_url": "Online locations",
"online_locations_fallback_urls": "Fallback links", "online_locations_fallback_urls": "Fallback links",
"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> " "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> "
}, },
@@ -209,6 +206,8 @@
"allow_anon_event": "Allow anonymous events (has to be confirmed)?", "allow_anon_event": "Allow anonymous events (has to be confirmed)?",
"allow_multidate_event": "Allow multi-day events", "allow_multidate_event": "Allow multi-day events",
"allow_recurrent_event": "Allow recurring events", "allow_recurrent_event": "Allow recurring events",
"allow_online_event": "Allow online events",
"allow_online_event_hint": "Ask for urls ",
"allow_geolocation": "Allow events geolocation", "allow_geolocation": "Allow events geolocation",
"recurrent_event_visible": "Show recurring events by default", "recurrent_event_visible": "Show recurring events by default",
"federation": "Federation / ActivityPub", "federation": "Federation / ActivityPub",
@@ -308,8 +307,6 @@
"tilelayer_test_success": "The tilelayer service at {service_name} is working", "tilelayer_test_success": "The tilelayer service at {service_name} is working",
"tilelayer_test_error": "The tilelayer service is not reachable at {service_name}", "tilelayer_test_error": "The tilelayer service is not reachable at {service_name}",
"geolocation": "Geolocation", "geolocation": "Geolocation",
"allow_event_only_online": "Allow event only online",
"allow_event_also_online": "Allow event also online",
"colors": "Colors" "colors": "Colors"
}, },
"auth": { "auth": {

View File

@@ -141,6 +141,7 @@ export default {
data.event.media = event.media || [] data.event.media = event.media || []
data.event.parentId = event.parentId data.event.parentId = event.parentId
data.event.recurrent = event.recurrent data.event.recurrent = event.recurrent
data.event.online_locations = event.online_locations
return data return data
} }
return {} return {}
@@ -233,7 +234,7 @@ export default {
formData.append('place_id', this.event.place.id) formData.append('place_id', this.event.place.id)
} }
formData.append('place_name', this.event.place.name.trim()) formData.append('place_name', this.event.place.name.trim())
formData.append('place_address', this.event.place.address) formData.append('place_address', this.event.place.address || null)
if (this.settings.allow_geolocation) { if (this.settings.allow_geolocation) {
formData.append('place_latitude', this.event.place.latitude || '') formData.append('place_latitude', this.event.place.latitude || '')

View File

@@ -17,17 +17,17 @@ v-container#event.pa-2.pa-sm-2(itemscope itemtype="https://schema.org/Event" v-t
strong.p-name.text--primary(itemprop="name") {{event.title}} strong.p-name.text--primary(itemprop="name") {{event.title}}
v-divider v-divider
v-container.eventDetails v-container.eventDetails
time.dt-start(:datetime='$time.unixFormat(event.start_datetime, "yyyy-MM-dd HH:mm")' itemprop="startDate" :content="$time.unixFormat(event.start_datetime, \"yyyy-MM-dd'T'HH:mm\")") time.dt-start(:datetime='$time.unixFormat(event.start_datetime, "yyyy-MM-dd HH:mm")' itemprop="startDate" :content='$time.unixFormat(event.start_datetime, "yyyy-MM-dd\'T\'HH:mm")')
v-icon(v-text='mdiCalendar' small) v-icon(v-text='mdiCalendar' small)
strong.ml-2.text-uppercase {{$time.when(event)}} strong.ml-2.text-uppercase {{$time.when(event)}}
.d-none.dt-end(v-if='event.end_datetime' itemprop="endDate" :content="$time.unixFormat(event.end_datetime,\"yyyy-MM-dd'T'HH:mm\")") {{$time.unixFormat(event.end_datetime,"yyyy-MM-dd'T'HH:mm")}} .d-none.dt-end(v-if='event.end_datetime' itemprop="endDate" :content='$time.unixFormat(event.end_datetime,"yyyy-MM-dd\'T\'HH:mm")') {{$time.unixFormat(event.end_datetime,"yyyy-MM-dd'T'HH:mm")}}
div.font-weight-light.mb-3 {{$time.from(event.start_datetime)}} div.font-weight-light.mb-3 {{$time.from(event.start_datetime)}}
small(v-if='event.parentId') ({{$time.recurrentDetail(event)}}) small(v-if='event.parentId') ({{$time.recurrentDetail(event)}})
.p-location.h-adr(itemprop="location" itemscope itemtype="https://schema.org/Place") .p-location.h-adr(itemprop="location" itemscope itemtype="https://schema.org/Place")
v-icon(v-text='mdiMapMarker' small) v-icon(v-text='mdiMapMarker' small)
nuxt-link.vcard.ml-2.p-name.text-decoration-none.text-uppercase(itemprop="name" :to='`/place/${encodeURIComponent(event.place.name)}`') {{event.place && event.place.name}} nuxt-link.vcard.ml-2.p-name.text-decoration-none.text-uppercase(itemprop="name" :to='`/place/${encodeURIComponent(event.place.name)}`') {{event.place && event.place.name}}
.font-weight-light.p-street-address(itemprop='address') {{event.place && event.place.address}} .font-weight-light.p-street-address(v-if='event.place.name !=="online"' itemprop='address') {{event.place && event.place.address}}
//- tags, hashtags //- tags, hashtags
v-container.pt-0(v-if='event.tags && event.tags.length') v-container.pt-0(v-if='event.tags && event.tags.length')
@@ -35,20 +35,13 @@ v-container#event.pa-2.pa-sm-2(itemscope itemtype="https://schema.org/Event" v-t
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.online_locations && event.online_locations.length') //- v-divider(v-if='hasOnlineLocations')
div(v-if='onlineSectionEnabled && event.online_locations && event.online_locations.length') v-list(nav dense v-if='hasOnlineLocations')
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(v-for='(item, index) in event.online_locations' target='_blank' :href="`${item}`" :key="index")
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(v-text='mdiMonitorAccount')
v-list-item-content.py-0 v-list-item-content.py-0
v-list-item-title.text-caption(v-text='`${event.online_locations[0]}`') v-list-item-title.text-caption(v-text='item')
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-list-item
v-list-item-content
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-divider v-divider
//- info & actions //- info & actions
@@ -92,7 +85,7 @@ v-container#event.pa-2.pa-sm-2(itemscope itemtype="https://schema.org/Event" v-t
v-list-item-content v-list-item-content
v-list-item-title(v-text="$t('event.download_flyer')") v-list-item-title(v-text="$t('event.download_flyer')")
v-divider v-divider(v-if='is_mine')
//- admin actions //- admin actions
eventAdmin(v-if='is_mine' :event='event') eventAdmin(v-if='is_mine' :event='event')
@@ -229,8 +222,7 @@ export default {
showEmbed: false, showEmbed: false,
showResources: false, showResources: false,
selectedResource: { data: { attachment: [] } }, selectedResource: { data: { attachment: [] } },
mapModal: false, mapModal: false
onlineSectionEnabled: $store.state.settings.allow_event_only_online || $store.state.settings.allow_event_also_online
} }
}, },
head () { head () {
@@ -311,6 +303,12 @@ export default {
}, },
computed: { computed: {
...mapState(['settings']), ...mapState(['settings']),
hasOnlineLocations () {
return this.event.online_locations && this.event.online_locations.length
},
showMap () {
return this.settings.allow_geolocation && this.event.place.latitude && this.event.place.longitude
},
hasMedia () { hasMedia () {
return this.event.media && this.event.media.length return this.event.media && this.event.media.length
}, },

View File

@@ -3,10 +3,10 @@
<h1 class='d-block text-h4 font-weight-black text-center text-uppercase mt-10 mx-auto w-100 text-underline'> <h1 class='d-block text-h4 font-weight-black text-center text-uppercase mt-10 mx-auto w-100 text-underline'>
<u>{{ place.name }}</u> <u>{{ place.name }}</u>
</h1> </h1>
<span class="d-block text-subtitle text-center w-100 mb-14">{{ place.address }}</span> <span v-if='place.name!=="online"' class="d-block text-subtitle text-center w-100">{{ place.address }}</span>
<!-- Events --> <!-- Events -->
<div id="events"> <div id="events" class='mt-14'>
<v-lazy class='event v-card' :value='idx<9' v-for='(event, idx) in events' :key='event.id' :min-height='hide_thumbs ? 105 : undefined' :options="{ threshold: .5, rootMargin: '500px' }" :class="{ 'theme--dark': is_dark }"> <v-lazy class='event v-card' :value='idx<9' v-for='(event, idx) in events' :key='event.id' :min-height='hide_thumbs ? 105 : undefined' :options="{ threshold: .5, rootMargin: '500px' }" :class="{ 'theme--dark': is_dark }">
<Event :event='event' :lazy='idx > 9' /> <Event :event='event' :lazy='idx > 9' />
</v-lazy> </v-lazy>

View File

@@ -31,14 +31,14 @@ const eventController = {
const place_name = body.place_name && body.place_name.trim() const place_name = body.place_name && body.place_name.trim()
const place_address = body.place_address && body.place_address.trim() const place_address = body.place_address && body.place_address.trim()
if (!place_address || !place_name) { if (!place_name || !place_address && place_name !== 'online') {
throw new Error(`place_id or place_name and place_address are required`) throw new Error(`place_id or place_name and place_address are required`)
} }
let place = await Place.findOne({ where: Sequelize.where(Sequelize.fn('LOWER', Sequelize.col('name')), Sequelize.Op.eq, place_name.toLocaleLowerCase()) }) let place = await Place.findOne({ where: Sequelize.where(Sequelize.fn('LOWER', Sequelize.col('name')), Sequelize.Op.eq, place_name.toLocaleLowerCase()) })
if (!place) { if (!place) {
place = await Place.create({ place = await Place.create({
name: place_name, name: place_name,
address: place_address, address: place_address || '',
latitude: Number(body.place_latitude) || null, latitude: Number(body.place_latitude) || null,
longitude: Number(body.place_longitude) || null longitude: Number(body.place_longitude) || null
}) })

View File

@@ -27,9 +27,8 @@ const defaultSettings = {
allow_anon_event: true, allow_anon_event: true,
allow_multidate_event: true, allow_multidate_event: true,
allow_recurrent_event: false, allow_recurrent_event: false,
allow_online_event: true,
recurrent_event_visible: false, recurrent_event_visible: false,
allow_event_only_online: false,
allow_event_also_online: false,
allow_geolocation: false, allow_geolocation: false,
geocoding_provider_type: 'Nominatim', geocoding_provider_type: 'Nominatim',
geocoding_provider: 'https://nominatim.openstreetmap.org/search', geocoding_provider: 'https://nominatim.openstreetmap.org/search',

View File

@@ -79,6 +79,7 @@ module.exports = {
allow_anon_event: settings.allow_anon_event, allow_anon_event: settings.allow_anon_event,
allow_recurrent_event: settings.allow_recurrent_event, allow_recurrent_event: settings.allow_recurrent_event,
allow_multidate_event: settings.allow_multidate_event, allow_multidate_event: settings.allow_multidate_event,
allow_online_event: settings.allow_online_event,
recurrent_event_visible: settings.recurrent_event_visible, recurrent_event_visible: settings.recurrent_event_visible,
enable_federation: settings.enable_federation, enable_federation: settings.enable_federation,
enable_resources: settings.enable_resources, enable_resources: settings.enable_resources,
@@ -99,8 +100,6 @@ module.exports = {
tilelayer_provider_attribution: settings.tilelayer_provider_attribution, tilelayer_provider_attribution: settings.tilelayer_provider_attribution,
footerLinks: settings.footerLinks, footerLinks: settings.footerLinks,
about: settings.about, about: settings.about,
allow_event_only_online: settings.allow_event_only_online,
allow_event_also_online: settings.allow_event_also_online
} }
next() next()
}, },

View File

@@ -10,10 +10,9 @@ export const state = () => ({
allow_anon_event: true, allow_anon_event: true,
allow_multidate_event: true, allow_multidate_event: true,
allow_recurrent_event: true, allow_recurrent_event: true,
recurrent_event_visible: false, allow_online_event: true,
allow_event_only_online: false,
allow_event_also_online: false,
allow_geolocation: false, allow_geolocation: false,
recurrent_event_visible: false,
geocoding_provider_type: '', geocoding_provider_type: '',
geocoding_provider: '', geocoding_provider: '',
geocoding_countrycodes: [], geocoding_countrycodes: [],

View File

@@ -113,7 +113,7 @@
</div> </div>
<span class="place" <span class="place"
>@{event.place.name} >@{event.place.name}
<span class="subtitle"> {event.place.address}</span></span {#if event.place.name!=="online"}<span class="subtitle"> {event.place.address}</span>{/if}</span
> >
{#if event.tags.length} {#if event.tags.length}
<div class="tags"> <div class="tags">