@@ -60,5 +60,7 @@ export default {
|
||||
getAuthURL: mastodonInstance => post('/user/getauthurl', mastodonInstance),
|
||||
setCode: code => post('/user/code', code),
|
||||
getKnowLocations: () => get('/locations'),
|
||||
getKnowTags: () => get('/tags')
|
||||
getKnowTags: () => get('/tags'),
|
||||
getAdminSettings: () => get('/settings')
|
||||
// setAdminSetting: (key, value) => post('/settings', { key, value })
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template lang="pug">
|
||||
b-modal(hide-footer @hidden='$router.replace("/")' :title='$t("Admin")' :visible='true' size='lg')
|
||||
el-tabs
|
||||
el-tabs(tabPosition='left' v-model='tab')
|
||||
//- USERS
|
||||
el-tab-pane.pt-1
|
||||
template(slot='label')
|
||||
@@ -54,7 +54,7 @@
|
||||
template(slot='label')
|
||||
v-icon(name='tag')
|
||||
span {{$t('Tags')}}
|
||||
p Select a tag to change it's color
|
||||
p {{$t('admin_tag_explanation')}}
|
||||
el-tag(v-if='tag.tag' :color='tag.color || "grey"' size='mini') {{tag.tag}}
|
||||
el-form(:inline='true' label-width='120px')
|
||||
el-form-item(:label="$t('Color')")
|
||||
@@ -71,7 +71,12 @@
|
||||
template(slot='label')
|
||||
v-icon(name='tools')
|
||||
span {{$t('Settings')}}
|
||||
|
||||
el-form(inline)
|
||||
span {{$t('admin_mastodon_explanation')}}
|
||||
el-input(v-model="mastodon_instance")
|
||||
span(slot='prepend') {{$t('Mastodon instance')}}
|
||||
el-button(slot='append' @click='associate' variant='success' type='success') {{$t('Associate')}}
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
@@ -95,17 +100,26 @@ export default {
|
||||
place: {name: '', address: '' },
|
||||
tag: {name: '', color: ''},
|
||||
events: [],
|
||||
loading: false
|
||||
loading: false,
|
||||
mastodon_instance: '',
|
||||
settings: {},
|
||||
tab: "0",
|
||||
}
|
||||
},
|
||||
async mounted () {
|
||||
const code = this.$route.query.code
|
||||
if (code) {
|
||||
this.tab = "4"
|
||||
const instance = await api.setCode({code, is_admin: true})
|
||||
}
|
||||
this.users = await api.getUsers()
|
||||
this.events = await api.getUnconfirmedEvents()
|
||||
this.settings = await api.getAdminSettings()
|
||||
this.mastodon_instance = this.settings.mastodon_auth && this.settings.mastodon_auth.instance
|
||||
},
|
||||
computed: {
|
||||
...mapState(['tags', 'places']),
|
||||
paginatedEvents () {
|
||||
console.log(this.events)
|
||||
return this.events.slice((this.eventPage-1) * this.perPage,
|
||||
this.eventPage * this.perPage)
|
||||
},
|
||||
@@ -146,8 +160,12 @@ export default {
|
||||
preview (id) {
|
||||
this.$router.push(`/event/${id}`)
|
||||
},
|
||||
async associate () {
|
||||
if (!this.mastodon_instance) return
|
||||
const url = await api.getAuthURL({instance: this.mastodon_instance, admin: true})
|
||||
setTimeout( () => window.location.href=url, 100);
|
||||
},
|
||||
async confirm (id) {
|
||||
console.log('dentro confirm', id)
|
||||
try {
|
||||
this.loading = true
|
||||
await api.confirmEvent(id)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template lang='pug'>
|
||||
b-modal(hide-footer @hidden='$router.replace("/")'
|
||||
b-modal(hide-footer @hidden='$router.replace("/")' ref='modal'
|
||||
:title="$t('Register')" :visible='true' @shown='$refs.email.focus()')
|
||||
el-form
|
||||
p(v-html="$t('register_explanation')")
|
||||
@@ -35,11 +35,18 @@ export default {
|
||||
async register () {
|
||||
try {
|
||||
const user = await api.register(this.user)
|
||||
this.$router.go(-1)
|
||||
Message({
|
||||
message: this.$t('registration_complete'),
|
||||
type: 'success'
|
||||
})
|
||||
this.$refs.modal.hide()
|
||||
if (!user.is_admin) {
|
||||
Message({
|
||||
message: this.$t('registration_complete'),
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
Message({
|
||||
message: this.$t('admin_registration_complete'),
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template lang="pug">
|
||||
b-modal(:title="$t('Settings')" hide-footer @hide='$router.go(-1)' :visible='true')
|
||||
el-form(inline)
|
||||
el-input(v-model="mastodon_instance")
|
||||
el-input(v-model="mastodon_instance" type='success')
|
||||
span(slot='prepend') Mastodon instance
|
||||
el-button(slot='append' @click='associate' type='success') Associate
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ const it = {
|
||||
Admin: 'Amministra',
|
||||
Today: 'Oggi',
|
||||
Export: 'Esporta',
|
||||
'Mastodon instance': 'Istanza Mastodon',
|
||||
'admin_mastodon_explanation': 'Puoi associare un account mastodon a questa istanza di gancio, ogni evento verrà pubblicato lì',
|
||||
Associate: 'Associa',
|
||||
admin_tag_explanation: `Seleziona un'etichetta per cambiarne il colore`,
|
||||
event_confirmed: 'Evento confermato!',
|
||||
notify_on_insert: `Notifica all'inserimento`,
|
||||
'event_confirm_explanation': 'Puoi approvare gli eventi inseriti da utenti non registrati',
|
||||
|
||||
@@ -46,6 +46,10 @@ export default new Router({
|
||||
{
|
||||
path: '/export',
|
||||
components: { modal: Export }
|
||||
},
|
||||
{
|
||||
path: '/admin/oauth',
|
||||
components: { modal: Admin }
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user