2020-01-15 23:40:44 +01:00
|
|
|
<template lang="pug">
|
2022-07-01 15:55:09 +02:00
|
|
|
v-container.container.pa-0.pa-md-3
|
|
|
|
v-card
|
2024-01-23 09:44:06 +01:00
|
|
|
v-alert(v-if='url!==settings.baseurl' rounded="0" flat border="left" type='warning' show-icon :icon='mdiAlert')
|
2022-07-01 15:55:09 +02:00
|
|
|
span(v-html="$t('admin.wrong_domain_warning', { url, baseurl: settings.baseurl })")
|
2024-01-23 09:44:06 +01:00
|
|
|
v-alert(v-if='!selfReachable' rounded="0" flat border="left" type='warning' show-icon :icon='mdiAlert')
|
2023-11-20 17:41:24 +01:00
|
|
|
span(v-html="$t('admin.not_reachable_warning', { baseurl: settings.baseurl })")
|
2022-07-01 15:55:09 +02:00
|
|
|
v-tabs(v-model='selectedTab' show-arrows :next-icon='mdiChevronRight' :prev-icon='mdiChevronLeft')
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- SETTINGS
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#settings') {{$t('common.settings')}}
|
|
|
|
v-tab-item(value='settings')
|
2022-07-01 15:55:09 +02:00
|
|
|
Settings
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2023-11-09 17:01:32 +01:00
|
|
|
//- EVENTS
|
|
|
|
v-tab(href='#unconfirmed_events')
|
|
|
|
v-badge(:value='!!unconfirmedEvents.length' :content='unconfirmedEvents.length') {{$t('common.events')}}
|
|
|
|
v-tab-item(value='unconfirmed_events')
|
|
|
|
Events(:unconfirmedEvents='unconfirmedEvents'
|
|
|
|
@confirmed='id => { unconfirmedEvents = unconfirmedEvents.filter(e => e.id !== id)}')
|
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- THEME
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#theme') {{$t('common.theme')}}
|
|
|
|
v-tab-item(value='theme')
|
2022-07-01 15:55:09 +02:00
|
|
|
Theme
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- USERS
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#users')
|
2022-07-01 15:55:09 +02:00
|
|
|
v-badge(:value='!!unconfirmedUsers.length' :content='unconfirmedUsers.length') {{$t('common.users')}}
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab-item(value='users')
|
2022-07-01 15:55:09 +02:00
|
|
|
Users(:users='users' @update='updateUsers')
|
2020-07-28 12:24:39 +02:00
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- PLACES
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#places') {{$t('common.places')}}
|
|
|
|
v-tab-item(value='places')
|
2022-07-01 15:55:09 +02:00
|
|
|
Places
|
2022-12-06 23:53:14 +01:00
|
|
|
|
2022-12-13 15:41:39 +01:00
|
|
|
//- TAGS
|
|
|
|
v-tab(href='#tags') {{$t('common.tags')}}
|
|
|
|
v-tab-item(value='tags')
|
|
|
|
Tags
|
|
|
|
|
2022-12-06 23:53:14 +01:00
|
|
|
//- GEOCODING / MAPS
|
|
|
|
v-tab(href='#geolocation' v-if='settings.allow_geolocation') {{$t('admin.geolocation')}}
|
|
|
|
v-tab-item(value='geolocation')
|
2022-12-07 10:16:55 +01:00
|
|
|
client-only(placeholder='Loading...')
|
|
|
|
Geolocation
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- Collections
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#collections') {{$t('common.collections')}}
|
|
|
|
v-tab-item(value='collections')
|
2022-07-01 15:55:09 +02:00
|
|
|
Collections
|
2022-05-20 12:33:30 +02:00
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- ANNOUNCEMENTS
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#announcements') {{$t('common.announcements')}}
|
|
|
|
v-tab-item(value='announcements')
|
2022-07-01 15:55:09 +02:00
|
|
|
Announcement
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2022-08-09 18:33:05 +02:00
|
|
|
//- PLUGINS
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#plugins') {{$t('common.plugins')}}
|
|
|
|
v-tab-item(value='plugins')
|
2022-08-09 18:33:05 +02:00
|
|
|
Plugin
|
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- FEDERATION
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(href='#federation') {{$t('common.federation')}}
|
|
|
|
v-tab-item(value='federation')
|
2022-07-01 15:55:09 +02:00
|
|
|
Federation
|
2020-02-16 21:03:50 +01:00
|
|
|
|
2022-07-01 15:55:09 +02:00
|
|
|
//- MODERATION
|
2022-11-29 14:40:46 +01:00
|
|
|
v-tab(v-if='settings.enable_federation' href='#moderation') {{$t('common.moderation')}}
|
|
|
|
v-tab-item(value='moderation')
|
2022-07-01 15:55:09 +02:00
|
|
|
Moderation
|
2020-01-15 23:40:44 +01:00
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mapState } from 'vuex'
|
2022-05-31 15:23:58 +02:00
|
|
|
import { mdiAlert, mdiChevronRight, mdiChevronLeft } from '@mdi/js'
|
2020-01-15 23:40:44 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Admin',
|
2022-02-08 22:54:47 +01:00
|
|
|
components: {
|
2023-04-14 10:47:54 +02:00
|
|
|
Settings: () => import(/* webpackChunkName: "admin" */'../components/admin/Settings.vue'),
|
2022-02-08 22:54:47 +01:00
|
|
|
Users: () => import(/* webpackChunkName: "admin" */'../components/admin/Users'),
|
|
|
|
Events: () => import(/* webpackChunkName: "admin" */'../components/admin/Events'),
|
|
|
|
Places: () => import(/* webpackChunkName: "admin" */'../components/admin/Places'),
|
2022-12-13 15:41:39 +01:00
|
|
|
Tags: () => import(/* webpackChunkName: "admin" */'../components/admin/Tags'),
|
2022-06-18 01:11:19 +02:00
|
|
|
Collections: () => import(/* webpackChunkName: "admin" */'../components/admin/Collections'),
|
2022-12-07 10:16:55 +01:00
|
|
|
[process.client && 'Geolocation']: () => import(/* webpackChunkName: "admin" */'../components/admin/Geolocation.vue'),
|
2022-02-08 22:54:47 +01:00
|
|
|
Federation: () => import(/* webpackChunkName: "admin" */'../components/admin/Federation.vue'),
|
|
|
|
Moderation: () => import(/* webpackChunkName: "admin" */'../components/admin/Moderation.vue'),
|
2022-08-09 18:33:05 +02:00
|
|
|
Plugin: () => import(/* webpackChunkName: "admin" */'../components/admin/Plugin.vue'),
|
2022-02-08 22:54:47 +01:00
|
|
|
Announcement: () => import(/* webpackChunkName: "admin" */'../components/admin/Announcement.vue'),
|
|
|
|
Theme: () => import(/* webpackChunkName: "admin" */'../components/admin/Theme.vue')
|
|
|
|
},
|
2023-11-30 17:03:51 +01:00
|
|
|
middleware: ['auth', 'isAdmin'],
|
2022-04-27 01:22:09 +02:00
|
|
|
async asyncData ({ $axios, req }) {
|
|
|
|
let url
|
|
|
|
if (process.client) {
|
|
|
|
url = window.location.protocol + '//' + window.location.host
|
|
|
|
} else {
|
|
|
|
url = req.protocol + '://' + req.headers.host
|
|
|
|
}
|
2020-06-02 00:02:02 +02:00
|
|
|
try {
|
|
|
|
const users = await $axios.$get('/users')
|
2020-09-07 02:23:03 +02:00
|
|
|
const unconfirmedEvents = await $axios.$get('/event/unconfirmed')
|
2023-10-25 09:47:17 +02:00
|
|
|
const selfReachable = await $axios.$get('/reachable')
|
|
|
|
return { users, unconfirmedEvents, url, selfReachable }
|
2020-06-02 00:02:02 +02:00
|
|
|
} catch (e) {
|
2023-10-25 09:47:17 +02:00
|
|
|
return { users: [], unconfirmedEvents: [], url, selfReachable: false }
|
2020-06-02 00:02:02 +02:00
|
|
|
}
|
|
|
|
},
|
2020-01-15 23:40:44 +01:00
|
|
|
data () {
|
|
|
|
return {
|
2022-05-31 15:23:58 +02:00
|
|
|
mdiAlert, mdiChevronRight, mdiChevronLeft,
|
2022-04-28 23:28:40 +02:00
|
|
|
users: [],
|
2020-01-15 23:40:44 +01:00
|
|
|
description: '',
|
2021-01-25 01:17:25 +01:00
|
|
|
unconfirmedEvents: [],
|
2023-10-25 09:47:17 +02:00
|
|
|
selfReachable: false
|
2020-01-15 23:40:44 +01:00
|
|
|
}
|
|
|
|
},
|
2021-03-18 15:44:04 +01:00
|
|
|
head () {
|
|
|
|
return { title: `${this.settings.title} - ${this.$t('common.admin')}` }
|
|
|
|
},
|
2020-01-15 23:40:44 +01:00
|
|
|
computed: {
|
|
|
|
...mapState(['settings']),
|
|
|
|
unconfirmedUsers () {
|
|
|
|
return this.users.filter(u => !u.is_active)
|
2022-11-29 14:40:46 +01:00
|
|
|
},
|
|
|
|
selectedTab: {
|
|
|
|
set (tab) {
|
|
|
|
this.$router.replace({ query: { ...this.$route.query, tab } })
|
|
|
|
},
|
|
|
|
get () {
|
|
|
|
return this.$route.query.tab
|
|
|
|
}
|
|
|
|
}
|
2020-01-15 23:40:44 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2021-03-18 15:44:04 +01:00
|
|
|
async updateUsers () {
|
|
|
|
this.users = await this.$axios.$get('/users')
|
|
|
|
},
|
2020-01-15 23:40:44 +01:00
|
|
|
preview (id) {
|
|
|
|
this.$router.push(`/event/${id}`)
|
|
|
|
},
|
|
|
|
async confirm (id) {
|
2020-10-07 11:12:13 +02:00
|
|
|
this.loading = true
|
|
|
|
await this.$axios.$get(`/event/confirm/${id}`)
|
|
|
|
this.loading = false
|
2022-04-27 01:22:09 +02:00
|
|
|
this.$root.$message('event.confirmed', { color: 'success' })
|
2020-10-07 11:12:13 +02:00
|
|
|
this.unconfirmedEvents = this.unconfirmedEvents.filter(e => e.id !== id)
|
2020-01-15 23:40:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|