feat(config): add customizable footer
This commit is contained in:
@@ -11,6 +11,15 @@ export default async (request, response) => {
|
|||||||
|
|
||||||
const configParams = (request) => {
|
const configParams = (request) => {
|
||||||
const {
|
const {
|
||||||
|
enableFooter,
|
||||||
|
footerBackgroundColor,
|
||||||
|
footerCopyrightText,
|
||||||
|
footerDocsLink,
|
||||||
|
footerImprintLink,
|
||||||
|
footerLogoSvgData,
|
||||||
|
footerPrivacyPolicyLink,
|
||||||
|
footerTextColor,
|
||||||
|
footerTosLink,
|
||||||
logoSvgData,
|
logoSvgData,
|
||||||
palettePrimaryDark,
|
palettePrimaryDark,
|
||||||
palettePrimaryLight,
|
palettePrimaryLight,
|
||||||
@@ -19,6 +28,15 @@ const configParams = (request) => {
|
|||||||
} = request.body;
|
} = request.body;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
enableFooter,
|
||||||
|
footerBackgroundColor,
|
||||||
|
footerCopyrightText,
|
||||||
|
footerDocsLink,
|
||||||
|
footerImprintLink,
|
||||||
|
footerLogoSvgData,
|
||||||
|
footerPrivacyPolicyLink,
|
||||||
|
footerTextColor,
|
||||||
|
footerTosLink,
|
||||||
logoSvgData,
|
logoSvgData,
|
||||||
palettePrimaryDark,
|
palettePrimaryDark,
|
||||||
palettePrimaryLight,
|
palettePrimaryLight,
|
||||||
|
|||||||
@@ -25,6 +25,18 @@ describe('PATCH /api/v1/admin/config', () => {
|
|||||||
const palettePrimaryMain = '#00adef';
|
const palettePrimaryMain = '#00adef';
|
||||||
const palettePrimaryDark = '#222222';
|
const palettePrimaryDark = '#222222';
|
||||||
const palettePrimaryLight = '#f90707';
|
const palettePrimaryLight = '#f90707';
|
||||||
|
const enableFooter = true;
|
||||||
|
const footerCopyrightText = '© AB Software GmbH';
|
||||||
|
const footerBackgroundColor = '#FFFFFF';
|
||||||
|
const footerTextColor = '#000000';
|
||||||
|
const footerDocsLink = 'https://automatisch.io/docs';
|
||||||
|
const footerTosLink = 'https://automatisch.io/terms';
|
||||||
|
const footerPrivacyPolicyLink = 'https://automatisch.io/privacy';
|
||||||
|
const footerImprintLink = 'https://automatisch.io/imprint';
|
||||||
|
|
||||||
|
const footerLogoSvgData =
|
||||||
|
'<svg width="25" height="25" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"><rect width="100%" height="100%" fill="white" /><text x="10" y="40" font-family="Arial" font-size="40" fill="black">Sample Footer Logo</text></svg>';
|
||||||
|
|
||||||
const logoSvgData =
|
const logoSvgData =
|
||||||
'<svg width="25" height="25" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"><rect width="100%" height="100%" fill="white" /><text x="10" y="40" font-family="Arial" font-size="40" fill="black">A</text></svg>';
|
'<svg width="25" height="25" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"><rect width="100%" height="100%" fill="white" /><text x="10" y="40" font-family="Arial" font-size="40" fill="black">A</text></svg>';
|
||||||
|
|
||||||
@@ -34,6 +46,15 @@ describe('PATCH /api/v1/admin/config', () => {
|
|||||||
palettePrimaryDark: palettePrimaryDark,
|
palettePrimaryDark: palettePrimaryDark,
|
||||||
palettePrimaryLight: palettePrimaryLight,
|
palettePrimaryLight: palettePrimaryLight,
|
||||||
logoSvgData: logoSvgData,
|
logoSvgData: logoSvgData,
|
||||||
|
enableFooter,
|
||||||
|
footerCopyrightText,
|
||||||
|
footerBackgroundColor,
|
||||||
|
footerTextColor,
|
||||||
|
footerDocsLink,
|
||||||
|
footerTosLink,
|
||||||
|
footerPrivacyPolicyLink,
|
||||||
|
footerImprintLink,
|
||||||
|
footerLogoSvgData,
|
||||||
};
|
};
|
||||||
|
|
||||||
await updateConfig(appConfig);
|
await updateConfig(appConfig);
|
||||||
|
|||||||
@@ -28,6 +28,15 @@ describe('GET /api/v1/automatisch/config', () => {
|
|||||||
palettePrimaryMain: '#0059F7',
|
palettePrimaryMain: '#0059F7',
|
||||||
title: 'Sample Title',
|
title: 'Sample Title',
|
||||||
enableTemplates: true,
|
enableTemplates: true,
|
||||||
|
enableFooter: true,
|
||||||
|
footerLogoSvgData: '<svg>Sample Footer Logo</svg>',
|
||||||
|
footerCopyrightText: '© AB Software GmbH',
|
||||||
|
footerBackgroundColor: '#FFFFFF',
|
||||||
|
footerTextColor: '#000000',
|
||||||
|
footerDocsLink: 'https://automatisch.io/docs',
|
||||||
|
footerTosLink: 'https://automatisch.io/terms',
|
||||||
|
footerPrivacyPolicyLink: 'https://automatisch.io/privacy',
|
||||||
|
footerImprintLink: 'https://automatisch.io/imprint',
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await request(app)
|
const response = await request(app)
|
||||||
@@ -41,6 +50,16 @@ describe('GET /api/v1/automatisch/config', () => {
|
|||||||
additionalDrawerLink: 'link',
|
additionalDrawerLink: 'link',
|
||||||
additionalDrawerLinkIcon: 'icon',
|
additionalDrawerLinkIcon: 'icon',
|
||||||
additionalDrawerLinkText: 'text',
|
additionalDrawerLinkText: 'text',
|
||||||
|
enableTemplates: true,
|
||||||
|
enableFooter: true,
|
||||||
|
footerLogoSvgData: '<svg>Sample Footer Logo</svg>',
|
||||||
|
footerCopyrightText: '© AB Software GmbH',
|
||||||
|
footerBackgroundColor: '#FFFFFF',
|
||||||
|
footerTextColor: '#000000',
|
||||||
|
footerDocsLink: 'https://automatisch.io/docs',
|
||||||
|
footerTosLink: 'https://automatisch.io/terms',
|
||||||
|
footerPrivacyPolicyLink: 'https://automatisch.io/privacy',
|
||||||
|
footerImprintLink: 'https://automatisch.io/imprint',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(response.body).toStrictEqual(expectedPayload);
|
expect(response.body).toStrictEqual(expectedPayload);
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
export async function up(knex) {
|
||||||
|
await knex.schema.table('config', (table) => {
|
||||||
|
table.boolean('enable_footer').defaultTo(false);
|
||||||
|
table.text('footer_logo_svg_data');
|
||||||
|
table.text('footer_copyright_text');
|
||||||
|
table.text('footer_background_color');
|
||||||
|
table.text('footer_text_color');
|
||||||
|
table.text('footer_docs_link');
|
||||||
|
table.text('footer_tos_link');
|
||||||
|
table.text('footer_privacy_policy_link');
|
||||||
|
table.text('footer_imprint_link');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(knex) {
|
||||||
|
await knex.schema.table('config', (table) => {
|
||||||
|
table.dropColumn('enable_footer');
|
||||||
|
table.dropColumn('footer_copyright_text');
|
||||||
|
table.dropColumn('footer_logo_svg_data');
|
||||||
|
table.dropColumn('footer_background_color');
|
||||||
|
table.dropColumn('footer_text_color');
|
||||||
|
table.dropColumn('footer_docs_link');
|
||||||
|
table.dropColumn('footer_tos_link');
|
||||||
|
table.dropColumn('footer_privacy_policy_link');
|
||||||
|
table.dropColumn('footer_imprint_link');
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -6,12 +6,63 @@ exports[`Config model > jsonSchema should have correct validations 1`] = `
|
|||||||
"createdAt": {
|
"createdAt": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
|
"enableFooter": {
|
||||||
|
"type": "boolean",
|
||||||
|
},
|
||||||
"enableTemplates": {
|
"enableTemplates": {
|
||||||
"type": [
|
"type": [
|
||||||
"boolean",
|
"boolean",
|
||||||
"null",
|
"null",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
"footerBackgroundColor": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"footerCopyrightText": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"footerDocsLink": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"footerImprintLink": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"footerLogoSvgData": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"footerPrivacyPolicyLink": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"footerTextColor": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"footerTosLink": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null",
|
||||||
|
],
|
||||||
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"format": "uuid",
|
"format": "uuid",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@@ -16,6 +16,15 @@ class Config extends Base {
|
|||||||
palettePrimaryMain: { type: ['string', 'null'] },
|
palettePrimaryMain: { type: ['string', 'null'] },
|
||||||
title: { type: ['string', 'null'] },
|
title: { type: ['string', 'null'] },
|
||||||
enableTemplates: { type: ['boolean', 'null'] },
|
enableTemplates: { type: ['boolean', 'null'] },
|
||||||
|
enableFooter: { type: 'boolean' },
|
||||||
|
footerLogoSvgData: { type: ['string', 'null'] },
|
||||||
|
footerCopyrightText: { type: ['string', 'null'] },
|
||||||
|
footerBackgroundColor: { type: ['string', 'null'] },
|
||||||
|
footerTextColor: { type: ['string', 'null'] },
|
||||||
|
footerDocsLink: { type: ['string', 'null'] },
|
||||||
|
footerTosLink: { type: ['string', 'null'] },
|
||||||
|
footerPrivacyPolicyLink: { type: ['string', 'null'] },
|
||||||
|
footerImprintLink: { type: ['string', 'null'] },
|
||||||
createdAt: { type: 'string' },
|
createdAt: { type: 'string' },
|
||||||
updatedAt: { type: 'string' },
|
updatedAt: { type: 'string' },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ const configSerializer = (config) => {
|
|||||||
palettePrimaryLight: config.palettePrimaryLight,
|
palettePrimaryLight: config.palettePrimaryLight,
|
||||||
installationCompleted: config.installationCompleted,
|
installationCompleted: config.installationCompleted,
|
||||||
title: config.title,
|
title: config.title,
|
||||||
|
enableFooter: config.enableFooter,
|
||||||
|
footerLogoSvgData: config.footerLogoSvgData,
|
||||||
|
footerCopyrightText: config.footerCopyrightText,
|
||||||
|
footerBackgroundColor: config.footerBackgroundColor,
|
||||||
|
footerTextColor: config.footerTextColor,
|
||||||
|
footerDocsLink: config.footerDocsLink,
|
||||||
|
footerTosLink: config.footerTosLink,
|
||||||
|
footerPrivacyPolicyLink: config.footerPrivacyPolicyLink,
|
||||||
|
footerImprintLink: config.footerImprintLink,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,15 @@ describe('configSerializer', () => {
|
|||||||
additionalDrawerLink: config.additionalDrawerLink,
|
additionalDrawerLink: config.additionalDrawerLink,
|
||||||
additionalDrawerLinkIcon: config.additionalDrawerLinkIcon,
|
additionalDrawerLinkIcon: config.additionalDrawerLinkIcon,
|
||||||
additionalDrawerLinkText: config.additionalDrawerLinkText,
|
additionalDrawerLinkText: config.additionalDrawerLinkText,
|
||||||
|
enableFooter: config.enableFooter,
|
||||||
|
footerBackgroundColor: config.footerBackgroundColor,
|
||||||
|
footerCopyrightText: config.footerCopyrightText,
|
||||||
|
footerDocsLink: config.footerDocsLink,
|
||||||
|
footerImprintLink: config.footerImprintLink,
|
||||||
|
footerLogoSvgData: config.footerLogoSvgData,
|
||||||
|
footerPrivacyPolicyLink: config.footerPrivacyPolicyLink,
|
||||||
|
footerTextColor: config.footerTextColor,
|
||||||
|
footerTosLink: config.footerTosLink,
|
||||||
createdAt: config.createdAt.getTime(),
|
createdAt: config.createdAt.getTime(),
|
||||||
updatedAt: config.updatedAt.getTime(),
|
updatedAt: config.updatedAt.getTime(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,15 @@ const configMock = (config) => {
|
|||||||
installationCompleted: config.installationCompleted || false,
|
installationCompleted: config.installationCompleted || false,
|
||||||
title: config.title,
|
title: config.title,
|
||||||
enableTemplates: config.enableTemplates,
|
enableTemplates: config.enableTemplates,
|
||||||
|
enableFooter: config.enableFooter || false,
|
||||||
|
footerLogoSvgData: config.footerLogoSvgData,
|
||||||
|
footerCopyrightText: config.footerCopyrightText,
|
||||||
|
footerBackgroundColor: config.footerBackgroundColor,
|
||||||
|
footerTextColor: config.footerTextColor,
|
||||||
|
footerDocsLink: config.footerDocsLink,
|
||||||
|
footerTosLink: config.footerTosLink,
|
||||||
|
footerPrivacyPolicyLink: config.footerPrivacyPolicyLink,
|
||||||
|
footerImprintLink: config.footerImprintLink,
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
count: 1,
|
count: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user