mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
cleaning export
This commit is contained in:
parent
c41c930f70
commit
95e473d531
12 changed files with 134 additions and 112 deletions
|
@ -1,3 +1,8 @@
|
|||
html, body {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: orange;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-left: 10px;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<template lang='pug'>
|
||||
v-card(color='secondary')
|
||||
v-card(:color='isDialog ? "secondary" : null')
|
||||
v-card-title(v-text="$t('common.follow_me_title')")
|
||||
v-card-text
|
||||
p(v-html="$t('event.follow_me_description', { title: settings.title, account: `@${settings.instance_name}@${domain}`})")
|
||||
|
@ -22,9 +22,8 @@ import url from 'url'
|
|||
|
||||
export default {
|
||||
name: 'FollowMe',
|
||||
props: [
|
||||
{ isDialog: { type: Boolean, default: false }}
|
||||
],
|
||||
props:
|
||||
{ isDialog: { type: Boolean, default: false } },
|
||||
data () {
|
||||
return {
|
||||
instance_hostname: '',
|
||||
|
|
|
@ -3,11 +3,11 @@ div#list
|
|||
p(v-if='title') {{title}}
|
||||
v-timeline(dense)
|
||||
v-timeline-item(
|
||||
v-for='event in events'
|
||||
v-for='event in computedEvents'
|
||||
:key='`${event.id}_${event.start_datetime}`')
|
||||
div {{event|when}}
|
||||
a(:href='`/event/${event.id}`' target='_blank') {{event.title}}
|
||||
small.float-right @{{event.place.name}}
|
||||
.text-subtitle {{event|when}}
|
||||
.text-subtitle.float-right @{{event.place.name}}
|
||||
a.text-h5(:href='`/event/${event.id}`' target='_blank') {{event.title}}
|
||||
</template>
|
||||
<script>
|
||||
|
||||
|
@ -44,6 +44,12 @@ export default {
|
|||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
computedEvents () {
|
||||
if (!this.maxEvents) { return this.events }
|
||||
return this.events.slice(0, this.maxEvents)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -6,11 +6,6 @@
|
|||
:label="$t('event.show_recurrent')"
|
||||
@change="v => $emit('showrecurrent', v)")
|
||||
|
||||
v-switch.mt-0(
|
||||
v-if='pastFilter' inset color='primary'
|
||||
:label="$t('event.show_past')"
|
||||
@change="v => $emit('showpast', v)")
|
||||
|
||||
v-autocomplete.mt-0(
|
||||
:label='$t("common.search")'
|
||||
:items='keywords'
|
||||
|
@ -36,7 +31,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { mapState } from 'vuex'
|
||||
export default {
|
||||
name: 'Search',
|
||||
props: {
|
||||
|
@ -51,20 +46,20 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['tags', 'places', , 'settings']),
|
||||
...mapState(['tags', 'places', 'settings']),
|
||||
selectedFilters () {
|
||||
const tags = this.tags.filter(t => this.filters.tags.includes(t.tag)).map(t => ({ type: 'tag', label: t.tag, weigth: t.weigth, id: t.tag }))
|
||||
const places = this.places.filter(p => this.filters.places.includes(p.id))
|
||||
.map(p => ({ type: 'place', label: p.name, weigth: p.weigth, id: p.id }))
|
||||
const keywords = tags.concat(places).sort((a, b) => b.weigth - a.weigth)
|
||||
return keywords
|
||||
return keywords
|
||||
},
|
||||
keywords () {
|
||||
const tags = this.tags.map(t => ({ type: 'tag', label: t.tag, weigth: t.weigth, id: t.tag }))
|
||||
const places = this.places.map(p => ({ type: 'place', label: p.name, weigth: p.weigth, id: p.id }))
|
||||
const keywords = tags.concat(places).sort((a, b) => b.weigth - a.weigth)
|
||||
return keywords
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
change (filters) {
|
||||
|
@ -73,7 +68,7 @@ export default {
|
|||
places: filters.filter(p => p.type === 'place').map(p => p.id)
|
||||
}
|
||||
this.$emit('update', filters)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.navigation-list-item {
|
||||
/* .navigation-list-item {
|
||||
font-size: 18px !important;
|
||||
padding: 4px;
|
||||
}
|
||||
|
@ -10,3 +10,7 @@ html, body {
|
|||
.page-content h1:first-of-type {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-left: 10px;
|
||||
} */
|
|
@ -165,8 +165,8 @@
|
|||
"user_create_ok": "Utente creato",
|
||||
"allow_registration_description": "Vuoi abilitare la registrazione?",
|
||||
"allow_anon_event": "Si possono inserire eventi anonimi (previa conferma)?",
|
||||
"allow_recurrent_event": "Abilita eventi fissi",
|
||||
"recurrent_event_visible": "Appuntamenti fissi visibili di default",
|
||||
"allow_recurrent_event": "Abilita eventi ricorrenti",
|
||||
"recurrent_event_visible": "Appuntamenti ricorrenti visibili di default",
|
||||
"federation": "Federazione / ActivityPub",
|
||||
"enable_federation": "Abilita la federazione",
|
||||
"enable_federation_help": "Sarà possibile seguire questa istanza dal fediverso",
|
||||
|
|
12
package.json
12
package.json
|
@ -39,7 +39,7 @@
|
|||
"cors": "^2.8.5",
|
||||
"cross-env": "^7.0.2",
|
||||
"date-fns": "^2.16.1",
|
||||
"dayjs": "^1.9.5",
|
||||
"dayjs": "^1.9.6",
|
||||
"dompurify": "^2.2.2",
|
||||
"email-templates": "^7.1.2",
|
||||
"express": "^4.17.1",
|
||||
|
@ -61,7 +61,7 @@
|
|||
"multer": "^1.4.2",
|
||||
"nuxt": "^2.14.7",
|
||||
"nuxt-express-module": "^0.0.11",
|
||||
"pg": "^8.4.2",
|
||||
"pg": "^8.5.0",
|
||||
"sequelize": "^6.3.5",
|
||||
"sequelize-cli": "^6.2.0",
|
||||
"sharp": "^0.26.2",
|
||||
|
@ -79,7 +79,7 @@
|
|||
"@nuxtjs/eslint-config": "^4.0.0",
|
||||
"@nuxtjs/vuetify": "^1.11.2",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.12.1",
|
||||
"eslint": "^7.13.0",
|
||||
"eslint-config-prettier": "^6.15.0",
|
||||
"eslint-config-standard": "^16.0.1",
|
||||
"eslint-loader": "^4.0.2",
|
||||
|
@ -88,14 +88,14 @@
|
|||
"eslint-plugin-nuxt": "^1.0.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"eslint-plugin-promise": ">=4.0.1",
|
||||
"eslint-plugin-standard": "^4.0.2",
|
||||
"eslint-plugin-standard": "^4.1.0",
|
||||
"eslint-plugin-vue": "^7.1.0",
|
||||
"less-loader": "^7.0.2",
|
||||
"less-loader": "^7.1.0",
|
||||
"nodemon": "^2.0.6",
|
||||
"prettier": "^2.1.2",
|
||||
"pug-plain-loader": "^1.0.0",
|
||||
"sass": "^1.29.0",
|
||||
"sass-loader": "^10.0.5",
|
||||
"sass-loader": "^10.1.0",
|
||||
"vue-cli-plugin-vuetify": "~2.0.7",
|
||||
"vuetify-loader": "^1.3.0",
|
||||
"webpack-cli": "^4.2.0"
|
||||
|
|
|
@ -144,6 +144,7 @@ const htmlToText = require('html-to-text')
|
|||
export default {
|
||||
name: 'Event',
|
||||
components: { EventAdmin, EmbedEvent, FollowMe },
|
||||
transition: null,
|
||||
async asyncData ({ $axios, params, error, store }) {
|
||||
try {
|
||||
const event = await $axios.$get(`/event/${params.id}`)
|
||||
|
|
146
pages/export.vue
146
pages/export.vue
|
@ -1,87 +1,109 @@
|
|||
<template lang="pug">
|
||||
v-container
|
||||
p {{$t('export.intro')}}
|
||||
//- Search
|
||||
v-tabs(v-model='type')
|
||||
Search(
|
||||
:filters='filters'
|
||||
@update='updateFilters')
|
||||
v-card(outlined)
|
||||
v-tabs(v-model='type')
|
||||
|
||||
//- TOFIX
|
||||
//- v-tab.pt-1(label='email' name='email')
|
||||
//- v-tab-item
|
||||
//- p(v-html='$t(`export.email_description`)')
|
||||
//- el-form(@submit.native.prevent)
|
||||
//- //- el-switch(v-model='notification.notify_on_add' :active-text="$t('notify_on_insert')")
|
||||
//- //- br
|
||||
//- //- el-switch.mt-2(v-model='notification.send_notification' :active-text="$t('send_notification')")
|
||||
//- 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')}}
|
||||
//- TOFIX
|
||||
//- v-tab.pt-1(label='email' name='email')
|
||||
//- v-tab-item
|
||||
//- p(v-html='$t(`export.email_description`)')
|
||||
//- el-form(@submit.native.prevent)
|
||||
//- //- el-switch(v-model='notification.notify_on_add' :active-text="$t('notify_on_insert')")
|
||||
//- //- br
|
||||
//- //- el-switch.mt-2(v-model='notification.send_notification' :active-text="$t('send_notification')")
|
||||
//- 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')}}
|
||||
|
||||
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)
|
||||
v-btn(slot='append' plain text color='primary'
|
||||
v-clipboard:copy='link'
|
||||
v-clipboard:success='copyLink') {{$t("common.copy")}}
|
||||
v-icon.ml-1 mdi-content-copy
|
||||
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)
|
||||
v-btn(slot='prepend' plain text color='primary'
|
||||
v-clipboard:copy='link'
|
||||
v-clipboard:success='copyLink') {{$t("common.copy")}}
|
||||
v-icon.ml-1 mdi-content-copy
|
||||
|
||||
v-tab(v-if='settings.enable_federation') {{$t('common.fediverse')}}
|
||||
v-tab-item
|
||||
FollowMe
|
||||
v-tab(v-if='settings.enable_federation') {{$t('common.fediverse')}}
|
||||
v-tab-item
|
||||
FollowMe
|
||||
|
||||
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')
|
||||
v-btn(slot='append' v-clipboard:copy='link' v-clipboard:success='copyLink') {{$t("common.copy")}}
|
||||
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')
|
||||
v-btn(slot='prepend' plain text color='primary'
|
||||
v-clipboard:copy='link' v-clipboard:success='copyLink') {{$t("common.copy")}}
|
||||
v-icon.ml-1 mdi-content-copy
|
||||
|
||||
v-tab List
|
||||
v-tab-item
|
||||
v-container
|
||||
p(v-html='$t(`export.list_description`)')
|
||||
v-tab List
|
||||
v-tab-item
|
||||
v-container
|
||||
p(v-html='$t(`export.list_description`)')
|
||||
|
||||
v-row
|
||||
v-col.mr-2(:span='11')
|
||||
v-text-field(v-model='list.title') Title
|
||||
v-col.float-right(:span='12')
|
||||
List(
|
||||
:title='list.title'
|
||||
:events='filteredEvents')
|
||||
v-text-field.mb-1(type='textarea' v-model='listScript' readonly )
|
||||
v-btn(plain v-clipboard:copy='listScript' v-clipboard:success='copyLink') {{$t('common.copy')}}
|
||||
v-row
|
||||
v-col.mr-2(:span='11')
|
||||
v-text-field(v-model='list.title' )
|
||||
v-text-field(v-model='list.maxEvents' type='number')
|
||||
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' plain text
|
||||
color='primary' v-clipboard:copy='listScript' v-clipboard:success='copyLink') {{$t('common.copy')}}
|
||||
v-icon.ml-1 mdi-content-copy
|
||||
|
||||
//- 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
|
||||
//- 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
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import dayjs from 'dayjs'
|
||||
import { mapState } from 'vuex'
|
||||
import List from '@/components/List'
|
||||
import FollowMe from '../components/FollowMe'
|
||||
import Search from '@/components/Search'
|
||||
|
||||
export default {
|
||||
name: 'Exports',
|
||||
components: { List, FollowMe },
|
||||
async asyncData ({ $axios, params, store }) {
|
||||
components: { List, FollowMe, Search },
|
||||
async asyncData ({ $axios, params, store, $api }) {
|
||||
const events = await $api.getEvents({
|
||||
start: dayjs().unix()
|
||||
})
|
||||
return { events }
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
type: 'rss',
|
||||
notification: { email: '' },
|
||||
list: { title: 'Gancio' }
|
||||
list: { title: 'Gancio', maxEvents: 3 },
|
||||
filters: { tags: [], places: [] },
|
||||
events: []
|
||||
}
|
||||
},
|
||||
head () {
|
||||
return {
|
||||
title: `${this.settings.title} - ${this.$t('common.export')}`
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['filters', 'settings']),
|
||||
...mapState(['settings']),
|
||||
domain () {
|
||||
const URL = url.parse(this.settings.baseurl)
|
||||
return URL.hostname
|
||||
|
@ -123,6 +145,9 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
updateFilters (filters) {
|
||||
this.filters = filters
|
||||
},
|
||||
copyLink () {
|
||||
this.$root.$message('common.feed_url_copied')
|
||||
},
|
||||
|
@ -138,11 +163,6 @@ export default {
|
|||
imgPath (event) {
|
||||
return event.image_path && event.image_path
|
||||
}
|
||||
},
|
||||
head () {
|
||||
return {
|
||||
title: `${this.settings.title} - ${this.$t('common.export')}`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
export default ({ $axios, store }, inject) => {
|
||||
|
||||
const api = {
|
||||
|
||||
/**
|
||||
* Get events
|
||||
*
|
||||
*
|
||||
* filter: {
|
||||
* start_datetime: unix_timestamp (default now)
|
||||
* end_datetime: unix_timestamp
|
||||
|
@ -13,16 +12,18 @@ export default ({ $axios, store }, inject) => {
|
|||
* places: [place_id],
|
||||
* limit: (default ∞)
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
async getEvents (params) {
|
||||
try {
|
||||
const events = await $axios.$get(`/events`, { params: {
|
||||
start: params.start,
|
||||
end: params.end,
|
||||
places: params.places && params.places.join(','),
|
||||
tags: params.tags && params.tags.join(',')
|
||||
}} )
|
||||
const events = await $axios.$get('/events', {
|
||||
params: {
|
||||
start: params.start,
|
||||
end: params.end,
|
||||
places: params.places && params.places.join(','),
|
||||
tags: params.tags && params.tags.join(',')
|
||||
}
|
||||
})
|
||||
return events
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
|
@ -31,4 +32,4 @@ export default ({ $axios, store }, inject) => {
|
|||
}
|
||||
}
|
||||
inject('api', api)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const settingsController = require('./api/controller/settings')
|
||||
const acceptLanguage = require('accept-language')
|
||||
const moment = require('moment-timezone')
|
||||
const dayjs = require('dayjs')
|
||||
const config = require('config')
|
||||
const debug = require('debug')('helpers')
|
||||
const pkg = require('../package.json')
|
||||
|
@ -66,8 +66,8 @@ module.exports = {
|
|||
acceptLanguage.languages(Object.keys(locales))
|
||||
req.settings.locale = acceptLanguage.get(acceptedLanguages)
|
||||
req.settings.user_locale = settingsController.user_locale[req.settings.locale]
|
||||
moment.locale(req.settings.locale)
|
||||
moment.tz.setDefault(req.settings.instance_timezone)
|
||||
dayjs.locale(req.settings.locale)
|
||||
dayjs.tz.setDefault(req.settings.instance_timezone)
|
||||
next()
|
||||
},
|
||||
|
||||
|
|
|
@ -72,21 +72,12 @@ export const actions = {
|
|||
const { tags, places } = await this.$axios.$get('/event/meta')
|
||||
commit('update', { tags, places })
|
||||
},
|
||||
async addEvent ({ commit }, formData) {
|
||||
await this.$axios.$post('/event', formData)
|
||||
},
|
||||
async updateEvent ({ commit }, formData) {
|
||||
await this.$axios.$put('/event', formData)
|
||||
},
|
||||
setFilters ({ commit }, filters) {
|
||||
commit('setFilters', filters)
|
||||
},
|
||||
setAnnouncements ({ commit }, announcements) {
|
||||
commit('setAnnouncements', announcements)
|
||||
},
|
||||
delEvent ({ commit }, eventId) {
|
||||
commit('delEvent', eventId)
|
||||
},
|
||||
async setSetting ({ commit }, setting) {
|
||||
await this.$axios.$post('/settings', setting)
|
||||
commit('setSetting', setting)
|
||||
|
|
Loading…
Reference in a new issue