fix userpage

This commit is contained in:
_Bastler 2021-12-03 23:58:19 +01:00
parent d75fa5fe59
commit e7083fff11
2 changed files with 15 additions and 9 deletions

View File

@ -59,6 +59,11 @@
</mat-error>
</mat-form-field>
<section>
<mat-checkbox [checked]="userpage.divider" (change)="userpage.divider = $event.checked">{{'userpages.divider'
| i18n}}</mat-checkbox>
</section>
</mat-card-content>
<mat-card-actions fxLayout="row wrap" fxFlexFill>
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">

View File

@ -27,7 +27,6 @@ export class PageUserPageEdit implements OnInit, OnDestroy {
working: boolean = false;
form: FormGroup;
settings: any;
index: number;
settingsSubscription: Subscription;
@ -65,9 +64,8 @@ export class PageUserPageEdit implements OnInit, OnDestroy {
this.form.get('sorting').valueChanges.subscribe((value) => {
this.sorting = value;
});
this.form.get('index').setValue(this.index);
this.form.get('index').valueChanges.subscribe((value) => {
this.index = value;
this.userpage.index = value;
});
this.name = this.route.snapshot.paramMap.get('name');
@ -84,6 +82,10 @@ export class PageUserPageEdit implements OnInit, OnDestroy {
this.userpage = data;
this.entryType = this.userpage.entryType;
this.sorting = this.userpage.sorting;
this.form.get("name").setValue(this.userpage.name);
this.form.get("entryType").setValue(this.userpage.entryType);
this.form.get("sorting").setValue(this.userpage.sorting);
this.form.get("index").setValue(this.userpage.index);
}, (error) => {
if (error.status == 404) {
this.notfound = true;
@ -96,12 +98,11 @@ export class PageUserPageEdit implements OnInit, OnDestroy {
this.userpage.tags = [];
this.userpage.excludedTags = [];
this.userpage.index = 99;
this.form.get("name").setValue(this.userpage.name);
this.form.get("entryType").setValue(this.userpage.entryType);
this.form.get("sorting").setValue(this.userpage.sorting);
this.form.get("index").setValue(this.userpage.index);
}
this.form.get("name").setValue(this.userpage.name);
this.form.get("entryType").setValue(this.userpage.entryType);
this.form.get("sorting").setValue(this.userpage.sorting);
this.form.get("index").setValue(this.userpage.index);
}
hasError(controlName: string): boolean {
@ -119,7 +120,7 @@ export class PageUserPageEdit implements OnInit, OnDestroy {
this.userpage.name = this.form.get("name").value;
this.userpage.entryType = this.entryType;
this.userpage.sorting = this.sorting;
this.userpage.index = this.index;
this.userpage.index = this.form.get("index").value;
this.userPageService.createOrUpdate(this.userpage).subscribe((data) => {
this.userpage = data;