From 5ded8ea0aa101b4b73ffca9d68d0af5d66812218 Mon Sep 17 00:00:00 2001 From: _Bastler Date: Wed, 13 Apr 2022 21:02:12 +0200 Subject: [PATCH] fix edit view, title link --- src/app/pages/view/edit/edit.page.ts | 38 +++++++++++++++------------- src/app/ui/main/main.ui.html | 12 +++++---- src/app/ui/main/main.ui.scss | 5 ++++ 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/app/pages/view/edit/edit.page.ts b/src/app/pages/view/edit/edit.page.ts index a5949cd..46cd269 100644 --- a/src/app/pages/view/edit/edit.page.ts +++ b/src/app/pages/view/edit/edit.page.ts @@ -38,7 +38,9 @@ export class PageViewEdit implements OnInit, OnDestroy { private i18n: I18nService, private route: ActivatedRoute, private snackBar: MatSnackBar, - public dialog: MatDialog) { } + public dialog: MatDialog) { + this.router.routeReuseStrategy.shouldReuseRoute = () => false; + } ngOnInit(): void { this.form = this.formBuilder.group({ @@ -52,24 +54,26 @@ export class PageViewEdit implements OnInit, OnDestroy { this.settings = settings; }); - if (this.route.snapshot.queryParamMap.get('name')) { - this.form.get('name').setValue(this.route.snapshot.queryParamMap.get('name')); - } + this.route.params.subscribe((params) => { + if (params.name) { + this.form.get('name').setValue(params.name); - this.form.get('entryType').setValue(this.entryType); - this.form.get('entryType').valueChanges.subscribe((value) => { - this.entryType = value; - }); - this.form.get('sorting').setValue(this.sorting); - this.form.get('sorting').valueChanges.subscribe((value) => { - this.sorting = value; - }); - this.form.get('index').valueChanges.subscribe((value) => { - this.view.index = value; - }); + this.form.get('entryType').setValue(this.entryType); + this.form.get('entryType').valueChanges.subscribe((value) => { + this.entryType = value; + }); + this.form.get('sorting').setValue(this.sorting); + this.form.get('sorting').valueChanges.subscribe((value) => { + this.sorting = value; + }); + this.form.get('index').valueChanges.subscribe((value) => { + this.view.index = value; + }); - this.name = this.route.snapshot.paramMap.get('name'); - this.refresh(); + this.name = params.name; + this.refresh(); + } + }) } ngOnDestroy(): void { diff --git a/src/app/ui/main/main.ui.html b/src/app/ui/main/main.ui.html index 721e188..f5664d1 100644 --- a/src/app/ui/main/main.ui.html +++ b/src/app/ui/main/main.ui.html @@ -3,13 +3,15 @@ menu - + {{'bstlboard' | i18n}} - + - edit {{'submission' | - i18n}} + + edit {{'submission' | + i18n}} +