fix filters on export

This commit is contained in:
les 2021-04-14 01:33:01 +02:00
parent 6dfa77e55a
commit 6fb73272bb
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 19 additions and 15 deletions

View file

@ -125,27 +125,31 @@ export default {
} }
if (this.filters.tags.length) { if (this.filters.tags.length) {
params.push(`tags=${this.filters.tags.map(t => t.id)}`) params.push(`tags=${this.filters.tags.join(',')}`)
} }
if (this.filters.show_recurrent) {
params.push('show_recurrent=true')
}
return `<iframe style='border: 0px; width: 100%;' src="${this.settings.baseurl}/embed/list?${params.join('&')}"></iframe>` return `<iframe style='border: 0px; width: 100%;' src="${this.settings.baseurl}/embed/list?${params.join('&')}"></iframe>`
}, },
link () { link () {
const typeMap = ['rss', 'ics', 'list'] const typeMap = ['rss', 'ics', 'list']
const tags = this.filters.tags.join(',') const params = []
const places = this.filters.places.join(',')
let query = '' if (this.filters.tags.length) {
if (tags || places) { params.push(`tags=${this.filters.tags.join(',')}`)
query = '?'
if (tags) {
query += 'tags=' + tags
if (places) { query += '&places=' + places }
} else {
query += 'places=' + places
}
} }
return `${this.settings.baseurl}/feed/${typeMap[this.type]}${query}` if (this.filters.places.length) {
params.push(`places=${this.filters.places.join(',')}`)
}
if (this.filters.show_recurrent) {
params.push('show_recurrent=true')
}
return `${this.settings.baseurl}/feed/${typeMap[this.type]}?${params.join('&')}`
}, },
showLink () { showLink () {
return (['rss', 'ics'].includes(this.type)) return (['rss', 'ics'].includes(this.type))
@ -158,7 +162,7 @@ export default {
start: dayjs().unix(), start: dayjs().unix(),
places: this.filters.places, places: this.filters.places,
tags: this.filters.tags, tags: this.filters.tags,
show_recurrent: this.filters.show_recurrent show_recurrent: !!this.filters.show_recurrent
}) })
}, },
copyLink (type) { copyLink (type) {

View file

@ -22,7 +22,7 @@ export default ({ $axios, store }, inject) => {
end: params.end, end: params.end,
places: params.places && params.places.join(','), places: params.places && params.places.join(','),
tags: params.tags && params.tags.join(','), tags: params.tags && params.tags.join(','),
show_recurrent: params.show_recurrent show_recurrent: !!params.show_recurrent
} }
}) })
return events.map(e => Object.freeze(e)) return events.map(e => Object.freeze(e))