add form layouts

This commit is contained in:
Michael Schramm 2021-05-15 15:08:21 +02:00
parent b1b458aba3
commit 1d9838dc25
8 changed files with 33 additions and 0 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- logic backend components
- forms now have multiple notification
- layout for forms
### Changed

View File

@ -8,4 +8,7 @@ export class DesignInput {
@Field({ nullable: true })
readonly font?: string
@Field({ nullable: true })
readonly layout?: string
}

View File

@ -10,8 +10,12 @@ export class DesignModel {
@Field({ nullable: true })
readonly font?: string
@Field({ nullable: true })
readonly layout?: string
constructor(partial: Partial<DesignEmbedded>) {
this.colors = new ColorsModel(partial.colors)
this.font = partial.font
this.layout = partial.layout
}
}

View File

@ -13,4 +13,7 @@ export class FormCreateInput {
@Field({ nullable: true })
readonly isLive: boolean
@Field({ nullable: true })
readonly layout: string
}

View File

@ -7,4 +7,7 @@ export class DesignEmbedded {
@Column({ nullable: true })
font?: string
@Column({ nullable: true })
layout?: string
}

View File

@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm"
export class layout1621078163528 implements MigrationInterface {
name = 'layout1621078163528'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "form" ADD "designLayout" character varying`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "form" DROP COLUMN "designLayout"`);
}
}

View File

@ -20,6 +20,7 @@ export class FormCreateService {
form.isLive = Boolean(input.isLive)
form.showFooter = Boolean(input.showFooter)
form.language = input.language || 'en'
form.design.layout = input.layout
form.admin = admin

View File

@ -150,6 +150,10 @@ export class FormUpdateService {
form.design.font = input.design.font
}
if (input.design.layout !== undefined) {
form.design.layout = input.design.layout
}
if (input.design.colors !== undefined) {
if (input.design.colors.answer !== undefined) {
form.design.colors.answer = input.design.colors.answer