2018-02-28 05:54:09 +00:00
|
|
|
<template lang='pug'>
|
2018-09-30 03:30:20 +00:00
|
|
|
v-container(fluid, grid-list-lg)
|
2018-02-28 05:54:09 +00:00
|
|
|
v-layout(row wrap)
|
|
|
|
v-flex(xs12)
|
2018-09-30 03:30:20 +00:00
|
|
|
.admin-header
|
2020-05-15 21:05:11 +00:00
|
|
|
img.animated.fadeInUp(src='/_assets/svg/icon-categorize.svg', alt='General', style='width: 80px;')
|
2018-09-30 03:30:20 +00:00
|
|
|
.admin-header-title
|
2019-04-07 16:37:33 +00:00
|
|
|
.headline.primary--text.animated.fadeInLeft {{ $t('admin:general.title') }}
|
2019-08-03 04:48:55 +00:00
|
|
|
.subtitle-1.grey--text.animated.fadeInLeft {{ $t('admin:general.subtitle') }}
|
2018-09-30 03:30:20 +00:00
|
|
|
v-spacer
|
2019-04-07 16:37:33 +00:00
|
|
|
v-btn.animated.fadeInDown(color='success', depressed, @click='save', large)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-icon(left) mdi-check
|
2018-09-30 03:30:20 +00:00
|
|
|
span {{$t('common:actions.apply')}}
|
2018-02-28 05:54:09 +00:00
|
|
|
v-form.pt-3
|
|
|
|
v-layout(row wrap)
|
|
|
|
v-flex(lg6 xs12)
|
2018-03-12 04:09:54 +00:00
|
|
|
v-form
|
2019-07-29 04:50:03 +00:00
|
|
|
v-card.animated.fadeInUp
|
2018-03-12 04:09:54 +00:00
|
|
|
v-toolbar(color='primary', dark, dense, flat)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-toolbar-title.subtitle-1 {{ $t('admin:general.siteInfo') }}
|
2019-08-03 04:48:55 +00:00
|
|
|
.overline.grey--text.pa-4 {{$t('admin:general.general')}}
|
2018-07-30 02:23:33 +00:00
|
|
|
.px-3.pb-3
|
2018-09-30 03:30:20 +00:00
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2019-06-10 03:39:37 +00:00
|
|
|
:label='$t(`admin:general.siteUrl`)'
|
2018-12-24 06:03:10 +00:00
|
|
|
required
|
|
|
|
:counter='255'
|
|
|
|
v-model='config.host'
|
2019-07-29 04:50:03 +00:00
|
|
|
prepend-icon='mdi-label-variant-outline'
|
2019-06-10 03:39:37 +00:00
|
|
|
:hint='$t(`admin:general.siteUrlHint`)'
|
2018-12-24 06:03:10 +00:00
|
|
|
persistent-hint
|
|
|
|
)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-text-field.mt-3(
|
|
|
|
outlined
|
2019-06-10 03:39:37 +00:00
|
|
|
:label='$t(`admin:general.siteTitle`)'
|
2018-09-30 03:30:20 +00:00
|
|
|
required
|
|
|
|
:counter='50'
|
2018-12-24 06:03:10 +00:00
|
|
|
v-model='config.title'
|
2019-07-29 04:50:03 +00:00
|
|
|
prepend-icon='mdi-earth'
|
2019-06-10 03:39:37 +00:00
|
|
|
:hint='$t(`admin:general.siteTitleHint`)'
|
2019-01-07 03:03:34 +00:00
|
|
|
persistent-hint
|
2018-09-30 03:30:20 +00:00
|
|
|
)
|
2018-07-30 02:23:33 +00:00
|
|
|
v-divider
|
2019-12-19 04:45:19 +00:00
|
|
|
.overline.grey--text.pa-4 {{$t('admin:general.logo')}}
|
|
|
|
.pt-2.pb-7.pl-10.pr-3
|
|
|
|
.d-flex.align-center
|
|
|
|
v-avatar(size='100', tile)
|
|
|
|
v-img(
|
|
|
|
:src='config.logoUrl'
|
|
|
|
lazy-src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNcWQ8AAdcBKrJda2oAAAAASUVORK5CYII='
|
|
|
|
aspect-ratio='1'
|
|
|
|
)
|
|
|
|
.ml-4(style='flex: 1 1 auto;')
|
|
|
|
v-text-field(
|
|
|
|
outlined
|
|
|
|
:label='$t(`admin:general.logoUrl`)'
|
|
|
|
v-model='config.logoUrl'
|
|
|
|
:hint='$t(`admin:general.logoUrlHint`)'
|
|
|
|
persistent-hint
|
|
|
|
append-icon='mdi-folder-image'
|
|
|
|
@click:append='browseLogo'
|
|
|
|
@keyup.enter='refreshLogo'
|
|
|
|
)
|
2019-05-26 01:38:29 +00:00
|
|
|
v-divider
|
2019-08-03 04:48:55 +00:00
|
|
|
.overline.grey--text.pa-4 {{$t('admin:general.footerCopyright')}}
|
2019-05-26 01:38:29 +00:00
|
|
|
.px-3.pb-3
|
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2019-06-10 03:39:37 +00:00
|
|
|
:label='$t(`admin:general.companyName`)'
|
2019-05-26 01:38:29 +00:00
|
|
|
v-model='config.company'
|
|
|
|
:counter='255'
|
2019-07-29 04:50:03 +00:00
|
|
|
prepend-icon='mdi-domain'
|
2019-05-26 01:38:29 +00:00
|
|
|
persistent-hint
|
2019-06-10 03:39:37 +00:00
|
|
|
:hint='$t(`admin:general.companyNameHint`)'
|
2019-05-26 01:38:29 +00:00
|
|
|
)
|
2020-02-23 20:20:55 +00:00
|
|
|
v-select.mt-3(
|
|
|
|
outlined
|
|
|
|
:label='$t(`admin:general.contentLicense`)'
|
|
|
|
:items='contentLicenses'
|
|
|
|
v-model='config.contentLicense'
|
|
|
|
prepend-icon='mdi-creative-commons'
|
|
|
|
:return-object='false'
|
|
|
|
:hint='$t(`admin:general.contentLicenseHint`)'
|
|
|
|
persistent-hint
|
|
|
|
)
|
2019-05-26 01:38:29 +00:00
|
|
|
v-divider
|
2019-08-03 04:48:55 +00:00
|
|
|
.overline.grey--text.pa-4 SEO
|
2018-07-30 02:23:33 +00:00
|
|
|
.px-3.pb-3
|
2018-09-30 03:30:20 +00:00
|
|
|
v-text-field(
|
2019-07-29 04:50:03 +00:00
|
|
|
outlined
|
2019-06-10 03:39:37 +00:00
|
|
|
:label='$t(`admin:general.siteDescription`)'
|
2018-09-30 03:30:20 +00:00
|
|
|
:counter='255'
|
2018-12-24 06:03:10 +00:00
|
|
|
v-model='config.description'
|
2019-07-29 04:50:03 +00:00
|
|
|
prepend-icon='mdi-compass'
|
2019-06-10 03:39:37 +00:00
|
|
|
:hint='$t(`admin:general.siteDescriptionHint`)'
|
2019-01-07 03:03:34 +00:00
|
|
|
persistent-hint
|
2018-09-30 03:30:20 +00:00
|
|
|
)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-select.mt-3(
|
|
|
|
outlined
|
2019-06-10 03:39:37 +00:00
|
|
|
:label='$t(`admin:general.metaRobots`)'
|
2018-12-24 06:03:10 +00:00
|
|
|
multiple
|
2018-09-30 03:30:20 +00:00
|
|
|
:items='metaRobots'
|
2018-12-24 06:03:10 +00:00
|
|
|
v-model='config.robots'
|
2019-07-29 04:50:03 +00:00
|
|
|
prepend-icon='mdi-compass'
|
2018-12-24 06:03:10 +00:00
|
|
|
:return-object='false'
|
2019-06-10 03:39:37 +00:00
|
|
|
:hint='$t(`admin:general.metaRobotsHint`)'
|
2018-12-24 06:03:10 +00:00
|
|
|
persistent-hint
|
2018-09-30 03:30:20 +00:00
|
|
|
)
|
2019-05-26 01:38:29 +00:00
|
|
|
|
2018-02-28 05:54:09 +00:00
|
|
|
v-flex(lg6 xs12)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-card.animated.fadeInUp.wait-p4s
|
2019-08-25 02:19:35 +00:00
|
|
|
v-toolbar(color='indigo', dark, dense, flat)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-toolbar-title.subtitle-1 Features
|
2018-05-12 20:13:04 +00:00
|
|
|
v-card-text
|
2020-05-15 21:05:11 +00:00
|
|
|
//- v-switch(
|
|
|
|
//- inset
|
|
|
|
//- label='Asset Image Optimization'
|
|
|
|
//- color='indigo'
|
|
|
|
//- v-model='config.featureTinyPNG'
|
|
|
|
//- persistent-hint
|
|
|
|
//- hint='Image optimization tool to reduce filesize and bandwidth costs.'
|
|
|
|
//- disabled
|
|
|
|
//- )
|
|
|
|
//- v-text-field.mt-3(
|
|
|
|
//- outlined
|
|
|
|
//- label='TinyPNG API Key'
|
|
|
|
//- :counter='255'
|
|
|
|
//- v-model='config.description'
|
|
|
|
//- prepend-icon='mdi-subdirectory-arrow-right'
|
|
|
|
//- hint='Get your API key at https://tinypng.com/developers'
|
|
|
|
//- persistent-hint
|
|
|
|
//- disabled
|
|
|
|
//- )
|
2019-05-26 01:38:29 +00:00
|
|
|
|
2020-05-15 21:05:11 +00:00
|
|
|
//- v-divider.mt-3
|
|
|
|
//- v-switch(
|
|
|
|
//- inset
|
|
|
|
//- label='Page Ratings'
|
|
|
|
//- color='indigo'
|
|
|
|
//- v-model='config.featurePageRatings'
|
|
|
|
//- persistent-hint
|
|
|
|
//- hint='Allow users to rate pages.'
|
|
|
|
//- disabled
|
|
|
|
//- )
|
2019-05-26 01:38:29 +00:00
|
|
|
|
2020-05-15 21:05:11 +00:00
|
|
|
//- v-divider.mt-3
|
2018-09-04 04:46:24 +00:00
|
|
|
v-switch(
|
2019-09-01 22:33:36 +00:00
|
|
|
inset
|
2020-05-17 02:46:05 +00:00
|
|
|
label='Comments'
|
2019-08-25 02:19:35 +00:00
|
|
|
color='indigo'
|
2018-12-24 06:03:10 +00:00
|
|
|
v-model='config.featurePageComments'
|
|
|
|
persistent-hint
|
|
|
|
hint='Allow users to leave comments on pages.'
|
|
|
|
)
|
2019-05-26 01:38:29 +00:00
|
|
|
|
2020-05-15 21:05:11 +00:00
|
|
|
//- v-divider.mt-3
|
|
|
|
//- v-switch(
|
|
|
|
//- inset
|
|
|
|
//- label='Personal Wikis'
|
|
|
|
//- color='indigo'
|
|
|
|
//- v-model='config.featurePersonalWikis'
|
|
|
|
//- persistent-hint
|
|
|
|
//- hint='Allow users to have their own personal wiki.'
|
|
|
|
//- disabled
|
|
|
|
//- )
|
2018-02-28 05:54:09 +00:00
|
|
|
|
2022-06-25 02:20:36 +00:00
|
|
|
v-card.mt-5.animated.fadeInUp.wait-p6s
|
|
|
|
v-toolbar(color='primary', dark, dense, flat)
|
|
|
|
v-toolbar-title.subtitle-1 URL Handling
|
|
|
|
v-card-text
|
|
|
|
v-text-field(
|
|
|
|
outlined
|
|
|
|
:label='$t(`admin:general.pageExtensions`)'
|
|
|
|
v-model='config.pageExtensions'
|
|
|
|
prepend-icon='mdi-format-text-wrapping-overflow'
|
|
|
|
:hint='$t(`admin:general.pageExtensionsHint`)'
|
|
|
|
persistent-hint
|
|
|
|
)
|
|
|
|
|
2019-12-19 04:45:19 +00:00
|
|
|
component(:is='activeModal')
|
2019-08-25 02:19:35 +00:00
|
|
|
|
2018-02-28 05:54:09 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-12-24 06:03:10 +00:00
|
|
|
import _ from 'lodash'
|
2020-05-08 22:48:07 +00:00
|
|
|
import { sync } from 'vuex-pathify'
|
2020-02-23 20:20:55 +00:00
|
|
|
import gql from 'graphql-tag'
|
2018-08-04 21:27:55 +00:00
|
|
|
|
2019-12-19 04:45:19 +00:00
|
|
|
import editorStore from '../../store/editor'
|
|
|
|
|
|
|
|
/* global WIKI */
|
|
|
|
|
2020-08-23 16:58:56 +00:00
|
|
|
const titleRegex = /[<>"]/i
|
|
|
|
|
2019-12-19 04:45:19 +00:00
|
|
|
WIKI.$store.registerModule('editor', editorStore)
|
|
|
|
|
2018-02-28 05:54:09 +00:00
|
|
|
export default {
|
2019-12-19 04:45:19 +00:00
|
|
|
i18nOptions: { namespaces: 'editor' },
|
|
|
|
components: {
|
|
|
|
editorModalMedia: () => import(/* webpackChunkName: "editor", webpackMode: "lazy" */ '../editor/editor-modal-media.vue')
|
|
|
|
},
|
2018-02-28 05:54:09 +00:00
|
|
|
data() {
|
2018-03-03 06:32:58 +00:00
|
|
|
return {
|
2018-12-24 06:03:10 +00:00
|
|
|
config: {
|
|
|
|
host: '',
|
|
|
|
title: '',
|
|
|
|
description: '',
|
|
|
|
robots: [],
|
2019-01-01 22:03:30 +00:00
|
|
|
analyticsService: '',
|
|
|
|
analyticsId: '',
|
2018-12-24 06:03:10 +00:00
|
|
|
company: '',
|
2020-02-23 20:20:55 +00:00
|
|
|
contentLicense: '',
|
2019-12-19 04:45:19 +00:00
|
|
|
logoUrl: '',
|
2019-05-26 01:38:29 +00:00
|
|
|
featureAnalytics: false,
|
2018-12-24 06:03:10 +00:00
|
|
|
featurePageRatings: false,
|
|
|
|
featurePageComments: false,
|
2019-05-26 01:38:29 +00:00
|
|
|
featurePersonalWikis: false,
|
2022-06-25 02:20:36 +00:00
|
|
|
featureTinyPNG: false,
|
|
|
|
pageExtensions: ''
|
2019-08-25 02:19:35 +00:00
|
|
|
},
|
|
|
|
metaRobots: [
|
|
|
|
{ text: 'Index', value: 'index' },
|
|
|
|
{ text: 'Follow', value: 'follow' },
|
|
|
|
{ text: 'No Index', value: 'noindex' },
|
|
|
|
{ text: 'No Follow', value: 'nofollow' }
|
|
|
|
]
|
2018-03-03 06:32:58 +00:00
|
|
|
}
|
2018-08-04 21:27:55 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
siteTitle: sync('site/title'),
|
2019-12-19 04:45:19 +00:00
|
|
|
logoUrl: sync('site/logoUrl'),
|
|
|
|
company: sync('site/company'),
|
2020-02-23 20:20:55 +00:00
|
|
|
contentLicense: sync('site/contentLicense'),
|
|
|
|
activeModal: sync('editor/activeModal'),
|
|
|
|
contentLicenses () {
|
|
|
|
return [
|
|
|
|
{ value: '', text: this.$t('common:license.none') },
|
|
|
|
{ value: 'alr', text: this.$t('common:license.alr') },
|
|
|
|
{ value: 'cc0', text: this.$t('common:license.cc0') },
|
|
|
|
{ value: 'ccby', text: this.$t('common:license.ccby') },
|
|
|
|
{ value: 'ccbysa', text: this.$t('common:license.ccbysa') },
|
|
|
|
{ value: 'ccbynd', text: this.$t('common:license.ccbynd') },
|
|
|
|
{ value: 'ccbync', text: this.$t('common:license.ccbync') },
|
|
|
|
{ value: 'ccbyncsa', text: this.$t('common:license.ccbyncsa') },
|
|
|
|
{ value: 'ccbyncnd', text: this.$t('common:license.ccbyncnd') }
|
|
|
|
]
|
|
|
|
}
|
2018-09-04 04:46:24 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async save () {
|
2020-08-23 16:58:56 +00:00
|
|
|
const title = _.get(this.config, 'title', '')
|
|
|
|
if (titleRegex.test(title)) {
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
style: 'error',
|
|
|
|
message: this.$t('admin:general.siteTitleInvalidChars'),
|
|
|
|
icon: 'alert'
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
2018-12-24 06:03:10 +00:00
|
|
|
try {
|
|
|
|
await this.$apollo.mutate({
|
2020-02-23 20:20:55 +00:00
|
|
|
mutation: gql`
|
|
|
|
mutation (
|
2022-06-25 02:20:36 +00:00
|
|
|
$host: String
|
|
|
|
$title: String
|
|
|
|
$description: String
|
|
|
|
$robots: [String]
|
|
|
|
$analyticsService: String
|
|
|
|
$analyticsId: String
|
|
|
|
$company: String
|
|
|
|
$contentLicense: String
|
|
|
|
$logoUrl: String
|
|
|
|
$pageExtensions: String
|
|
|
|
$featurePageRatings: Boolean
|
|
|
|
$featurePageComments: Boolean
|
|
|
|
$featurePersonalWikis: Boolean
|
2020-02-23 20:20:55 +00:00
|
|
|
) {
|
|
|
|
site {
|
|
|
|
updateConfig(
|
2022-06-25 02:20:36 +00:00
|
|
|
host: $host
|
|
|
|
title: $title
|
|
|
|
description: $description
|
|
|
|
robots: $robots
|
|
|
|
analyticsService: $analyticsService
|
|
|
|
analyticsId: $analyticsId
|
|
|
|
company: $company
|
|
|
|
contentLicense: $contentLicense
|
|
|
|
logoUrl: $logoUrl
|
|
|
|
pageExtensions: $pageExtensions
|
|
|
|
featurePageRatings: $featurePageRatings
|
|
|
|
featurePageComments: $featurePageComments
|
2020-05-10 19:55:28 +00:00
|
|
|
featurePersonalWikis: $featurePersonalWikis
|
2020-02-23 20:20:55 +00:00
|
|
|
) {
|
|
|
|
responseResult {
|
|
|
|
succeeded
|
|
|
|
errorCode
|
|
|
|
slug
|
|
|
|
message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`,
|
2018-12-24 06:03:10 +00:00
|
|
|
variables: {
|
2019-08-25 02:19:35 +00:00
|
|
|
host: _.get(this.config, 'host', ''),
|
|
|
|
title: _.get(this.config, 'title', ''),
|
|
|
|
description: _.get(this.config, 'description', ''),
|
|
|
|
robots: _.get(this.config, 'robots', []),
|
|
|
|
analyticsService: _.get(this.config, 'analyticsService', ''),
|
|
|
|
analyticsId: _.get(this.config, 'analyticsId', ''),
|
|
|
|
company: _.get(this.config, 'company', ''),
|
2020-02-23 20:20:55 +00:00
|
|
|
contentLicense: _.get(this.config, 'contentLicense', ''),
|
2019-12-19 04:45:19 +00:00
|
|
|
logoUrl: _.get(this.config, 'logoUrl', ''),
|
2022-06-25 02:20:36 +00:00
|
|
|
pageExtensions: _.get(this.config, 'pageExtensions', ''),
|
2019-08-25 02:19:35 +00:00
|
|
|
featurePageRatings: _.get(this.config, 'featurePageRatings', false),
|
|
|
|
featurePageComments: _.get(this.config, 'featurePageComments', false),
|
2020-05-10 19:55:28 +00:00
|
|
|
featurePersonalWikis: _.get(this.config, 'featurePersonalWikis', false)
|
2018-12-24 06:03:10 +00:00
|
|
|
},
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
style: 'success',
|
2020-08-23 16:58:56 +00:00
|
|
|
message: this.$t('admin:general.saveSuccess'),
|
2018-12-24 06:03:10 +00:00
|
|
|
icon: 'check'
|
|
|
|
})
|
|
|
|
this.siteTitle = this.config.title
|
|
|
|
this.company = this.config.company
|
2020-02-23 20:20:55 +00:00
|
|
|
this.contentLicense = this.config.contentLicense
|
2019-12-19 04:45:19 +00:00
|
|
|
this.logoUrl = this.config.logoUrl
|
2018-12-24 06:03:10 +00:00
|
|
|
} catch (err) {
|
2019-01-13 03:33:30 +00:00
|
|
|
this.$store.commit('pushGraphError', err)
|
2018-12-24 06:03:10 +00:00
|
|
|
}
|
2019-12-19 04:45:19 +00:00
|
|
|
},
|
|
|
|
browseLogo () {
|
|
|
|
this.$store.set('editor/editorKey', 'common')
|
|
|
|
this.activeModal = 'editorModalMedia'
|
|
|
|
},
|
|
|
|
refreshLogo () {
|
|
|
|
this.$forceUpdate()
|
2018-12-24 06:03:10 +00:00
|
|
|
}
|
|
|
|
},
|
2019-12-19 04:45:19 +00:00
|
|
|
mounted () {
|
|
|
|
this.$root.$on('editorInsert', opts => {
|
|
|
|
this.config.logoUrl = opts.path
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
this.$root.$off('editorInsert')
|
|
|
|
},
|
2018-12-24 06:03:10 +00:00
|
|
|
apollo: {
|
|
|
|
config: {
|
2020-02-23 20:20:55 +00:00
|
|
|
query: gql`
|
|
|
|
{
|
|
|
|
site {
|
|
|
|
config {
|
|
|
|
host
|
|
|
|
title
|
|
|
|
description
|
|
|
|
robots
|
|
|
|
analyticsService
|
|
|
|
analyticsId
|
|
|
|
company
|
|
|
|
contentLicense
|
|
|
|
logoUrl
|
2022-06-25 02:20:36 +00:00
|
|
|
pageExtensions
|
2020-02-23 20:20:55 +00:00
|
|
|
featurePageRatings
|
|
|
|
featurePageComments
|
|
|
|
featurePersonalWikis
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`,
|
2018-12-24 06:03:10 +00:00
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => _.cloneDeep(data.site.config),
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
|
|
|
|
}
|
2018-09-04 04:46:24 +00:00
|
|
|
}
|
2018-02-28 05:54:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang='scss'>
|
|
|
|
|
|
|
|
</style>
|