[feat] Split federation/settings admin components

This commit is contained in:
les
2019-10-20 14:07:09 +02:00
parent e818483d85
commit 4a03d60667
6 changed files with 113 additions and 72 deletions

View 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>

View 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>

View File

@@ -4,7 +4,7 @@ div
el-collapse
el-collapse-item
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-item(:label="$t('common.username')")
el-input(v-model='new_user.username')

View File

@@ -0,0 +1,4 @@
export default [
'Europe/Rome',
'Europe/Paris',
]