Skip to content
Snippets Groups Projects
Commit 1f8aebbe authored by rhenck's avatar rhenck
Browse files

Fix template generation and adjust values

parent d3f93c60
No related branches found
No related tags found
No related merge requests found
Pipeline #61667 passed
...@@ -5,7 +5,7 @@ import { Component } from '@angular/core'; ...@@ -5,7 +5,7 @@ import { Component } from '@angular/core';
template: ` template: `
<div mat-dialog-title>Assistent: Antwortfeld(er)</div> <div mat-dialog-title>Assistent: Antwortfeld(er)</div>
<div mat-dialog-content> <div mat-dialog-content>
<h3>Text</h3> <h3>Frage</h3>
<aspect-rich-text-editor [(content)]="text" [showReducedControls]="true" <aspect-rich-text-editor [(content)]="text" [showReducedControls]="true"
[style.min-height.px]="200"></aspect-rich-text-editor> [style.min-height.px]="200"></aspect-rich-text-editor>
......
...@@ -118,8 +118,8 @@ export class TemplateService { ...@@ -118,8 +118,8 @@ export class TemplateService {
sectionElements.push( sectionElements.push(
this.createElement( this.createElement(
'text', 'text',
{ gridRow: i + 2, gridColumn: 1 }, { gridRow: i + 2, gridColumn: 1, marginTop: { value: 16, unit: 'px' }},
{ text: config.numbering !== 'bullets' ? `${numberingChars[i]})` : '&#x2022;' } { text: `${numberingChars[i]}` }
) )
); );
} }
...@@ -139,12 +139,14 @@ export class TemplateService { ...@@ -139,12 +139,14 @@ export class TemplateService {
}, },
...!config.useTextAreas ? { ...!config.useTextAreas ? {
showSoftwareKeyboard: true, showSoftwareKeyboard: true,
addInputAssistanceToKeyboard: true addInputAssistanceToKeyboard: true,
label: ''
} : { } : {
showSoftwareKeyboard: true, showSoftwareKeyboard: true,
addInputAssistanceToKeyboard: true, addInputAssistanceToKeyboard: true,
hasDynamicRowCount: true, hasDynamicRowCount: true,
expectedCharactersCount: config.expectedCharsCount * 1.5 || 136 expectedCharactersCount: config.expectedCharsCount * 1.5 || 136,
label: ''
} }
} }
) )
...@@ -160,10 +162,12 @@ export class TemplateService { ...@@ -160,10 +162,12 @@ export class TemplateService {
private static prepareNumberingChars(answerCount: number, private static prepareNumberingChars(answerCount: number,
numbering: 'latin' | 'decimal' | 'bullets' | 'none'): string[] { numbering: 'latin' | 'decimal' | 'bullets' | 'none'): string[] {
const latinChars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']; const latinChars = ['a)', 'b)', 'c)', 'd)', 'e)', 'f)', 'g)', 'h)', 'i)'];
switch (numbering) { switch (numbering) {
case 'latin': return latinChars.slice(0, answerCount); case 'latin': return latinChars.slice(0, answerCount);
case 'decimal': return Array.from(Array(answerCount).keys()).map(char => String(char + 1)); case 'decimal': return Array.from(Array(answerCount).keys()).map(char => `${String(char + 1)})`);
case 'bullets': return Array(answerCount).fill('&#x2022;');
case 'none': return [];
default: throw Error(`Unexpected numbering: ${numbering}`); default: throw Error(`Unexpected numbering: ${numbering}`);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment