feat: footer + data store fixes

pull/6078/head
Nicolas Giard 2 years ago
parent c9504ed6f4
commit f671d3b1ec
No known key found for this signature in database
GPG Key ID: 85061B8F9D55B7C8

@ -956,7 +956,7 @@ module.exports = class Page extends Model {
} else { } else {
// -> No render? Possible duplicate issue // -> No render? Possible duplicate issue
/* TODO: Detect duplicate and delete */ /* TODO: Detect duplicate and delete */
throw new Error('Error while fetching page. Duplicate entry detected. Reload the page to try again.') throw new Error('Error while fetching page. No rendered version of this page exists. Try to edit the page and save it again.')
} }
} }
} }

@ -0,0 +1,86 @@
<template lang="pug">
q-footer.site-footer
.site-footer-line
i18n-t.q-mr-xs(
v-if='hasSiteFooter'
:keypath='isCopyright ? `common.footerCopyright` : `common.footerLicense`'
tag='span'
)
template(#company)
strong {{siteStore.company}}
template(#year)
span {{currentYear}}
template(#license)
span {{t(`common.license.` + siteStore.contentLicense)}}
i18n-t(
:keypath='props.generic ? `common.footerGeneric` : `common.footerPoweredBy`'
tag='span'
)
template(#link)
a(href='https://js.wiki', target='_blank', ref='noopener noreferrer'): strong Wiki.js
.site-footer-line(v-if='!props.generic && siteStore.footerExtra')
span {{ siteStore.footerExtra }}
</template>
<script setup>
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useSiteStore } from 'src/stores/site'
// PROPS
const props = defineProps({
generic: {
type: Boolean,
default: false
}
})
// STORES
const siteStore = useSiteStore()
// I18N
const { t } = useI18n()
// DATA
const currentYear = new Date().getFullYear()
// COMPUTED
const hasSiteFooter = computed(() => {
return !props.generic && siteStore.company && siteStore.contentLicense
})
const isCopyright = computed(() => {
return siteStore.contentLicense === 'alr'
})
</script>
<style lang="scss">
.site-footer {
background-color: $grey-3;
color: $grey-8;
padding: 4px 12px;
font-size: 11px;
&-line {
text-align: center;
a {
text-decoration: none;
color: inherit;
&:hover, &:focus {
text-decoration: underline;
}
}
& + .q-bar {
height: 18px;
}
}
}
</style>

@ -143,7 +143,7 @@ q-layout(view='hHh lpR fFf', container)
q-select( q-select(
outlined outlined
v-model='state.user.prefs.timezone' v-model='state.user.prefs.timezone'
:options='dataStore.timezones' :options='timezones'
option-value='value' option-value='value'
option-label='text' option-label='text'
emit-value emit-value
@ -515,7 +515,6 @@ import { computed, onMounted, reactive, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { useAdminStore } from 'src/stores/admin' import { useAdminStore } from 'src/stores/admin'
import { useDataStore } from 'src/stores/data'
import UserChangePwdDialog from './UserChangePwdDialog.vue' import UserChangePwdDialog from './UserChangePwdDialog.vue'
import UtilCodeEditor from './UtilCodeEditor.vue' import UtilCodeEditor from './UtilCodeEditor.vue'
@ -527,7 +526,6 @@ const $q = useQuasar()
// STORES // STORES
const adminStore = useAdminStore() const adminStore = useAdminStore()
const dataStore = useDataStore()
// ROUTER // ROUTER
@ -562,6 +560,8 @@ const sections = [
{ key: 'operations', text: t('admin.users.operations'), icon: 'las la-tools' } { key: 'operations', text: t('admin.users.operations'), icon: 'las la-tools' }
] ]
const timezones = Intl.supportedValuesOf('timeZone')
// COMPUTED // COMPUTED
const metadata = computed({ const metadata = computed({

@ -1185,9 +1185,10 @@
"common.field.lastUpdated": "Last Updated", "common.field.lastUpdated": "Last Updated",
"common.field.name": "Name", "common.field.name": "Name",
"common.field.task": "Task", "common.field.task": "Task",
"common.footer.copyright": "© {year} {company}. All rights reserved.", "common.footerGeneric": "Powered by {link}, an open source project.",
"common.footer.license": "Content is available under the {license}, by {company}.", "common.footerPoweredBy": "Powered by {link}",
"common.footer.poweredBy": "Powered by", "common.footerCopyright": "© {year} {company}. All rights reserved.",
"common.footerLicense": "Content is available under the {license}, by {company}.",
"common.header.account": "Account", "common.header.account": "Account",
"common.header.admin": "Administration", "common.header.admin": "Administration",
"common.header.assets": "Assets", "common.header.assets": "Assets",

@ -205,9 +205,7 @@ q-layout.admin(view='hHh Lpr lff')
transition-hide='jump-down' transition-hide='jump-down'
) )
component(:is='overlays[adminStore.overlay]') component(:is='overlays[adminStore.overlay]')
q-footer.admin-footer footer-nav.admin-footer(generic)
q-bar.justify-center(dense)
span(style='font-size: 11px;') Powered by #[a(href='https://js.wiki', target='_blank'): strong Wiki.js], an open source project.
</template> </template>
<script setup> <script setup>
@ -222,6 +220,7 @@ import { useSiteStore } from '../stores/site'
// COMPONENTS // COMPONENTS
import AccountMenu from '../components/AccountMenu.vue' import AccountMenu from '../components/AccountMenu.vue'
import FooterNav from 'src/components/FooterNav.vue'
const overlays = { const overlays = {
GroupEditOverlay: defineAsyncComponent(() => import('../components/GroupEditOverlay.vue')), GroupEditOverlay: defineAsyncComponent(() => import('../components/GroupEditOverlay.vue')),
UserEditOverlay: defineAsyncComponent(() => import('../components/UserEditOverlay.vue')) UserEditOverlay: defineAsyncComponent(() => import('../components/UserEditOverlay.vue'))

@ -76,9 +76,7 @@ q-layout(view='hHh Lpr lff')
round round
size='md' size='md'
) )
q-footer footer-nav
q-bar.justify-center(dense)
span(style='font-size: 11px;') &copy; Cyberdyne Systems Corp. 2020 | Powered by #[strong Wiki.js]
</template> </template>
<script setup> <script setup>
@ -91,8 +89,8 @@ import { useSiteStore } from '../stores/site'
// COMPONENTS // COMPONENTS
import AccountMenu from '../components/AccountMenu.vue'
import HeaderNav from '../components/HeaderNav.vue' import HeaderNav from '../components/HeaderNav.vue'
import FooterNav from 'src/components/FooterNav.vue'
// QUASAR // QUASAR
@ -121,11 +119,7 @@ useMeta({
const leftDrawerOpen = ref(true) const leftDrawerOpen = ref(true)
const search = ref('') const search = ref('')
const user = reactive({
name: 'John Doe',
email: 'test@example.com',
picture: null
})
const thumbStyle = { const thumbStyle = {
right: '2px', right: '2px',
borderRadius: '5px', borderRadius: '5px',

@ -39,9 +39,7 @@ q-layout(view='hHh Lpr lff')
q-item-section q-item-section
q-item-label.text-negative {{ t('common.header.logout') }} q-item-label.text-negative {{ t('common.header.logout') }}
router-view router-view
q-footer footer-nav
q-bar.justify-center(dense)
span(style='font-size: 11px;') &copy; Cyberdyne Systems Corp. 2020 | Powered by #[strong Wiki.js]
</template> </template>
<script setup> <script setup>
@ -52,7 +50,8 @@ import { onMounted, reactive, watch } from 'vue'
import { useSiteStore } from 'src/stores/site' import { useSiteStore } from 'src/stores/site'
import { useUserStore } from 'src/stores/user' import { useUserStore } from 'src/stores/user'
import HeaderNav from '../components/HeaderNav.vue' import HeaderNav from 'src/components/HeaderNav.vue'
import FooterNav from 'src/components/FooterNav.vue'
// QUASAR // QUASAR

@ -106,7 +106,6 @@ import { computed, onMounted, reactive, watch } from 'vue'
import { useAdminStore } from 'src/stores/admin' import { useAdminStore } from 'src/stores/admin'
import { useSiteStore } from 'src/stores/site' import { useSiteStore } from 'src/stores/site'
import { useDataStore } from 'src/stores/data'
// QUASAR // QUASAR
@ -116,7 +115,6 @@ const $q = useQuasar()
const adminStore = useAdminStore() const adminStore = useAdminStore()
const siteStore = useSiteStore() const siteStore = useSiteStore()
const dataStore = useDataStore()
// I18N // I18N

@ -330,7 +330,7 @@ q-page.admin-general
q-select( q-select(
outlined outlined
v-model='state.config.defaults.timezone' v-model='state.config.defaults.timezone'
:options='dataStore.timezones' :options='timezones'
option-value='value' option-value='value'
option-label='text' option-label='text'
emit-value emit-value
@ -431,7 +431,6 @@ import { onMounted, reactive, watch } from 'vue'
import { useAdminStore } from 'src/stores/admin' import { useAdminStore } from 'src/stores/admin'
import { useSiteStore } from 'src/stores/site' import { useSiteStore } from 'src/stores/site'
import { useDataStore } from 'src/stores/data'
// QUASAR // QUASAR
@ -441,7 +440,6 @@ const $q = useQuasar()
const adminStore = useAdminStore() const adminStore = useAdminStore()
const siteStore = useSiteStore() const siteStore = useSiteStore()
const dataStore = useDataStore()
// I18N // I18N
@ -520,6 +518,8 @@ const timeFormats = [
{ value: '24h', label: t('admin.general.defaultTimeFormat24h') } { value: '24h', label: t('admin.general.defaultTimeFormat24h') }
] ]
const timezones = Intl.supportedValuesOf('timeZone')
const rulesTitle = [ const rulesTitle = [
val => /^[^<>"]+$/.test(val) || t('admin.general.siteTitleInvalidChars') val => /^[^<>"]+$/.test(val) || t('admin.general.siteTitleInvalidChars')
] ]

@ -156,7 +156,6 @@ import { computed, onMounted, reactive, watch } from 'vue'
import { useAdminStore } from 'src/stores/admin' import { useAdminStore } from 'src/stores/admin'
import { useSiteStore } from 'src/stores/site' import { useSiteStore } from 'src/stores/site'
import { useDataStore } from 'src/stores/data'
// QUASAR // QUASAR
@ -166,7 +165,6 @@ const $q = useQuasar()
const adminStore = useAdminStore() const adminStore = useAdminStore()
const siteStore = useSiteStore() const siteStore = useSiteStore()
const dataStore = useDataStore()
// I18N // I18N

@ -307,7 +307,6 @@ import { computed, onMounted, reactive, watch } from 'vue'
import { useAdminStore } from 'src/stores/admin' import { useAdminStore } from 'src/stores/admin'
import { useSiteStore } from 'src/stores/site' import { useSiteStore } from 'src/stores/site'
import { useDataStore } from 'src/stores/data'
// QUASAR // QUASAR
@ -317,7 +316,6 @@ const $q = useQuasar()
const adminStore = useAdminStore() const adminStore = useAdminStore()
const siteStore = useSiteStore() const siteStore = useSiteStore()
const dataStore = useDataStore()
// I18N // I18N

@ -334,7 +334,6 @@ import { computed, onMounted, reactive, watch } from 'vue'
import { useAdminStore } from 'src/stores/admin' import { useAdminStore } from 'src/stores/admin'
import { useSiteStore } from 'src/stores/site' import { useSiteStore } from 'src/stores/site'
import { useDataStore } from 'src/stores/data'
// QUASAR // QUASAR
@ -344,7 +343,6 @@ const $q = useQuasar()
const adminStore = useAdminStore() const adminStore = useAdminStore()
const siteStore = useSiteStore() const siteStore = useSiteStore()
const dataStore = useDataStore()
// I18N // I18N

@ -600,7 +600,6 @@ import { useRouter, useRoute } from 'vue-router'
import { useAdminStore } from 'src/stores/admin' import { useAdminStore } from 'src/stores/admin'
import { useSiteStore } from 'src/stores/site' import { useSiteStore } from 'src/stores/site'
import { useDataStore } from 'src/stores/data'
import GithubSetupInstallDialog from '../components/GithubSetupInstallDialog.vue' import GithubSetupInstallDialog from '../components/GithubSetupInstallDialog.vue'
@ -612,7 +611,6 @@ const $q = useQuasar()
const adminStore = useAdminStore() const adminStore = useAdminStore()
const siteStore = useSiteStore() const siteStore = useSiteStore()
const dataStore = useDataStore()
// ROUTER // ROUTER

@ -10,6 +10,7 @@ export const useSiteStore = defineStore('site', {
hostname: '', hostname: '',
company: '', company: '',
contentLicense: '', contentLicense: '',
footerExtra: '',
dark: false, dark: false,
title: '', title: '',
description: '', description: '',
@ -71,6 +72,7 @@ export const useSiteStore = defineStore('site', {
logoText logoText
company company
contentLicense contentLicense
footerExtra
theme { theme {
dark dark
colorPrimary colorPrimary
@ -101,6 +103,7 @@ export const useSiteStore = defineStore('site', {
this.logoText = clone(siteInfo.logoText) this.logoText = clone(siteInfo.logoText)
this.company = clone(siteInfo.company) this.company = clone(siteInfo.company)
this.contentLicense = clone(siteInfo.contentLicense) this.contentLicense = clone(siteInfo.contentLicense)
this.footerExtra = clone(siteInfo.footerExtra)
this.theme = { this.theme = {
...this.theme, ...this.theme,
...clone(siteInfo.theme) ...clone(siteInfo.theme)

Loading…
Cancel
Save