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

[editor] Fix likert row generation

- Missing type inforamtion as constructor parameter
- Also the new ID generation mechanism uses the type of the element to 
request an ID from the the IDManager. Here was a mismatch, where the 
type is 'likert-row', but the IDManager only knew 'likert_row'. This is 
now files all IDs use hyphens instead of underscores.
parent 5b13f739
No related branches found
No related tags found
No related merge requests found
Pipeline #38549 failed
...@@ -16,7 +16,7 @@ export class IDManager { ...@@ -16,7 +16,7 @@ export class IDManager {
audio: 0, audio: 0,
video: 0, video: 0,
likert: 0, likert: 0,
likert_row: 0, 'likert-row': 0,
slider: 0, slider: 0,
'spell-correct': 0, 'spell-correct': 0,
'radio-group-images': 0, 'radio-group-images': 0,
......
...@@ -11,6 +11,7 @@ import { DomSanitizer } from '@angular/platform-browser'; ...@@ -11,6 +11,7 @@ import { DomSanitizer } from '@angular/platform-browser';
import { DragNDropValueObject, InputElementValue, TextImageLabel, UIElement } from 'common/models/elements/element'; import { DragNDropValueObject, InputElementValue, TextImageLabel, UIElement } from 'common/models/elements/element';
import { LikertRowElement } from 'common/models/elements/compound-elements/likert/likert-row'; import { LikertRowElement } from 'common/models/elements/compound-elements/likert/likert-row';
import { LikertElement } from 'common/models/elements/compound-elements/likert/likert'; import { LikertElement } from 'common/models/elements/compound-elements/likert/likert';
import { IDManager } from 'common/util/id-manager';
@Component({ @Component({
selector: 'aspect-element-model-properties-component', selector: 'aspect-element-model-properties-component',
...@@ -84,10 +85,15 @@ export class ElementModelPropertiesComponent { ...@@ -84,10 +85,15 @@ export class ElementModelPropertiesComponent {
} }
addLikertRow(rowLabelText: string): void { addLikertRow(rowLabelText: string): void {
const newRow = this.unitService.createLikertRowElement( const newRow = new LikertRowElement({
rowLabelText, type: 'likert-row',
(this.combinedProperties.columns as TextImageLabel[]).length rowLabel: {
); text: rowLabelText,
imgSrc: null,
position: 'above'
},
columnCount: (this.combinedProperties.columns as TextImageLabel[]).length
}, IDManager.getInstance());
(this.combinedProperties.rows as LikertRowElement[]).push(newRow); (this.combinedProperties.rows as LikertRowElement[]).push(newRow);
this.updateModel.emit({ property: 'rows', value: this.combinedProperties.rows as LikertRowElement[] }); this.updateModel.emit({ property: 'rows', value: this.combinedProperties.rows as LikertRowElement[] });
} }
......
...@@ -273,18 +273,6 @@ export class UnitService { ...@@ -273,18 +273,6 @@ export class UnitService {
this.veronaApiService.sendVoeDefinitionChangedNotification(this.unit); this.veronaApiService.sendVoeDefinitionChangedNotification(this.unit);
} }
createLikertRowElement(rowLabelText: string, columnCount: number): LikertRowElement {
return new LikertRowElement({
id: IDManager.getInstance().getNewID('likert_row'),
rowLabel: {
text: rowLabelText,
imgSrc: null,
position: 'above'
},
columnCount: columnCount
} as Partial<LikertRowElement>);
}
alignElements(elements: PositionedUIElement[], alignmentDirection: 'left' | 'right' | 'top' | 'bottom'): void { alignElements(elements: PositionedUIElement[], alignmentDirection: 'left' | 'right' | 'top' | 'bottom'): void {
switch (alignmentDirection) { switch (alignmentDirection) {
case 'left': case 'left':
......
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