[feat] Split federation/settings admin components
This commit is contained in:
22
components/admin/Federation.vue
Normal file
22
components/admin/Federation.vue
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
div
|
||||||
|
el-divider {{$t('admin.federation')}}
|
||||||
|
el-form(inline label-width='400px')
|
||||||
|
el-form-item(:label="$t('admin.enable_federation')")
|
||||||
|
el-switch(v-model='enable_federation')
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { mapState, mapActions } from 'vuex'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Federation',
|
||||||
|
methods: mapActions(['setSetting']),
|
||||||
|
computed: {
|
||||||
|
...mapState(['settings']),
|
||||||
|
enable_federation: {
|
||||||
|
get () { return this.settings.enable_federation },
|
||||||
|
set (value) { this.setSetting({ key: 'enable_federation', value }) }
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
64
components/admin/Settings.vue
Normal file
64
components/admin/Settings.vue
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
div
|
||||||
|
el-form(inline label-width="400px")
|
||||||
|
//- select timezone
|
||||||
|
el-form-item(:label="$t('admin.select_instance_timezone')")
|
||||||
|
el-select(v-model='instance_timezone' filterable)
|
||||||
|
el-option(v-for='timezone in timezones' :key='timezone.value' :value='timezone.value')
|
||||||
|
span.float-left {{timezone.value}}
|
||||||
|
small.float-right.text-danger {{timezone.offset}}
|
||||||
|
|
||||||
|
//- allow open registration
|
||||||
|
el-form-item(:label="$t('admin.allow_registration_description')")
|
||||||
|
el-switch(name='reg' v-model='allow_registration')
|
||||||
|
|
||||||
|
//- allow anon event
|
||||||
|
el-form-item(:label="$t('admin.allow_anon_event')")
|
||||||
|
el-switch(v-model='allow_anon_event')
|
||||||
|
|
||||||
|
el-form-item(:label="$t('admin.allow_recurrent_event')")
|
||||||
|
el-switch(v-model='allow_recurrent_event')
|
||||||
|
|
||||||
|
el-form-item(v-show='allow_recurrent_event' :label="$t('admin.recurrent_event_visible')")
|
||||||
|
el-switch(v-model='recurrent_event_visible')
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { mapActions, mapState } from 'vuex'
|
||||||
|
import moment from 'moment-timezone'
|
||||||
|
import timezones from './timezones'
|
||||||
|
export default {
|
||||||
|
name: 'Settings',
|
||||||
|
computed: {
|
||||||
|
timezones () {
|
||||||
|
const current_timezone = moment.tz.guess()
|
||||||
|
return timezones
|
||||||
|
.filter(tz => tz !== current_timezone)
|
||||||
|
.concat([current_timezone])
|
||||||
|
.map(tz => ({ value: tz, offset: moment().tz(tz).format('z Z') }))
|
||||||
|
},
|
||||||
|
...mapState(['settings']),
|
||||||
|
instance_timezone: {
|
||||||
|
get () { return this.settings.instance_timezone },
|
||||||
|
set (value) { this.setSetting({ key: 'instance_timezone', value }) }
|
||||||
|
},
|
||||||
|
allow_registration: {
|
||||||
|
get () { return this.settings.allow_registration },
|
||||||
|
set (value) { this.setSetting({ key: 'allow_registration', value }) }
|
||||||
|
},
|
||||||
|
allow_anon_event: {
|
||||||
|
get () { return this.settings.allow_anon_event },
|
||||||
|
set (value) { this.setSetting({ key: 'allow_anon_event', value }) }
|
||||||
|
},
|
||||||
|
allow_recurrent_event: {
|
||||||
|
get () { return this.settings.allow_recurrent_event },
|
||||||
|
set (value) { this.setSetting({ key: 'allow_recurrent_event', value }) }
|
||||||
|
},
|
||||||
|
recurrent_event_visible: {
|
||||||
|
get () { return this.settings.recurrent_event_visible },
|
||||||
|
set (value) { this.setSetting({ key: 'recurrent_event_visible', value }) }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: mapActions(['setSetting'])
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -4,7 +4,7 @@ div
|
|||||||
el-collapse
|
el-collapse
|
||||||
el-collapse-item
|
el-collapse-item
|
||||||
template(slot='title')
|
template(slot='title')
|
||||||
h4 <v-icon name='plus'/> {{$t('common.new_user')}}
|
el-button(mini size='mini') <v-icon name='plus'/> {{$t('common.new_user')}}
|
||||||
el-form(inline)
|
el-form(inline)
|
||||||
el-form-item(:label="$t('common.username')")
|
el-form-item(:label="$t('common.username')")
|
||||||
el-input(v-model='new_user.username')
|
el-input(v-model='new_user.username')
|
||||||
|
|||||||
4
components/admin/timezones.js
Normal file
4
components/admin/timezones.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export default [
|
||||||
|
'Europe/Rome',
|
||||||
|
'Europe/Paris',
|
||||||
|
]
|
||||||
@@ -52,7 +52,12 @@ export default {
|
|||||||
username: 'Nomignolo',
|
username: 'Nomignolo',
|
||||||
comments: 'nessun commento|un commento|{n} commenti',
|
comments: 'nessun commento|un commento|{n} commenti',
|
||||||
activate_user: 'Confermato',
|
activate_user: 'Confermato',
|
||||||
displayname: 'Nome mostrato'
|
displayname: 'Nome mostrato',
|
||||||
|
federation: 'Federazione',
|
||||||
|
set_password: 'Imposta password',
|
||||||
|
copy_link: 'Copia link',
|
||||||
|
send_via_mail: 'Invia mail',
|
||||||
|
add_to_calendar: 'Aggiungi al tuo calendario'
|
||||||
},
|
},
|
||||||
|
|
||||||
login: {
|
login: {
|
||||||
@@ -132,7 +137,7 @@ export default {
|
|||||||
due: 'alle',
|
due: 'alle',
|
||||||
from: 'Dalle',
|
from: 'Dalle',
|
||||||
image_too_big: 'Immagine troppo grande! Massimo 4M',
|
image_too_big: 'Immagine troppo grande! Massimo 4M',
|
||||||
interact_with_me_at: 'Seguimi nel fediverso su'
|
interact_with_me_at: 'Seguimi nel fediverso su',
|
||||||
},
|
},
|
||||||
|
|
||||||
admin: {
|
admin: {
|
||||||
@@ -151,7 +156,8 @@ export default {
|
|||||||
allow_recurrent_event: 'Abilita eventi fissi',
|
allow_recurrent_event: 'Abilita eventi fissi',
|
||||||
recurrent_event_visible: 'Appuntamenti fissi visibili di default',
|
recurrent_event_visible: 'Appuntamenti fissi visibili di default',
|
||||||
federation: 'Federazione / ActivityPub',
|
federation: 'Federazione / ActivityPub',
|
||||||
enable_federation: 'Abilita la federazione!'
|
enable_federation: 'Abilita la federazione!',
|
||||||
|
select_instance_timezone: 'Seleziona la timezone'
|
||||||
},
|
},
|
||||||
|
|
||||||
auth: {
|
auth: {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
el-card#admin
|
el-main
|
||||||
nuxt-link.float-right(to='/')
|
nuxt-link.float-right(to='/')
|
||||||
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
|
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
el-table-column(:label='$t("common.name")' width='300')
|
el-table-column(:label='$t("common.name")' width='300')
|
||||||
template(slot-scope='data') {{data.row.title}}
|
template(slot-scope='data') {{data.row.title}}
|
||||||
el-table-column(:label='$t("common.where")' width='250')
|
el-table-column(:label='$t("common.where")' width='250')
|
||||||
template(slot-scope='data') {{data.row.place.name}}
|
template(slot-scope='data') {{dperPageata.row.place.name}}
|
||||||
el-table-column(:label='$t("common.confirm")' width='250')
|
el-table-column(:label='$t("common.confirm")' width='250')
|
||||||
template(slot-scope='data')
|
template(slot-scope='data')
|
||||||
el-button(type='primary' @click='confirm(data.row.id)' size='mini') {{$t('common.confirm')}}
|
el-button(type='primary' @click='confirm(data.row.id)' size='mini') {{$t('common.confirm')}}
|
||||||
@@ -44,32 +44,14 @@
|
|||||||
template(slot='label')
|
template(slot='label')
|
||||||
v-icon(name='cog')
|
v-icon(name='cog')
|
||||||
span {{$t('common.settings')}}
|
span {{$t('common.settings')}}
|
||||||
|
Settings
|
||||||
|
|
||||||
el-form(inline label-width="400px")
|
//- FEDERATION
|
||||||
|
el-tab-pane.pt-1
|
||||||
//- allow open registration
|
template(slot='label')
|
||||||
el-form-item(:label="$t('admin.allow_registration_description')")
|
v-icon(name='network-wired')
|
||||||
el-switch(name='reg' v-model='allow_registration')
|
span.ml-1 {{$t('common.federation')}}
|
||||||
|
Federation
|
||||||
//- allow anon event
|
|
||||||
el-form-item(:label="$t('admin.allow_anon_event')")
|
|
||||||
el-switch(v-model='allow_anon_event')
|
|
||||||
|
|
||||||
el-form-item(:label="$t('admin.allow_recurrent_event')")
|
|
||||||
el-switch(v-model='allow_recurrent_event')
|
|
||||||
|
|
||||||
el-form-item(v-show='allow_recurrent_event' :label="$t('admin.recurrent_event_visible')")
|
|
||||||
el-switch(v-model='recurrent_event_visible')
|
|
||||||
|
|
||||||
el-divider {{$t('admin.federation')}}
|
|
||||||
el-form(inline label-width='400px')
|
|
||||||
el-form-item(:label="$t('admin.enable_federation')")
|
|
||||||
el-switch(v-model='enable_federation')
|
|
||||||
|
|
||||||
//- el-form-item(:label="$t('admin.allow_boost_like')")
|
|
||||||
//- el-switch(v-model='allow_comments')
|
|
||||||
//- el-tab-pane.pt-1
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -77,19 +59,18 @@ import { mapState, mapActions } from 'vuex'
|
|||||||
import { Message, MessageBox } from 'element-ui'
|
import { Message, MessageBox } from 'element-ui'
|
||||||
import Users from '../components/admin/Users'
|
import Users from '../components/admin/Users'
|
||||||
import Places from '../components/admin/Places'
|
import Places from '../components/admin/Places'
|
||||||
|
import Settings from '../components/admin/Settings'
|
||||||
|
import Federation from '../components/admin/Federation'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Admin',
|
name: 'Admin',
|
||||||
components: { Users, Places },
|
components: { Users, Places, Settings, Federation },
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
perPage: 10,
|
perPage: 10,
|
||||||
eventPage: 1,
|
eventPage: 1,
|
||||||
tagPage: 1,
|
|
||||||
tagFields: ['tag', 'color'],
|
|
||||||
description: '',
|
description: '',
|
||||||
tag: { name: '', color: '' },
|
|
||||||
events: [],
|
events: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
tab: '0',
|
tab: '0',
|
||||||
@@ -108,50 +89,14 @@ export default {
|
|||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted () {
|
|
||||||
const code = this.$route.query.code
|
|
||||||
|
|
||||||
if (code) {
|
|
||||||
this.tab = '4'
|
|
||||||
const instance = await this.$axios.$post('/user/code', { code, is_admin: true })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['tags', 'settings']),
|
...mapState(['settings']),
|
||||||
allow_registration: {
|
|
||||||
get () { return this.settings.allow_registration },
|
|
||||||
set (value) { this.setSetting({ key: 'allow_registration', value }) }
|
|
||||||
},
|
|
||||||
allow_anon_event: {
|
|
||||||
get () { return this.settings.allow_anon_event },
|
|
||||||
set (value) { this.setSetting({ key: 'allow_anon_event', value }) }
|
|
||||||
},
|
|
||||||
allow_recurrent_event: {
|
|
||||||
get () { return this.settings.allow_recurrent_event },
|
|
||||||
set (value) { this.setSetting({ key: 'allow_recurrent_event', value }) }
|
|
||||||
},
|
|
||||||
recurrent_event_visible: {
|
|
||||||
get () { return this.settings.recurrent_event_visible },
|
|
||||||
set (value) { this.setSetting({ key: 'recurrent_event_visible', value }) }
|
|
||||||
},
|
|
||||||
enable_federation: {
|
|
||||||
get () { return this.settings.enable_federation },
|
|
||||||
set (value) { this.setSetting({ key: 'enable_federation', value }) }
|
|
||||||
},
|
|
||||||
paginatedEvents () {
|
paginatedEvents () {
|
||||||
return this.events.slice((this.eventPage - 1) * this.perPage,
|
return this.events.slice((this.eventPage - 1) * this.perPage,
|
||||||
this.eventPage * this.perPage)
|
this.eventPage * this.perPage)
|
||||||
},
|
},
|
||||||
paginatedTags () {
|
|
||||||
return this.tags.slice((this.tagPage - 1) * this.perPage,
|
|
||||||
this.tagPage * this.perPage)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['setSetting']),
|
|
||||||
tagSelected (tag) {
|
|
||||||
this.tag = { color: tag.color, tag: tag.tag }
|
|
||||||
},
|
|
||||||
preview (id) {
|
preview (id) {
|
||||||
this.$router.push(`/event/${id}`)
|
this.$router.push(`/event/${id}`)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user