This commit is contained in:
les
2019-09-11 19:12:24 +02:00
parent 93baf01a55
commit 2fe956d117
65 changed files with 762 additions and 721 deletions

View File

@@ -1,5 +1,5 @@
export default function({ $axios, store }) {
export default function ({ $axios, store }) {
if (process.client) {
$axios.defaults.baseURL = window.location.origin + '/api'
}
}
}

View File

@@ -4,7 +4,6 @@ import 'dayjs/locale/it'
import 'dayjs/locale/es'
export default ({ app, store }) => {
// replace links with anchors
// TODO: remove fb tracking id
Vue.filter('linkify', value => value.replace(/(https?:\/\/[^\s]+)/g, '<a href="$1">$1</a>'))
@@ -21,7 +20,7 @@ export default ({ app, store }) => {
Vue.filter('when', (event, where) => {
moment.locale(store.state.locale)
//{start,end}_datetime are unix timestamp
// {start,end}_datetime are unix timestamp
const start = moment.unix(event.start_datetime)
const end = moment.unix(event.end_datetime)
@@ -30,12 +29,12 @@ export default ({ app, store }) => {
// recurrent event
if (event.recurrent && where !== 'home') {
const { frequency, days, type } = JSON.parse(event.recurrent)
if ( frequency === '1w' || frequency === '2w' ) {
const recurrent = app.i18n.tc(`event.recurrent_${frequency}_days`, days.length, {days: days.map(d => moment().day(d-1).format('dddd'))})
if (frequency === '1w' || frequency === '2w') {
const recurrent = app.i18n.tc(`event.recurrent_${frequency}_days`, days.length, { days: days.map(d => moment().day(d - 1).format('dddd')) })
return `${normal} - ${recurrent}`
} else if (frequency === '1m' || frequency === '2m') {
const d = type === 'ordinal' ? days : days.map(d => moment().day(d-1).format('dddd'))
const recurrent = app.i18n.tc(`event.recurrent_${frequency}_${type}`, days.length, {days: d})
const d = type === 'ordinal' ? days : days.map(d => moment().day(d - 1).format('dddd'))
const recurrent = app.i18n.tc(`event.recurrent_${frequency}_${type}`, days.length, { days: d })
return `${normal} - ${recurrent}`
}
return 'recurrent '
@@ -44,7 +43,7 @@ export default ({ app, store }) => {
// multidate
if (event.multidate) {
return `${start.format('ddd, D MMMM (HH:mm)')} - ${end.format('ddd, D MMMM')}`
}
}
// normal event
if (event.end_datetime && event.end_datetime !== event.start_datetime) {

View File

@@ -10,8 +10,8 @@ export default async ({ app, store }) => {
// This way we can use it in middleware and pages asyncData/fetch
const user_locale = await app.$axios.$get('/settings/user_locale')
for(let lang in user_locale) {
if (locales[lang]) merge(locales[lang], user_locale[lang])
for (const lang in user_locale) {
if (locales[lang]) { merge(locales[lang], user_locale[lang]) }
}
app.i18n = new VueI18n({