refactoring media in event (multiple in db, focalpoint, alt text)

This commit is contained in:
les
2021-07-15 16:18:56 +02:00
parent 49301de42d
commit 9673e40640
13 changed files with 271 additions and 106 deletions

View File

@@ -33,6 +33,18 @@ export default ({ app, store }) => {
// shown in mobile homepage
Vue.filter('day', value => dayjs.unix(value).locale(store.state.locale).format('dddd, D MMM'))
Vue.filter('mediaURL', (event, type) => {
if (event.media && event.media.length) {
if (type === 'alt') {
return event.media[0].name
} else {
return store.state.settings.baseurl + '/media/' + (type === 'thumb' ? 'thumb/' : '') + event.media[0].url
}
} else if (type !== 'alt') {
return store.state.settings.baseurl + '/media/' + (type === 'thumb' ? 'thumb/' : '') + 'logo.svg'
}
return ''
})
Vue.filter('from', timestamp => dayjs.unix(timestamp).fromNow())