Refactor pageParams

This commit is contained in:
Wolfgang Huß 2021-08-03 15:30:58 +02:00
parent a3d3656bf1
commit 97fdb7cd5c
7 changed files with 249 additions and 67 deletions

View File

@ -6,7 +6,7 @@
</blockquote>
<base-card>
<template #imageColumn>
<a :href="links.ORGANIZATION" :title="$t('login.moreInfo', metadata)" target="_blank">
<a :href="links.ORGANIZATION.link" :title="$t('login.moreInfo', metadata)" target="_blank">
<logo logoType="welcome" />
</a>
</template>

View File

@ -7,9 +7,11 @@
:to="pageParams.internalLink"
:data-test="pageParams.name + '-nuxt-link'"
>
{{ pageParams.link }}
{{ $t(pageParams.internalPage.footerIdent) }}
</nuxt-link>
<a v-else :href="pageParams.externalLink" target="_blank" :data-test="pageParams.name + '-link'">
{{ pageParams.link }}
{{ $t(pageParams.internalPage.footerIdent) }}
</a>
<span class="division-line">-</span>

View File

@ -2,7 +2,7 @@
<section class="login-form">
<base-card>
<template #imageColumn>
<a :href="pageLink(links.ORGANIZATION)" :title="$t('login.moreInfo', metadata)" target="_blank">
<a :href="links.ORGANIZATION.link" :title="$t('login.moreInfo', metadata)" target="_blank">
<logo logoType="signup" />
</a>
</template>
@ -45,7 +45,6 @@
<script>
import links from '~/constants/links.js'
import metadata from '~/constants/metadata.js'
import { pageLink } from '~/components/utils/InternalPages.js'
import ComponentSlider from '~/components/ComponentSlider/ComponentSlider'
import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch'
import Logo from '~/components/Logo/Logo'
@ -162,7 +161,6 @@ export default {
}
return {
pageLink,
links,
metadata,
sliderData: {

View File

@ -1,29 +1,34 @@
<template>
<div>
<ds-space margin="small">
<ds-heading v-if="pageParams.internalPage.headlineIdent !== null" tag="h2">{{ $t(pageParams.internalPage.headlineIdent === '' ? pageValues.defaultHeadlineIdent : pageParams.internalPage.headlineIdent) }}</ds-heading>
<!-- Wolle <ds-heading v-if="pageParams.internalPage.headlineIdent !== null" tag="h2">{{ $t(pageParams.internalPage.headlineIdent === '' ? pageValues.defaultHeadlineIdent : pageParams.internalPage.headlineIdent) }}</ds-heading> -->
<ds-heading v-if="pageParams.internalPage.headlineIdent !== null" tag="h2">{{ $t(pageParams.internalPage.headlineIdent === '' ? pageParams.internalPage.defaultHeadlineIdent : pageParams.internalPage.headlineIdent) }}</ds-heading>
</ds-space>
<ds-container v-if="pageParams.internalPage.hasContainer">
<div v-if="!pageParams.internalPage.hasBaseCard">
<br>
<div v-html="$t(pageValues.htmlIdent)" />
<!-- Wolle <div v-html="$t(pageValues.htmlIdent)" /> -->
<div v-html="$t(pageParams.internalPage.htmlIdent)" />
</div>
<base-card v-else>
<div v-html="$t(pageValues.htmlIdent)" />
<!-- Wolle <div v-html="$t(pageValues.htmlIdent)" /> -->
<div v-html="$t(pageParams.internalPage.htmlIdent)" />
</base-card>
</ds-container>
<div v-else-if="!pageParams.internalPage.hasBaseCard">
<br>
<div v-html="$t(pageValues.htmlIdent)" />
<!-- Wolle <div v-html="$t(pageValues.htmlIdent)" /> -->
<div v-html="$t(pageParams.internalPage.htmlIdent)" />
</div>
<base-card v-else>
<div v-html="$t(pageValues.htmlIdent)" />
<!-- Wolle <div v-html="$t(pageValues.htmlIdent)" /> -->
<div v-html="$t(pageParams.internalPage.htmlIdent)" />
</base-card>
</div>
</template>
<script>
// import links from '~/constants/links.js'
// Wolle import links from '~/constants/links.js'
// import { pageLink } from '~/components/utils/InternalPages.js'
// import Logo from '~/components/Logo/Logo'
@ -34,50 +39,50 @@ export default {
title: this.$t(this.pageParams.internalPage.headTitleIdent),
}
},
// components: {
// Wolle components: {
// Logo,
// },
props: {
pageParams: { type: Object, required: true },
},
// data() {
// Wolle data() {
// return { links, pageLink }
// },
computed: {
pageValues() {
let values = {}
switch (this.pageParams.name) {
case 'organization':
values.defaultHeadlineIdent = 'site.made'
values.htmlIdent = 'html.organization'
break;
case 'donate':
values.defaultHeadlineIdent = 'site.donate'
values.htmlIdent = 'html.donate'
break;
case 'imprint':
values.defaultHeadlineIdent = 'site.imprint'
values.htmlIdent = 'html.imprint'
break;
case 'terms-and-conditions':
values.defaultHeadlineIdent = 'site.termsAndConditions'
values.htmlIdent = 'html.termsAndConditions'
break;
case 'code-of-conduct':
values.defaultHeadlineIdent = 'site.code-of-conduct'
values.htmlIdent = 'html.codeOfConduct'
break;
case 'data-privacy':
values.defaultHeadlineIdent = 'site.data-privacy'
values.htmlIdent = 'html.dataPrivacy'
break;
case 'faq':
values.defaultHeadlineIdent = 'site.faq'
values.htmlIdent = 'html.faq'
break;
}
return values
},
},
// computed: {
// pageValues() {
// let values = {}
// switch (this.pageParams.name) {
// case 'organization':
// values.defaultHeadlineIdent = 'site.made'
// values.htmlIdent = 'html.organization'
// break;
// case 'donate':
// values.defaultHeadlineIdent = 'site.donate'
// values.htmlIdent = 'html.donate'
// break;
// case 'imprint':
// values.defaultHeadlineIdent = 'site.imprint'
// values.htmlIdent = 'html.imprint'
// break;
// case 'terms-and-conditions':
// values.defaultHeadlineIdent = 'site.termsAndConditions'
// values.htmlIdent = 'html.termsAndConditions'
// break;
// case 'code-of-conduct':
// values.defaultHeadlineIdent = 'site.code-of-conduct'
// values.htmlIdent = 'html.codeOfConduct'
// break;
// case 'data-privacy':
// values.defaultHeadlineIdent = 'site.data-privacy'
// values.htmlIdent = 'html.dataPrivacy'
// break;
// case 'faq':
// values.defaultHeadlineIdent = 'site.faq'
// values.htmlIdent = 'html.faq'
// break;
// }
// return values
// },
// },
}
</script>

View File

@ -9,3 +9,168 @@ export function noStringDefined(string) {
export function pageLink(pageParams) {
return isInternalPage(pageParams) ? pageParams.internalLink : pageParams.externalLink
}
export const defaultInternalPagesSettings = {
ORGANIZATION: {
name: 'organization',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/organization', // static, don't change! internal page in case no external is defined
internalPage: {
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,
defaultHeadlineIdent: 'site.made',
htmlIdent: 'html.organization',
},
get link() {
return pageLink(this)
},
},
DONATE: {
name: 'donate',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/donate', // static, don't change! internal page in case no external is defined
internalPage: {
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,
defaultHeadlineIdent: 'site.donate',
htmlIdent: 'html.donate',
},
get link() {
return pageLink(this)
},
},
IMPRINT: {
name: 'imprint',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/imprint', // static, don't change! internal page in case no external is defined
internalPage: {
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,
defaultHeadlineIdent: 'site.imprint',
htmlIdent: 'html.imprint',
},
get link() {
return pageLink(this)
},
},
TERMS_AND_CONDITIONS: {
name: 'terms-and-conditions',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/terms-and-conditions', // static, don't change! internal page in case no external is defined
internalPage: {
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,
defaultHeadlineIdent: 'site.termsAndConditions',
htmlIdent: 'html.termsAndConditions',
},
get link() {
return pageLink(this)
},
},
CODE_OF_CONDUCT: {
name: 'code-of-conduct',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/code-of-conduct', // static, don't change! internal page in case no external is defined
internalPage: {
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,
defaultHeadlineIdent: 'site.code-of-conduct',
htmlIdent: 'html.codeOfConduct',
},
get link() {
return pageLink(this)
},
},
DATA_PRIVACY: {
name: 'data-privacy',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/data-privacy', // static, don't change! internal page in case no external is defined
internalPage: {
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,
defaultHeadlineIdent: 'site.data-privacy',
htmlIdent: 'html.dataPrivacy',
},
get link() {
return pageLink(this)
},
},
FAQ: {
name: 'faq',
// Wolle externalLink: 'https://ocelot.social',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/faq', // static, don't change! internal page in case no external is defined
internalPage: {
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,
defaultHeadlineIdent: 'site.faq',
htmlIdent: 'html.faq',
},
get link() {
return pageLink(this)
},
},
}

View File

@ -1,31 +1,38 @@
// this file is duplicated in `backend/src/config/links.js` and `webapp/constants/links.js` and replaced on rebranding by https://github.com/Ocelot-Social-Community/Ocelot-Social-Deploy-Rebranding/tree/master/branding/constants/
const ORGANIZATION = {
name: 'organization',
import { defaultInternalPagesSettings } from '~/components/utils/InternalPages.js'
// Wolle externalLink: 'https://ocelot.social',
externalLink: null, // if string is defined and not empty it's dominating
const ORGANIZATION = {
...defaultInternalPagesSettings.ORGANIZATION,
// Wolle name: 'organization',
// Wolle
externalLink: 'https://ocelot.social',
// externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/organization', // static, don't change! internal page in case no external is defined
// Wolle internalLink: '/organization', // static, don't change! internal page in case no external is defined
internalPage: {
...defaultInternalPagesSettings.ORGANIZATION.internalPage,
footerIdent: 'site.made', // localized string identifier
headTitleIdent: 'site.made', // localized string identifier
// Wolle headlineIdent: 'site.made', // localized string identifier. on null it's hidden, on empty string default is used
headlineIdent: null, // localized string identifier. on null it's hidden, on empty string default is used
hasContainer: true,
hasBaseCard: true, // no baseCard without a container
hasBaseCard: true,
hasLoginInHeader: true,
},
}
const DONATE = {
name: 'donate',
...defaultInternalPagesSettings.DONATE,
// Wolle name: 'donate',
// Wolle externalLink: 'https://ocelot-social.herokuapp.com/donations', // we use 'ocelot-social.herokuapp.com' at the moment, because redirections of 'ocelot.social' subpages are not working correctly
externalLink: '', // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/donate', // static, don't change! internal page in case no external is defined
// Wolle internalLink: '/donate', // static, don't change! internal page in case no external is defined
internalPage: {
footerIdent: 'site.donate', // localized string identifier
headTitleIdent: 'site.donate', // localized string identifier
@ -35,13 +42,14 @@ const DONATE = {
},
}
const IMPRINT = {
name: 'imprint',
...defaultInternalPagesSettings.IMPRINT,
// Wolle name: 'imprint',
// Wolle externalLink: 'https://ocelot-social.herokuapp.com/imprint', // we use 'ocelot-social.herokuapp.com' at the moment, because redirections of 'ocelot.social' subpages are not working correctly
externalLink: '', // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/imprint', // static, don't change! internal page in case no external is defined
// Wolle internalLink: '/imprint', // static, don't change! internal page in case no external is defined
internalPage: {
footerIdent: 'site.imprint', // localized string identifier
headTitleIdent: 'site.imprint', // localized string identifier
@ -51,12 +59,13 @@ const IMPRINT = {
},
}
const TERMS_AND_CONDITIONS = {
name: 'terms-and-conditions',
...defaultInternalPagesSettings.TERMS_AND_CONDITIONS,
// Wolle name: 'terms-and-conditions',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/terms-and-conditions', // static, don't change! internal page in case no external is defined
// Wolle internalLink: '/terms-and-conditions', // static, don't change! internal page in case no external is defined
internalPage: {
footerIdent: 'site.termsAndConditions', // localized string identifier
headTitleIdent: 'site.termsAndConditions', // localized string identifier
@ -66,12 +75,13 @@ const TERMS_AND_CONDITIONS = {
},
}
const CODE_OF_CONDUCT = {
name: 'code-of-conduct',
...defaultInternalPagesSettings.CODE_OF_CONDUCT,
// Wolle name: 'code-of-conduct',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/code-of-conduct', // static, don't change! internal page in case no external is defined
// Wolle internalLink: '/code-of-conduct', // static, don't change! internal page in case no external is defined
internalPage: {
footerIdent: 'site.code-of-conduct', // localized string identifier
headTitleIdent: 'site.code-of-conduct', // localized string identifier
@ -81,12 +91,13 @@ const CODE_OF_CONDUCT = {
},
}
const DATA_PRIVACY = {
name: 'data-privacy',
...defaultInternalPagesSettings.DATA_PRIVACY,
// Wolle name: 'data-privacy',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/data-privacy', // static, don't change! internal page in case no external is defined
// Wolle internalLink: '/data-privacy', // static, don't change! internal page in case no external is defined
internalPage: {
footerIdent: 'site.data-privacy', // localized string identifier
headTitleIdent: 'site.data-privacy', // localized string identifier
@ -96,13 +107,14 @@ const DATA_PRIVACY = {
},
}
const FAQ = {
name: 'faq',
...defaultInternalPagesSettings.FAQ,
// Wolle name: 'faq',
// Wolle externalLink: 'https://ocelot.social',
externalLink: null, // if string is defined and not empty it's dominating
// in case internal page content is here 'webapp/locales/html/'
internalLink: '/faq', // static, don't change! internal page in case no external is defined
// Wolle internalLink: '/faq', // static, don't change! internal page in case no external is defined
internalPage: {
footerIdent: 'site.faq', // localized string identifier
headTitleIdent: 'site.faq', // localized string identifier

View File

@ -20,7 +20,7 @@
</h1>
<br>
<!-- <iframe id="embed_player" frameborder="0" width="280" height="216" src="https://senderfm.airtime.pro/embed/player?stream=s1&skin=1"></iframe> -->
<iframe class="player" id="embed_player" frameborder="0" width="350" height="396" src="https://senderfm.airtime.pro/embed/player?stream=s1&skin=2"></iframe>
<iframe class="player" id="embed_player" frameborder="0" width="510px" height="396px" src="https://senderfm.airtime.pro/embed/player?stream=s1&skin=2"></iframe>
<br>
<h3 class="h3-headline">
Radio Weekly Plan