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

[editor] Fix loading of units from file

Use unit field of UnitService directly to detect changes.
parent d215b7d1
No related branches found
No related tags found
No related merge requests found
......@@ -15,15 +15,15 @@
[style.height.%]="100" mat-align-tabs="start"
[selectedIndex]="selectedPageIndex"
(selectedIndexChange)="selectPage($event)">
<mat-tab *ngFor="let page of unit.pages; let i = index">
<mat-tab *ngFor="let page of unitService.unit.pages; let i = index">
<ng-template mat-tab-label>
<ng-container *ngIf="page.alwaysVisible">
<mat-icon class="page-alwaysVisible-icon">assignment</mat-icon>
</ng-container>
<ng-container *ngIf="!page.alwaysVisible && unit.pages[0].alwaysVisible === false">
<ng-container *ngIf="!page.alwaysVisible && unitService.unit.pages[0].alwaysVisible === false">
{{'page' | translate }} {{i + 1}}
</ng-container>
<ng-container *ngIf="!page.alwaysVisible && unit.pages[0].alwaysVisible === true">
<ng-container *ngIf="!page.alwaysVisible && unitService.unit.pages[0].alwaysVisible === true">
{{'page' | translate }} {{i}}
</ng-container>
......@@ -72,7 +72,7 @@
(change)="updateModel(page,'backgroundColor', $any($event.target).value)">
</mat-form-field>
<mat-checkbox class="menuItem"
[disabled]="unit.pages.length < 2 || unit.pages[0].alwaysVisible && i != 0"
[disabled]="unitService.unit.pages.length < 2 || unitService.unit.pages[0].alwaysVisible && i != 0"
[ngModel]="page.alwaysVisible"
(click)="$any($event).stopPropagation()"
(change)="updateModel(page, 'alwaysVisible', $any($event.source).checked)">
......
......@@ -28,7 +28,6 @@ import { Unit } from '../../../../../common/models/unit';
]
})
export class UnitViewComponent implements OnInit, OnDestroy {
unit: Unit = this.unitService.unit;
selectedPageIndex: number = 0;
pagesLoaded = true;
private ngUnsubscribe = new Subject<void>();
......@@ -59,7 +58,7 @@ export class UnitViewComponent implements OnInit, OnDestroy {
addPage(): void {
this.unitService.addPage();
this.selectedPageIndex = this.unit.pages.length - 1;
this.selectedPageIndex = this.unitService.unit.pages.length - 1;
this.selectionService.selectedPageIndex = this.selectedPageIndex;
this.selectionService.selectedPageSectionIndex = 0;
}
......
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