better config / install from cli / allow_registration

This commit is contained in:
lesion
2019-06-21 23:52:18 +02:00
parent 4c3c7ee324
commit cf81a73f2f
38 changed files with 530 additions and 272 deletions

13
plugins/axios.js Normal file
View File

@@ -0,0 +1,13 @@
export default function({ $axios, store }) {
if (process.server) {
console.error('dentro il server ', store.settings )
// $axios.defaults.baseurl =
} else {
// const protocol = window.location.protocol
// const hostname = window.location.hostname
// const port = 8000
// const url = `${protocol}//${hostname}:${port}`
$axios.defaults.baseURL = window.location.origin + '/api'
console.error('dentro il client !')
}
}

View File

@@ -9,9 +9,9 @@ const locales = {
it: require('element-ui/lib/locale/lang/it'),
en: require('element-ui/lib/locale/lang/en')
}
locale.use(locales[process.env.locale])
export default () => {
export default ({ app }) => {
locale.use(locales[app.i18n.locale])
Vue.use(Button)
Vue.use(Collapse)
Vue.use(CollapseItem)

View File

@@ -1,31 +1,24 @@
import Vue from 'vue'
import moment from 'dayjs'
import 'dayjs/locale/it'
moment.locale(process.env.locale)
function short_hour(datetime) {
if (datetime.minute() === 0) {
return datetime.format('HH')
} else {
return datetime.format('HH:mm')
}
}
export default (a) => {
export default ({ app }) => {
moment.locale(app.i18n.locale)
Vue.filter('linkify', value => value.replace(/(https?:\/\/[^\s]+)/g, '<a href="$1">$1</a>'))
Vue.filter('datetime', value => moment(value).format('ddd, D MMMM HH:mm'))
Vue.filter('short_datetime', value => moment(value).format('D/MM HH:mm'))
Vue.filter('hour', value => moment(value).format('HH:mm'))
Vue.filter('day', value => moment(value).format('dddd, D MMMM'))
Vue.filter('day', value => moment(value*1000).format('dddd, D MMMM'))
Vue.filter('month', value => moment(value).format('MMM'))
Vue.filter('event_when', event => {
const start = moment(event.start_datetime)
const end = moment(event.end_datetime)
const start = moment(event.start_datetime*1000)
const end = moment(event.end_datetime*1000)
if (event.multidate) {
return `${start.format('ddd, D MMMM')} (${short_hour(start)}) - ${end.format('ddd, D MMMM')} (${short_hour(end)})`
return `${start.format('ddd, D MMMM (HH:mm)')} - ${end.format('ddd, D MMMM (HH:mm)')}`
} else if (event.end_datetime && event.end_datetime !== event.start_datetime)
return `${start.format('ddd, D MMMM')} (${short_hour(start)}-${short_hour(end)})`
return `${start.format('ddd, D MMMM (HH:mm-')}${end.format('HH:mm)')}`
else
return `${start.format('dddd, D MMMM')} (${short_hour(start)})`
return start.format('dddd, D MMMM (HH:mm)')
})
}