2019-04-26 23:14:43 +02:00
|
|
|
<template lang="pug">
|
2020-07-25 21:41:22 +02:00
|
|
|
v-container
|
2020-11-13 00:13:44 +01:00
|
|
|
v-card(outlined)
|
2021-01-22 23:08:26 +01:00
|
|
|
v-card-text
|
2021-01-25 09:27:54 +01:00
|
|
|
p.text-body-1 {{$t('export.intro')}}
|
2021-01-22 23:08:26 +01:00
|
|
|
v-row
|
2021-01-25 09:27:54 +01:00
|
|
|
v-col(:md='2' :cols='12')
|
|
|
|
v-card-title.py-0 {{$t('common.filter')}}
|
2021-01-22 23:08:26 +01:00
|
|
|
v-col
|
|
|
|
Search(
|
|
|
|
:filters='filters'
|
|
|
|
@update='updateFilters')
|
2020-11-13 00:13:44 +01:00
|
|
|
v-tabs(v-model='type')
|
2019-04-26 23:14:43 +02:00
|
|
|
|
2020-11-13 00:13:44 +01:00
|
|
|
//- TOFIX
|
2021-01-25 09:27:54 +01:00
|
|
|
//- v-tab {{$t('common.email')}}
|
|
|
|
//- v-tab-item
|
2021-01-22 23:08:26 +01:00
|
|
|
v-card
|
|
|
|
v-card-text
|
|
|
|
p(v-html='$t(`export.email_description`)')
|
|
|
|
v-switch.mt-0(inset :label="$t('notify_on_insert')")
|
2021-01-25 09:27:54 +01:00
|
|
|
v-switch.mt-0(inset :label="$t('morning_notification')")
|
2021-01-22 23:08:26 +01:00
|
|
|
v-text-field(v-model='notification.email' :placeholder="$t('export.insert_your_address')" ref='email')
|
2021-01-25 09:27:54 +01:00
|
|
|
v-btn(slot='prepend' text color='primary' @click='add_notification') {{$t('common.send')}} <v-icon>mdi-email</v-icon>
|
2019-04-26 23:14:43 +02:00
|
|
|
|
2020-11-13 00:13:44 +01:00
|
|
|
v-tab {{$t('common.feed')}}
|
|
|
|
v-tab-item
|
|
|
|
v-card
|
|
|
|
v-card-text
|
|
|
|
p(v-html='$t(`export.feed_description`)')
|
|
|
|
v-text-field(v-model='link' readonly)
|
2021-01-22 23:08:26 +01:00
|
|
|
v-btn(slot='prepend' text color='primary'
|
2020-11-13 00:13:44 +01:00
|
|
|
v-clipboard:copy='link'
|
2021-03-18 22:39:31 +01:00
|
|
|
v-clipboard:success='copyLink.bind(this, "feed")') {{$t("common.copy")}}
|
2020-11-13 00:13:44 +01:00
|
|
|
v-icon.ml-1 mdi-content-copy
|
2019-04-26 23:14:43 +02:00
|
|
|
|
2020-11-13 00:13:44 +01:00
|
|
|
v-tab ics/ical
|
|
|
|
v-tab-item
|
|
|
|
v-card
|
|
|
|
v-card-text
|
|
|
|
p(v-html='$t(`export.ical_description`)')
|
|
|
|
v-text-field(v-model='link')
|
2021-01-22 23:08:26 +01:00
|
|
|
v-btn(slot='prepend' text color='primary'
|
2021-03-18 22:39:31 +01:00
|
|
|
v-clipboard:copy='link' v-clipboard:success='copyLink.bind(this, "ical")') {{$t("common.copy")}}
|
2020-11-13 00:13:44 +01:00
|
|
|
v-icon.ml-1 mdi-content-copy
|
2019-04-26 23:14:43 +02:00
|
|
|
|
2020-11-13 00:13:44 +01:00
|
|
|
v-tab List
|
|
|
|
v-tab-item
|
2021-01-22 23:08:26 +01:00
|
|
|
v-card
|
|
|
|
v-card-text
|
|
|
|
p(v-html='$t(`export.list_description`)')
|
2019-04-26 23:14:43 +02:00
|
|
|
|
2021-01-22 23:08:26 +01:00
|
|
|
v-row
|
|
|
|
v-col.mr-2(:span='11')
|
|
|
|
v-text-field(v-model='list.title' :label='$t("common.title")')
|
|
|
|
v-text-field(v-model='list.maxEvents' type='number' :label='$t("common.max_events")')
|
|
|
|
v-col.float-right(:span='12')
|
|
|
|
List(
|
|
|
|
:title='list.title'
|
|
|
|
:maxEvents='list.maxEvents'
|
|
|
|
:events='events')
|
|
|
|
v-text-field.mb-1(type='textarea' v-model='listScript' readonly )
|
|
|
|
v-btn(slot='prepend' text
|
2021-03-18 22:39:31 +01:00
|
|
|
color='primary' v-clipboard:copy='listScript' v-clipboard:success='copyLink.bind(this,"list")') {{$t('common.copy')}}
|
2021-01-22 23:08:26 +01:00
|
|
|
v-icon.ml-1 mdi-content-copy
|
2019-04-26 23:14:43 +02:00
|
|
|
|
2021-05-19 16:17:48 +02:00
|
|
|
v-tab(v-if='settings.enable_federation') {{$t('common.fediverse')}}
|
|
|
|
v-tab-item(v-if='settings.enable_federation')
|
|
|
|
FollowMe
|
2021-01-25 09:27:54 +01:00
|
|
|
//- TOFIX
|
|
|
|
//- v-tab.pt-1(label='calendar' name='calendar')
|
|
|
|
//- v-tab-item
|
|
|
|
//- p(v-html='$t(`export.calendar_description`)')
|
|
|
|
//- //- no-ssr
|
|
|
|
//- Calendar.mb-1
|
|
|
|
//- v-text-field.mb-1(type='textarea' v-model='script')
|
|
|
|
//- el-button.float-right(plain type="primary" icon='el-icon-document') Copy
|
2019-04-26 23:14:43 +02:00
|
|
|
|
|
|
|
</template>
|
|
|
|
<script>
|
2020-11-13 00:13:44 +01:00
|
|
|
import dayjs from 'dayjs'
|
|
|
|
import { mapState } from 'vuex'
|
2019-04-29 00:27:29 +02:00
|
|
|
import List from '@/components/List'
|
2020-02-10 00:45:51 +01:00
|
|
|
import FollowMe from '../components/FollowMe'
|
2020-11-13 00:13:44 +01:00
|
|
|
import Search from '@/components/Search'
|
2019-04-26 23:14:43 +02:00
|
|
|
|
|
|
|
export default {
|
2020-01-15 23:46:47 +01:00
|
|
|
name: 'Exports',
|
2020-11-13 00:13:44 +01:00
|
|
|
components: { List, FollowMe, Search },
|
|
|
|
async asyncData ({ $axios, params, store, $api }) {
|
|
|
|
const events = await $api.getEvents({
|
2021-01-22 23:08:26 +01:00
|
|
|
start: dayjs().unix(),
|
|
|
|
show_recurrent: false
|
2020-11-13 00:13:44 +01:00
|
|
|
})
|
|
|
|
return { events }
|
2019-10-28 17:33:20 +01:00
|
|
|
},
|
2020-01-15 23:46:47 +01:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
type: 'rss',
|
|
|
|
notification: { email: '' },
|
2020-11-13 00:13:44 +01:00
|
|
|
list: { title: 'Gancio', maxEvents: 3 },
|
2021-01-22 23:08:26 +01:00
|
|
|
filters: { tags: [], places: [], show_recurrent: false },
|
2020-11-13 00:13:44 +01:00
|
|
|
events: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
head () {
|
|
|
|
return {
|
|
|
|
title: `${this.settings.title} - ${this.$t('common.export')}`
|
2019-09-11 19:12:24 +02:00
|
|
|
}
|
2019-05-30 12:04:14 +02:00
|
|
|
},
|
|
|
|
computed: {
|
2020-11-13 00:13:44 +01:00
|
|
|
...mapState(['settings']),
|
2020-02-10 00:45:51 +01:00
|
|
|
domain () {
|
|
|
|
const URL = url.parse(this.settings.baseurl)
|
|
|
|
return URL.hostname
|
|
|
|
},
|
2019-05-30 12:04:14 +02:00
|
|
|
listScript () {
|
|
|
|
const params = []
|
|
|
|
if (this.list.title) {
|
|
|
|
params.push(`title=${this.list.title}`)
|
|
|
|
}
|
2019-05-30 12:12:51 +02:00
|
|
|
|
2019-06-11 17:44:11 +02:00
|
|
|
if (this.filters.places.length) {
|
2020-01-21 01:24:10 +01:00
|
|
|
params.push(`places=${this.filters.places.map(p => p.id)}`)
|
2019-05-30 12:12:51 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 17:44:11 +02:00
|
|
|
if (this.filters.tags.length) {
|
2021-04-14 01:33:01 +02:00
|
|
|
params.push(`tags=${this.filters.tags.join(',')}`)
|
2019-06-11 17:44:11 +02:00
|
|
|
}
|
|
|
|
|
2021-04-14 01:33:01 +02:00
|
|
|
if (this.filters.show_recurrent) {
|
|
|
|
params.push('show_recurrent=true')
|
|
|
|
}
|
2019-07-05 01:38:31 +02:00
|
|
|
return `<iframe style='border: 0px; width: 100%;' src="${this.settings.baseurl}/embed/list?${params.join('&')}"></iframe>`
|
2019-05-30 12:04:14 +02:00
|
|
|
},
|
|
|
|
link () {
|
2021-01-11 00:17:56 +01:00
|
|
|
const typeMap = ['rss', 'ics', 'list']
|
2021-04-14 01:33:01 +02:00
|
|
|
const params = []
|
|
|
|
|
|
|
|
if (this.filters.tags.length) {
|
|
|
|
params.push(`tags=${this.filters.tags.join(',')}`)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.filters.places.length) {
|
|
|
|
params.push(`places=${this.filters.places.join(',')}`)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.filters.show_recurrent) {
|
|
|
|
params.push('show_recurrent=true')
|
2019-04-26 23:14:43 +02:00
|
|
|
}
|
|
|
|
|
2021-04-14 01:33:01 +02:00
|
|
|
return `${this.settings.baseurl}/feed/${typeMap[this.type]}?${params.join('&')}`
|
2019-06-21 23:52:18 +02:00
|
|
|
},
|
2019-04-26 23:14:43 +02:00
|
|
|
showLink () {
|
2019-09-17 18:16:59 +02:00
|
|
|
return (['rss', 'ics'].includes(this.type))
|
2019-09-11 19:12:24 +02:00
|
|
|
}
|
2020-01-15 23:46:47 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2021-01-22 23:08:26 +01:00
|
|
|
async updateFilters (filters) {
|
2020-11-13 00:13:44 +01:00
|
|
|
this.filters = filters
|
2021-01-22 23:08:26 +01:00
|
|
|
this.events = await this.$api.getEvents({
|
|
|
|
start: dayjs().unix(),
|
|
|
|
places: this.filters.places,
|
|
|
|
tags: this.filters.tags,
|
2021-04-14 01:33:01 +02:00
|
|
|
show_recurrent: !!this.filters.show_recurrent
|
2021-01-22 23:08:26 +01:00
|
|
|
})
|
2020-11-13 00:13:44 +01:00
|
|
|
},
|
2021-03-18 22:39:31 +01:00
|
|
|
copyLink (type) {
|
|
|
|
if (type === 'feed') {
|
|
|
|
this.$root.$message('common.feed_url_copied')
|
|
|
|
} else {
|
|
|
|
this.$root.$message('common.copied')
|
|
|
|
}
|
2020-01-15 23:46:47 +01:00
|
|
|
},
|
2021-01-25 09:27:54 +01:00
|
|
|
async add_notification () {
|
|
|
|
// validate()
|
|
|
|
// if (!this.notification.email) {
|
|
|
|
// Message({ message: 'Inserisci una mail', showClose: true, type: 'error' })
|
|
|
|
// return this.$refs.email.focus()
|
|
|
|
// }
|
2021-03-18 22:39:31 +01:00
|
|
|
// await api.addNotification({ ...this.notification, filters: this.filters})
|
2020-01-15 23:46:47 +01:00
|
|
|
// this.$refs.modal.hide()
|
2020-07-25 21:41:22 +02:00
|
|
|
// Message({ message: this.$t('email_notification_activated'), showClose: true, type: 'success' })
|
2020-01-15 23:46:47 +01:00
|
|
|
},
|
|
|
|
imgPath (event) {
|
|
|
|
return event.image_path && event.image_path
|
|
|
|
}
|
2019-04-26 23:14:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|