mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
- Avoid possible errors, because of 'window' is only defined on browser side but not in NodeJS on client side. Check for 'typeof window' is neccessary, because if it's not defined at all you can't check for 'window !== undefined' without the same error 'window is undefined'.
181 lines
6.7 KiB
JavaScript
181 lines
6.7 KiB
JavaScript
function noStringDefined(string) {
|
|
return !string || string === 0
|
|
}
|
|
|
|
class PageParams {
|
|
constructor(pageParams) {
|
|
this.name = pageParams.name
|
|
this.externalLink = pageParams.externalLink
|
|
this.internalPage = pageParams.internalPage
|
|
}
|
|
|
|
overwrite(assignPageParams) {
|
|
const pageParams = this
|
|
if (assignPageParams.name !== undefined) {
|
|
pageParams.name = assignPageParams.name
|
|
}
|
|
if (assignPageParams.externalLink !== undefined) {
|
|
pageParams.externalLink = assignPageParams.externalLink
|
|
}
|
|
if (assignPageParams.internalPage !== undefined) {
|
|
pageParams.internalPage = { ...pageParams.internalPage, ...assignPageParams.internalPage }
|
|
}
|
|
return pageParams
|
|
}
|
|
|
|
get isInternalPage() {
|
|
return noStringDefined(this.externalLink)
|
|
}
|
|
|
|
get link() {
|
|
return this.isInternalPage ? this.internalPage.pageRoute : this.externalLink
|
|
}
|
|
|
|
redirectToPage(thisComponent) {
|
|
if (this.isInternalPage) {
|
|
thisComponent.$router.push(this.internalPage.pageRoute)
|
|
} else if (typeof window !== 'undefined') {
|
|
window.location.href = this.externalLink
|
|
}
|
|
}
|
|
}
|
|
|
|
export const defaultPageParamsPages = {
|
|
ORGANIZATION: new PageParams({
|
|
name: 'organization',
|
|
|
|
externalLink: null, // if string is defined and not empty it's dominating
|
|
|
|
internalPage: {
|
|
pageRoute: '/organization', // static, don't change! internal page in case no external is defined
|
|
footerIdent: 'site.made', // localized string identifier
|
|
headTitleIdent: 'site.made', // localized string identifier
|
|
headlineIdent: 'site.made', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.organization',
|
|
},
|
|
}),
|
|
DONATE: new PageParams({
|
|
name: 'donate',
|
|
|
|
externalLink: null, // if string is defined and not empty it's dominating
|
|
|
|
internalPage: {
|
|
pageRoute: '/donate', // static, don't change! internal page in case no external is defined
|
|
footerIdent: 'site.donate', // localized string identifier
|
|
headTitleIdent: 'site.donate', // localized string identifier
|
|
headlineIdent: 'site.donate', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.donate',
|
|
},
|
|
}),
|
|
IMPRINT: new PageParams({
|
|
name: 'imprint',
|
|
|
|
externalLink: null, // if string is defined and not empty it's dominating
|
|
|
|
internalPage: {
|
|
pageRoute: '/imprint', // static, don't change! internal page in case no external is defined
|
|
footerIdent: 'site.imprint', // localized string identifier
|
|
headTitleIdent: 'site.imprint', // localized string identifier
|
|
headlineIdent: 'site.imprint', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.imprint',
|
|
},
|
|
}),
|
|
TERMS_AND_CONDITIONS: new PageParams({
|
|
name: 'terms-and-conditions',
|
|
|
|
externalLink: null, // if string is defined and not empty it's dominating
|
|
|
|
internalPage: {
|
|
pageRoute: '/terms-and-conditions', // static, don't change! internal page in case no external is defined
|
|
footerIdent: 'site.termsAndConditions', // localized string identifier
|
|
headTitleIdent: 'site.termsAndConditions', // localized string identifier
|
|
headlineIdent: 'site.termsAndConditions', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.termsAndConditions',
|
|
},
|
|
}),
|
|
CODE_OF_CONDUCT: new PageParams({
|
|
name: 'code-of-conduct',
|
|
|
|
externalLink: null, // if string is defined and not empty it's dominating
|
|
|
|
internalPage: {
|
|
pageRoute: '/code-of-conduct', // static, don't change! internal page in case no external is defined
|
|
footerIdent: 'site.code-of-conduct', // localized string identifier
|
|
headTitleIdent: 'site.code-of-conduct', // localized string identifier
|
|
headlineIdent: 'site.code-of-conduct', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.codeOfConduct',
|
|
},
|
|
}),
|
|
DATA_PRIVACY: new PageParams({
|
|
name: 'data-privacy',
|
|
|
|
externalLink: null, // if string is defined and not empty it's dominating
|
|
|
|
internalPage: {
|
|
pageRoute: '/data-privacy', // static, don't change! internal page in case no external is defined
|
|
footerIdent: 'site.data-privacy', // localized string identifier
|
|
headTitleIdent: 'site.data-privacy', // localized string identifier
|
|
headlineIdent: 'site.data-privacy', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.dataPrivacy',
|
|
},
|
|
}),
|
|
FAQ: new PageParams({
|
|
name: 'faq',
|
|
|
|
externalLink: null, // if string is defined and not empty it's dominating
|
|
|
|
internalPage: {
|
|
pageRoute: '/faq', // static, don't change! internal page in case no external is defined
|
|
footerIdent: 'site.faq', // localized string identifier
|
|
headTitleIdent: 'site.faq', // localized string identifier
|
|
headlineIdent: 'site.faq', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.faq',
|
|
},
|
|
}),
|
|
SUPPORT: new PageParams({
|
|
name: 'support',
|
|
|
|
externalLink: null,
|
|
|
|
internalPage: {
|
|
pageRoute: '/support', // static, don't change '*/support'! internal page in case no external is defined
|
|
footerIdent: 'site.support', // localized string identifier
|
|
headTitleIdent: 'site.support', // localized string identifier
|
|
headlineIdent: 'site.support', // localized string identifier. on null it's hidden, on empty string default is used
|
|
hasContainer: true,
|
|
hasBaseCard: true,
|
|
hasLoginInHeader: true,
|
|
// in case internal page content is here 'webapp/locales/html/'
|
|
htmlIdent: 'html.support',
|
|
},
|
|
}),
|
|
}
|