fix ics and rss export with filters

This commit is contained in:
lesion
2019-02-26 12:37:51 +01:00
parent f40184a5a3
commit e5f2e2eeda
11 changed files with 108 additions and 43 deletions

View File

@@ -66,7 +66,7 @@ export default {
backgroundColor: '#aaffaa'
},
popover: {label: this.$t('Today')}
},
},
...this.events.map(this.eventToAttribute)
]
}

View File

@@ -1,6 +1,6 @@
<template lang="pug">
b-modal(hide-footer hide-header
@hide='$router.go(-1)' size='lg' :visible='true' v-if='type')
@hide='$router.replace("/")' size='lg' :visible='true' v-if='type')
h3.text-center Export {{type}}
b-input-group.mb-2(v-if='showLink')
b-form-input( v-model='link' autocomplete='off')
@@ -18,21 +18,43 @@
el-switch(v-model='mail.reminder' :active-text="$t('send_reminder')")
b-form-input.mt-1(v-model='mail.mail' :placeholder="$t('Insert your address')")
b-button.mt-1.float-right(variant='success' @click='activate_email') {{$t('Send')}}
b-form(v-if="type==='embed'" style='max-width: 400px;')
el-switch(v-model='export_list' :active-text="$t('export_list')")
b-card(v-if='export_list' no-body header='Eventi')
b-list-group(flush)
b-list-group-item.flex-column.align-items-start(v-for="event in filteredEvents"
:href='`/event/${event.id}`')
b-media
img(v-if='event.image_path' slot="aside" :src="imgPath(event)" alt="Media Aside" style='max-height: 60px')
small.float-right {{event.start_datetime|short_datetime}}
h5.mb-1 {{event.title}}
small.mb-1 {{event.description}}
b-badge.float-right.ml-1(v-for='tag in event.tags') {{tag.tag}}
small.float-right(v-b-popover.hover='event.place.address') {{event.place.name}}
Calendar(v-else)
</template>
<script>
import { mapState } from 'vuex'
import config from '../../config'
import path from 'path'
import filters from '../filters'
import Calendar from '@/components/Calendar'
import {intersection} from 'lodash'
export default {
name: 'Export',
components: { Calendar },
data () {
return {
type: '',
link: '',
mail: {}
mail: {},
export_list: true
}
},
filters,
mounted () {
this.type = this.$route.params.type
this.link = this.loadLink()
@@ -47,10 +69,27 @@ export default {
loadLink () {
const filters = this.filters.tags.join(',')
return `${config.apiurl}/export/${this.type}/${filters}`
}
},
imgPath (event) {
return event.image_path && config.apiurl + '/../' + event.image_path
},
},
computed: {
...mapState(['filters', 'user', 'logged']),
...mapState(['filters', 'user', 'logged', 'events']),
filteredEvents () {
if (!this.filters.tags.length && !this.filters.places.length) return this.events
return this.events.filter(e => {
if (this.filters.tags.length) {
const m = intersection(e.tags.map(t => t.tag), this.filters.tags)
if (m.length>0) return true
}
if (this.filters.places.length) {
if (this.filters.places.find(p => p === e.place.name))
return true
}
return 0
})
},
showLink () {
return (['feed', 'ics'].indexOf(this.type)>-1)
},

View File

@@ -138,8 +138,8 @@ export default {
}
},
methods: {
update (e) {
if (this.multiple && e.data === ',') {
update (e, value) {
if (this.multiple && this.search[this.search.length-1] === ',') {
this.search = this.search.substr(0, this.search.length-1)
this.hit(e)
return

View File

@@ -4,6 +4,6 @@ import Settings from '@/components/Settings'
import newEvent from '@/components/newEvent'
import eventDetail from '@/components/EventDetail'
import Home from '@/components/Home'
import Event from '@/components/event'
import Event from '@/components/Event'
module.exports = { Home, eventDetail, newEvent, Settings, Login, Register, Event }
export default { Home, eventDetail, newEvent, Settings, Login, Register, Event }