Skip to content

Commit

Permalink
feat: footer text override option
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Feb 17, 2023
1 parent f972a9c commit e954b50
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 3 deletions.
15 changes: 15 additions & 0 deletions client/components/admin/admin-general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@
:return-object='false'
:hint='$t(`admin:general.contentLicenseHint`)'
persistent-hint
)
v-text-field.mt-3(
outlined
:label='$t(`admin:general.footerOverride`)'
v-model='config.footerOverride'
prepend-icon='mdi-page-layout-footer'
persistent-hint
:hint='$t(`admin:general.footerOverrideHint`)'
)
v-divider
.overline.grey--text.pa-4 SEO
Expand Down Expand Up @@ -280,6 +288,7 @@ export default {
analyticsId: '',
company: '',
contentLicense: '',
footerOverride: '',
logoUrl: '',
featureAnalytics: false,
featurePageRatings: false,
Expand Down Expand Up @@ -308,6 +317,7 @@ export default {
logoUrl: sync('site/logoUrl'),
company: sync('site/company'),
contentLicense: sync('site/contentLicense'),
footerOverride: sync('site/footerOverride'),
activeModal: sync('editor/activeModal'),
contentLicenses () {
return [
Expand Down Expand Up @@ -346,6 +356,7 @@ export default {
$analyticsId: String
$company: String
$contentLicense: String
$footerOverride: String
$logoUrl: String
$pageExtensions: String
$featurePageRatings: Boolean
Expand All @@ -369,6 +380,7 @@ export default {
analyticsId: $analyticsId
company: $company
contentLicense: $contentLicense
footerOverride: $footerOverride
logoUrl: $logoUrl
pageExtensions: $pageExtensions
featurePageRatings: $featurePageRatings
Expand Down Expand Up @@ -401,6 +413,7 @@ export default {
analyticsId: _.get(this.config, 'analyticsId', ''),
company: _.get(this.config, 'company', ''),
contentLicense: _.get(this.config, 'contentLicense', ''),
footerOverride: _.get(this.config, 'footerOverride', ''),
logoUrl: _.get(this.config, 'logoUrl', ''),
pageExtensions: _.get(this.config, 'pageExtensions', ''),
featurePageRatings: _.get(this.config, 'featurePageRatings', false),
Expand All @@ -426,6 +439,7 @@ export default {
this.siteTitle = this.config.title
this.company = this.config.company
this.contentLicense = this.config.contentLicense
this.footerOverride = this.config.footerOverride
this.logoUrl = this.config.logoUrl
} catch (err) {
this.$store.commit('pushGraphError', err)
Expand Down Expand Up @@ -461,6 +475,7 @@ export default {
analyticsId
company
contentLicense
footerOverride
logoUrl
pageExtensions
featurePageRatings
Expand Down
1 change: 1 addition & 0 deletions client/store/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { make } from 'vuex-pathify'
const state = {
company: siteConfig.company,
contentLicense: siteConfig.contentLicense,
footerOverride: siteConfig.footerOverride,
dark: siteConfig.darkMode,
tocPosition: siteConfig.tocPosition,
mascot: true,
Expand Down
5 changes: 4 additions & 1 deletion client/themes/default/components/nav-footer.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template lang="pug">
v-footer.justify-center(:color='bgColor', inset)
.caption.grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-1`')
template(v-if='company && company.length > 0 && contentLicense !== ``')
template(v-if='footerOverride')
span {{footerOverride}} |&nbsp;
template(v-else-if='company && company.length > 0 && contentLicense !== ``')
span(v-if='contentLicense === `alr`') {{ $t('common:footer.copyright', { company: company, year: currentYear, interpolation: { escapeValue: false } }) }} |&nbsp;
span(v-else) {{ $t('common:footer.license', { company: company, license: $t('common:license.' + contentLicense), interpolation: { escapeValue: false } }) }} |&nbsp;
span {{ $t('common:footer.poweredBy') }} #[a(href='https://wiki.js.org', ref='nofollow') Wiki.js]
Expand Down Expand Up @@ -29,6 +31,7 @@ export default {
computed: {
company: get('site/company'),
contentLicense: get('site/contentLicense'),
footerOverride: get('site/footerOverride'),
bgColor() {
if (!this.$vuetify.theme.dark) {
return this.color
Expand Down
1 change: 1 addition & 0 deletions server/app/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ defaults:
title: Wiki.js
company: ''
contentLicense: ''
footerOverride: ''
logoUrl: https://static.requarks.io/logo/wikijs-butterfly.svg
pageExtensions:
- md
Expand Down
7 changes: 6 additions & 1 deletion server/graph/resolvers/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
title: WIKI.config.title,
company: WIKI.config.company,
contentLicense: WIKI.config.contentLicense,
footerOverride: WIKI.config.footerOverride,
logoUrl: WIKI.config.logoUrl,
pageExtensions: WIKI.config.pageExtensions.join(', '),
...WIKI.config.seo,
Expand Down Expand Up @@ -60,6 +61,10 @@ module.exports = {
WIKI.config.contentLicense = args.contentLicense
}

if (args.hasOwnProperty('footerOverride')) {
WIKI.config.footerOverride = args.footerOverride
}

if (args.hasOwnProperty('logoUrl')) {
WIKI.config.logoUrl = _.trim(args.logoUrl)
}
Expand Down Expand Up @@ -120,7 +125,7 @@ module.exports = {
forceDownload: _.get(args, 'uploadForceDownload', WIKI.config.uploads.forceDownload)
}

await WIKI.configSvc.saveToDb(['host', 'title', 'company', 'contentLicense', 'seo', 'logoUrl', 'pageExtensions', 'auth', 'editShortcuts', 'features', 'security', 'uploads'])
await WIKI.configSvc.saveToDb(['host', 'title', 'company', 'contentLicense', 'footerOverride', 'seo', 'logoUrl', 'pageExtensions', 'auth', 'editShortcuts', 'features', 'security', 'uploads'])

if (WIKI.config.security.securityTrustProxy) {
WIKI.app.enable('trust proxy')
Expand Down
2 changes: 2 additions & 0 deletions server/graph/schemas/site.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type SiteMutation {
analyticsId: String
company: String
contentLicense: String
footerOverride: String
logoUrl: String
pageExtensions: String
authAutoLogin: Boolean
Expand Down Expand Up @@ -81,6 +82,7 @@ type SiteConfig {
analyticsId: String
company: String
contentLicense: String
footerOverride: String
logoUrl: String
pageExtensions: String
authAutoLogin: Boolean
Expand Down
1 change: 1 addition & 0 deletions server/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ module.exports = async () => {
rtl: WIKI.config.lang.rtl,
company: WIKI.config.company,
contentLicense: WIKI.config.contentLicense,
footerOverride: WIKI.config.footerOverride,
logoUrl: WIKI.config.logoUrl
}
res.locals.langs = await WIKI.models.locales.getNavLocales({ cache: true })
Expand Down
2 changes: 1 addition & 1 deletion server/modules/storage/git/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ module.exports = {
fNames.old = fMatch[1]
fNames.new = fMatch[4]
} else {
fNames.old = (fMatch[1] + fMatch[2] + fMatch[4]).replace('//', '/'),
fNames.old = (fMatch[1] + fMatch[2] + fMatch[4]).replace('//', '/')
fNames.new = (fMatch[1] + fMatch[3] + fMatch[4]).replace('//', '/')
}
const fPath = path.join(this.repoPath, fNames.new)
Expand Down

0 comments on commit e954b50

Please sign in to comment.