mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
236 lines
8.4 KiB
236 lines
8.4 KiB
<template lang='pug'>
|
|
v-container(fluid, grid-list-lg)
|
|
v-layout(row wrap)
|
|
v-flex(xs12)
|
|
.admin-header
|
|
img(src='/svg/icon-categorize.svg', alt='General', style='width: 80px;')
|
|
.admin-header-title
|
|
.headline.primary--text {{ $t('admin:general.title') }}
|
|
.subheading.grey--text {{ $t('admin:general.subtitle') }}
|
|
v-spacer
|
|
v-btn(color='success', depressed, @click='save', large)
|
|
v-icon(left) check
|
|
span {{$t('common:actions.apply')}}
|
|
v-form.pt-3
|
|
v-layout(row wrap)
|
|
v-flex(lg6 xs12)
|
|
v-form
|
|
v-card.wiki-form
|
|
v-toolbar(color='primary', dark, dense, flat)
|
|
v-toolbar-title
|
|
.subheading {{ $t('admin:general.siteInfo') }}
|
|
v-subheader General
|
|
.px-3.pb-3
|
|
v-text-field(
|
|
outline
|
|
label='Site URL'
|
|
required
|
|
:counter='255'
|
|
v-model='config.host'
|
|
prepend-icon='label_important'
|
|
hint='Full URL to your wiki, without the trailing slash. (e.g. https://wiki.example.com)'
|
|
persistent-hint
|
|
)
|
|
v-text-field.mt-2(
|
|
outline
|
|
label='Site Title'
|
|
required
|
|
:counter='50'
|
|
v-model='config.title'
|
|
prepend-icon='public'
|
|
)
|
|
v-divider
|
|
v-subheader SEO
|
|
.px-3.pb-3
|
|
v-text-field(
|
|
outline
|
|
label='Site Description'
|
|
:counter='255'
|
|
v-model='config.description'
|
|
prepend-icon='explore'
|
|
)
|
|
v-select.mt-2(
|
|
outline
|
|
label='Meta Robots'
|
|
multiple
|
|
:items='metaRobots'
|
|
v-model='config.robots'
|
|
prepend-icon='explore'
|
|
:return-object='false'
|
|
hint='Default: Index, Follow'
|
|
persistent-hint
|
|
)
|
|
v-divider
|
|
v-subheader Analytics
|
|
.px-3.pb-3
|
|
v-text-field(
|
|
outline
|
|
label='Google Analytics ID'
|
|
:counter='255'
|
|
v-model='config.ga'
|
|
prepend-icon='timeline'
|
|
persistent-hint
|
|
hint='Property tracking ID for Google Analytics. Leave empty to disable.'
|
|
)
|
|
v-flex(lg6 xs12)
|
|
v-card.wiki-form
|
|
v-toolbar(color='primary', dark, dense, flat)
|
|
v-toolbar-title
|
|
.subheading {{ $t('admin:general.siteBranding') }}
|
|
v-spacer
|
|
v-chip(label, color='white', small).primary--text coming soon
|
|
v-subheader Logo
|
|
v-card-text
|
|
v-layout.px-3(row, align-center)
|
|
v-avatar(size='120', :color='$vuetify.dark ? `grey darken-2` : `grey lighten-3`', :tile='config.logoIsSquare')
|
|
.ml-4
|
|
v-layout(row, align-center)
|
|
v-btn(color='teal', depressed, dark)
|
|
v-icon(left) cloud_upload
|
|
span Upload Logo
|
|
v-btn(color='teal', depressed, disabled)
|
|
v-icon(left) clear
|
|
span Clear
|
|
.caption.grey--text An image of 120x120 pixels is recommended for best results.
|
|
.caption.grey--text SVG, PNG or JPG files only.
|
|
v-switch(
|
|
v-model='config.logoIsSquare'
|
|
label='Use Square Logo Frame'
|
|
color='primary'
|
|
persistent-hint
|
|
hint='Check this option if a round logo frame doesn\'t work with your logo.'
|
|
)
|
|
v-divider
|
|
v-subheader Footer Copyright
|
|
.px-3.pb-3
|
|
v-text-field(
|
|
outline
|
|
label='Company / Organization Name'
|
|
v-model='config.company'
|
|
:counter='255'
|
|
prepend-icon='business'
|
|
persistent-hint
|
|
hint='Name to use when displaying copyright notice in the footer. Leave empty to hide.'
|
|
)
|
|
|
|
v-card.wiki-form.mt-3
|
|
v-toolbar(color='primary', dark, dense, flat)
|
|
v-toolbar-title
|
|
.subheading Features
|
|
v-card-text
|
|
v-switch(
|
|
label='Page Ratings'
|
|
color='primary'
|
|
v-model='config.featurePageRatings'
|
|
persistent-hint
|
|
hint='Allow users to rate pages.'
|
|
)
|
|
v-divider.mt-3
|
|
v-switch(
|
|
label='Page Comments'
|
|
color='primary'
|
|
v-model='config.featurePageComments'
|
|
persistent-hint
|
|
hint='Allow users to leave comments on pages.'
|
|
)
|
|
v-divider.mt-3
|
|
v-switch(
|
|
label='Personal Wikis'
|
|
color='primary'
|
|
v-model='config.featurePersonalWikis'
|
|
persistent-hint
|
|
hint='Allow users to have their own personal wiki.'
|
|
)
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import _ from 'lodash'
|
|
import { get, sync } from 'vuex-pathify'
|
|
import siteConfigQuery from 'gql/admin/site/site-query-config.gql'
|
|
import siteUpdateConfigMutation from 'gql/admin/site/site-mutation-save-config.gql'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
metaRobots: [
|
|
{ text: 'Index', value: 'index' },
|
|
{ text: 'Follow', value: 'follow' },
|
|
{ text: 'No Index', value: 'noindex' },
|
|
{ text: 'No Follow', value: 'nofollow' }
|
|
],
|
|
config: {
|
|
host: '',
|
|
title: '',
|
|
description: '',
|
|
robots: [],
|
|
ga: '',
|
|
company: '',
|
|
hasLogo: false,
|
|
logoIsSquare: false,
|
|
featurePageRatings: false,
|
|
featurePageComments: false,
|
|
featurePersonalWikis: false
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
darkMode: get('site/dark'),
|
|
siteTitle: sync('site/title'),
|
|
company: sync('site/company')
|
|
},
|
|
methods: {
|
|
async save () {
|
|
try {
|
|
await this.$apollo.mutate({
|
|
mutation: siteUpdateConfigMutation,
|
|
variables: {
|
|
host: this.config.host || '',
|
|
title: this.config.title || '',
|
|
description: this.config.description || '',
|
|
robots: this.config.robots || [],
|
|
ga: this.config.ga || '',
|
|
company: this.config.company || '',
|
|
hasLogo: this.config.hasLogo || false,
|
|
logoIsSquare: this.config.logoIsSquare || false,
|
|
featurePageRatings: this.config.featurePageRatings || false,
|
|
featurePageComments: this.config.featurePageComments || false,
|
|
featurePersonalWikis: this.config.featurePersonalWikis || false
|
|
},
|
|
watchLoading (isLoading) {
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
|
|
}
|
|
})
|
|
this.$store.commit('showNotification', {
|
|
style: 'success',
|
|
message: 'Configuration saved successfully.',
|
|
icon: 'check'
|
|
})
|
|
this.siteTitle = this.config.title
|
|
this.company = this.config.company
|
|
} catch (err) {
|
|
this.$store.commit('showNotification', {
|
|
style: 'red',
|
|
message: err.message,
|
|
icon: 'warning'
|
|
})
|
|
}
|
|
}
|
|
},
|
|
apollo: {
|
|
config: {
|
|
query: siteConfigQuery,
|
|
fetchPolicy: 'network-only',
|
|
update: (data) => _.cloneDeep(data.site.config),
|
|
watchLoading (isLoading) {
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang='scss'>
|
|
|
|
</style>
|