mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
fix: online_locations and hide/show address in edit mode
online_locations are not removed, and fix limit via gui to max 3 urls. In edit mode if event is online do not show address field with null value
This commit is contained in:
parent
319d546336
commit
684547cb8b
2 changed files with 13 additions and 14 deletions
|
@ -56,9 +56,7 @@ v-row.mb-4
|
|||
|
||||
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()'
|
||||
:onlineLocations.sync="onlineLocations"
|
||||
@update:onlineLocations="selectLocations")
|
||||
@close='whereInputAdvancedDialog = false && this.$refs.address.blur()')
|
||||
|
||||
|
||||
</template>
|
||||
|
@ -90,7 +88,7 @@ export default {
|
|||
computed: {
|
||||
...mapState(['settings']),
|
||||
isOnLine () {
|
||||
return this.settings.allow_online_event && this.place.name === 'online'
|
||||
return this.settings.allow_online_event && this.value.name === 'online'
|
||||
},
|
||||
showAdvancedDialogButton () {
|
||||
|
||||
|
@ -183,17 +181,16 @@ export default {
|
|||
this.event.online_locations = []
|
||||
|
||||
if (this.onlineLocations) {
|
||||
// Insert up to 3 online location: the main one and 2 fallback
|
||||
if (this.onlineLocations.length > 3) {
|
||||
this.$nextTick(() => this.onlineLocations = this.onlineLocations.slice(0, 3))
|
||||
}
|
||||
// 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]
|
||||
if (!item.startsWith('http')) { item = `https://${item}` }
|
||||
this.onlineLocations[i] = item
|
||||
})
|
||||
// Remove duplicates
|
||||
this.onlineLocations = [...new Set(this.onlineLocations)]
|
||||
// Insert up to 3 online location: the main one and 2 fallback
|
||||
this.onlineLocations = this.onlineLocations.slice(0, 3)
|
||||
|
||||
this.event.online_locations = this.onlineLocations
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -244,8 +244,10 @@ export default {
|
|||
formData.append('place_longitude', this.event.place.longitude || '')
|
||||
}
|
||||
|
||||
if (this.event.online_locations) {
|
||||
if (this.event.online_locations.length) {
|
||||
this.event.online_locations.forEach(l => formData.append('online_locations[]', l))
|
||||
} else {
|
||||
formData.append('online_locations', [])
|
||||
}
|
||||
|
||||
formData.append('description', this.event.description)
|
||||
|
|
Loading…
Reference in a new issue