followme in export

This commit is contained in:
les 2020-02-10 00:45:51 +01:00
parent f03c23b186
commit f9e6bce0fc
6 changed files with 78 additions and 11 deletions

61
components/FollowMe.vue Normal file
View file

@ -0,0 +1,61 @@
<template lang='pug'>
div
p(v-html="$t('event.follow_me_description', { title: settings.title, account: `@${settings.instance_name}@${domain}`})")
el-input(v-model='instance_hostname' ref='instance')
a(slot='append' :href='link' target='_blank')
el-button(:disabled='(!couldGo || !proceed)' plain type="primary" icon='el-icon-document') {{$t("common.follow")}}
p.mt-2 <img class='instance_thumb' :src="instance.thumbnail"/> {{instance.title}}
</template>
<script>
import { mapState } from 'vuex'
import debounce from 'lodash/debounce'
import url from 'url'
export default {
name: 'FollowMe',
data () {
return {
instance_hostname: '',
proceed: false,
instance: {},
get_instance_info: debounce(this.getInstanceInfo, 500)
}
},
computed: {
...mapState(['settings']),
domain () {
const URL = url.parse(this.settings.baseurl)
return URL.hostname
},
couldGo () {
console.error(this.instance_hostname)
// check if is mastodon
this.get_instance_info()
return true
},
link () {
// check if exists
return `https://${this.instance_hostname}/authorize_interaction?uri=${this.settings.instance_name}@${this.domain}`
}
},
methods: {
getInstanceInfo () {
const instance_url = `https://${this.instance_hostname}/api/v1/instance`
this.$axios.$get(instance_url)
.then(ret => {
this.instance = ret
this.proceed = true
})
.catch(e => {
this.proceed = false
})
}
}
}
</script>
<style lang="less">
.instance_thumb {
height: 20px;
}
</style>

View file

@ -1,6 +1,6 @@
<template lang='pug'>
el-container#main(:class='{dark: $route.name==="index"}')
el-dialog.followDialog(:visible.sync='showFollowMe')
el-dialog(:visible.sync='showFollowMe')
h4(slot='title') {{$t('common.follow_me_title')}}
FollowMe
@ -24,7 +24,7 @@
<script>
import Nav from '~/components/Nav.vue'
import { mapState } from 'vuex'
import FollowMe from '../pages/event/followMe'
import FollowMe from '../components/FollowMe'
export default {
components: { Nav, FollowMe },

View file

@ -136,7 +136,7 @@
"from": "Dalle",
"image_too_big": "Immagine troppo grande! Massimo 4M",
"interact_with_me": "Seguimi dal fediverso",
"follow_me_description": "Tra i vari modi di rimanere aggiornati degli eventi pubblicati qui su {title},\n puoi seguire l'account <u>{account}</u> dal fediverso, ad esempio via mastodon, ed eventualmente aggiungere risorse a questo evento da lì.<br/><br/>\n Se non hai mai sentito parlare di mastodon e del fediverso ti consigliamo di leggere <a href='https://cagizero.wordpress.com/2018/10/25/cose-mastodon/'>questo articolo</a>.<br/><br/> Inserisci la tua istanza qui sotto (es. mastodon.cisti.org o mastodon.bida.im)"
"follow_me_description": "Tra i vari modi di rimanere aggiornati degli eventi pubblicati qui su {title},\n puoi seguire l'account <u>{account}</u> dal fediverso, ad esempio via mastodon, ed eventualmente aggiungere risorse ad un evento da lì.<br/><br/>\n Se non hai mai sentito parlare di mastodon e del fediverso ti consigliamo di leggere <a href='https://cagizero.wordpress.com/2018/10/25/cose-mastodon/'>questo articolo</a>.<br/><br/> Inserisci la tua istanza qui sotto (es. mastodon.cisti.org o mastodon.bida.im)"
},
"admin": {
"place_description": "Nel caso in cui un luogo sia errato o cambi indirizzo, puoi modificarlo. <br/>Considera che tutti gli eventi associati a questo luogo cambieranno indirizzo (anche quelli passati!)",

View file

@ -55,7 +55,7 @@
el-button(type='text' @click='showFollowMe=true') {{$t('event.interact_with_me')}}
span(v-if='settings.enable_resources && event.resources.length') - {{$tc('common.n_resources', event.resources.length)}}
el-dialog.followDialog(:visible.sync='showFollowMe' destroy-on-close)
el-dialog(:visible.sync='showFollowMe' destroy-on-close)
h4(slot='title') {{$t('common.follow_me_title')}}
FollowMe
@ -88,7 +88,7 @@
import { mapState, mapGetters } from 'vuex'
import EventAdmin from './eventAdmin'
import EmbedEvent from './embedEvent'
import FollowMe from './followMe'
import FollowMe from '../../components/FollowMe'
import { Message, MessageBox } from 'element-ui'
import moment from 'moment-timezone'

View file

@ -14,13 +14,16 @@
//- el-input.mt-2(v-model='notification.email' :placeholder="$t('export.insert_your_address')" ref='email')
//- el-button.mt-2.float-right(native-type= 'submit' type='success' @click='add_notification') {{$t('common.send')}}
el-tab-pane.pt-1(label='feed rss' name='rss')
el-tab-pane.pt-1(label='Feed rss' name='rss')
span(v-html='$t(`export.feed_description`)')
el-input(v-model='link')
el-button(slot='append' plain
v-clipboard:copy='link' v-clipboard:success='copyLink'
type="primary" icon='el-icon-document' ) {{$t("common.copy")}}
el-tab-pane.pt-1(:label="$t('common.fediverse')" name='fediverse')
FollowMe
el-tab-pane.pt-1(label='ics/ical' name='ics')
p(v-html='$t(`export.ical_description`)')
el-input(v-model='link')
@ -36,8 +39,7 @@
el-col.float-right(:span='12')
List(
:title='list.title'
:events='filteredEvents'
)
:events='filteredEvents')
el-input.mb-1(type='textarea' v-model='listScript' readonly )
el-button.float-right(plain v-clipboard:copy='listScript' v-clipboard:success='copyLink'
type='primary' icon='el-icon-document') {{$t('common.copy')}}
@ -54,12 +56,12 @@
<script>
import { mapState, mapGetters } from 'vuex'
import List from '@/components/List'
import Search from '@/components/Search'
import FollowMe from '../components/FollowMe'
import { Message } from 'element-ui'
export default {
name: 'Exports',
components: { List, Search },
components: { List, FollowMe },
async asyncData ({ $axios, params, store }) {
// get metadata just in case we are not coming from home
if (store.state.tags.length) { return }
@ -76,6 +78,10 @@ export default {
computed: {
...mapState(['filters', 'events', 'settings']),
...mapGetters(['filteredEvents']),
domain () {
const URL = url.parse(this.settings.baseurl)
return URL.hostname
},
listScript () {
const params = []
if (this.list.title) {

View file

@ -222,7 +222,7 @@ const eventController = {
const eventDetails = {
title: body.title,
// remove html tags
description: sanitizeHtml(body.description),
description: helpers.sanitizeHTML(body.description),
multidate: body.multidate,
start_datetime: body.start_datetime,
end_datetime: body.end_datetime,