change view path

This commit is contained in:
_Bastler 2021-12-04 00:21:24 +01:00
parent 161f68aa37
commit 3233ea0f60
6 changed files with 11 additions and 12 deletions

View File

@ -25,7 +25,7 @@ import { UiMain } from './ui/main/main.ui';
const routes: Routes = [
{
path: '', component: UiMain, children: [
{ path: '', redirectTo: "/p/TOP", pathMatch: 'full' },
{ path: '', redirectTo: "/v/TOP", pathMatch: 'full' },
{ path: 'login', component: PageLogin, canActivate: [ AnonymousGuard ] },
{ path: 'search', component: PageSearch, canActivate: [ AuthenticatedGuard ] },
{ path: 'moderation/comments', component: PageModerationComments, canActivate: [ AuthenticatedGuard ] },
@ -40,10 +40,10 @@ const routes: Routes = [
{ path: 'u/c/:username', component: PageUserComments, canActivate: [ AuthenticatedGuard ] },
{ path: 'u/e/:username', component: PageUserEntries, canActivate: [ AuthenticatedGuard ] },
{ path: 'unavailable', component: PageUnavailable },
{ path: 'p', component: PageViewEdit, canActivate: [ AuthenticatedGuard ] },
{ path: 'p/:name', component: PageView, canActivate: [ AuthenticatedGuard ] },
{ path: 'p/:name/edit', component: PageViewEdit, canActivate: [ AuthenticatedGuard ] },
{ path: 'p/:name/:username', component: PageView, canActivate: [ AuthenticatedGuard ] },
{ path: 'v', component: PageViewEdit, canActivate: [ AuthenticatedGuard ] },
{ path: 'v/:name', component: PageView, canActivate: [ AuthenticatedGuard ] },
{ path: 'v/:name/edit', component: PageViewEdit, canActivate: [ AuthenticatedGuard ] },
{ path: 'v/:name/:username', component: PageView, canActivate: [ AuthenticatedGuard ] },
{ path: '**', component: PageNotFound, pathMatch: 'full', canActivate: [ AuthUpdateGuard ] },
]
},

View File

@ -69,7 +69,7 @@
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">
<mat-icon>save</mat-icon> {{ (view.id ? 'views.update' : 'views.create') | i18n}}
</button>
<a mat-button color="primary" routerLink="/p/{{view.name}}" *ngIf="view.id">{{ 'views.goTo' |
<a mat-button color="primary" routerLink="/v/{{view.name}}" *ngIf="view.id">{{ 'views.goTo' |
i18n}}</a>
<span fxFlexOffset="auto" fxFlexOffset.xs="none"></span>
<a mat-raised-button color="warn" *ngIf="!working && view.id" (click)="deleteView()">

View File

@ -98,7 +98,6 @@ export class PageViewEdit implements OnInit, OnDestroy {
this.view.tags = [];
this.view.excludedTags = [];
this.view.index = 99;
this.form.get("name").setValue(this.view.name);
this.form.get("entryType").setValue(this.view.entryType);
this.form.get("sorting").setValue(this.view.sorting);
this.form.get("index").setValue(this.view.index);
@ -128,7 +127,7 @@ export class PageViewEdit implements OnInit, OnDestroy {
this.snackBar.open(this.i18n.get('views.success', []), this.i18n.get("close", []), {
duration: 3000
});
this.router.navigateByUrl('/p/' + this.view.name);
this.router.navigateByUrl('/v/' + this.view.name);
this.viewService.getViews();
}, (error) => {
this.working = false;

View File

@ -1,5 +1,5 @@
<div fxLayout="column" fxFlexFill>
<a mat-mini-fab routerLink="/p/{{name}}/edit" matTooltip="{{'views.edit' | i18n}}" color="primary">
<a mat-mini-fab routerLink="/v/{{name}}/edit" matTooltip="{{'views.edit' | i18n}}" color="primary">
<mat-icon inline="true">edit</mat-icon>
</a>
<page-entries #entries [fetch]="boundFetch" fxFlex="grow"></page-entries>

View File

@ -36,7 +36,7 @@ export class PageView implements OnInit, OnDestroy {
this.entries.refresh();
}
}, (error) => {
this.router.navigate([ '/p' ], { queryParams: { name: this.name }, queryParamsHandling: 'merge' });
this.router.navigate([ '/v' ], { queryParams: { name: this.name }, queryParamsHandling: 'merge' });
})
});
this.boundFetch = this.fetch.bind(this);

View File

@ -1,12 +1,12 @@
<ng-container *ngIf="settings">
<ng-container *ngFor="let view of views">
<mat-divider *ngIf="view.divider"></mat-divider>
<a routerLink="/p/{{view.name}}" routerLinkActive="active" mat-list-item>
<a routerLink="/v/{{view.name}}" routerLinkActive="active" mat-list-item>
<mat-icon>{{'sorting.' + view.sorting + '.icon' | i18n}}</mat-icon> {{'sorting.' + view.name | i18nEmpty}}
</a>
</ng-container>
<mat-divider></mat-divider>
<a *ngIf="views.length < settings.maxViews" routerLink="/p" routerLinkActive="active" mat-list-item
<a *ngIf="views.length < settings.maxViews" routerLink="/v" routerLinkActive="active" mat-list-item
title="{{'views.add' | i18n}}">
<mat-icon style="margin: 0 auto;">add</mat-icon>
</a>