breadcrumb fixes

This commit is contained in:
Sofia Papacharalampous 2024-05-31 15:36:10 +03:00
parent 56a4ed4da8
commit ea7b267460
12 changed files with 41 additions and 28 deletions

View File

@ -27,6 +27,9 @@ const appRoutes: Routes = [
permissions: [AppPermission.ViewMyDescriptionPage]
},
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
title: 'GENERAL.TITLES.DESCRIPTIONS'
}),
title: 'GENERAL.TITLES.DESCRIPTIONS'
}
},
@ -35,6 +38,9 @@ const appRoutes: Routes = [
loadChildren: () => import('./ui/description/description.module').then(m => m.DescriptionModule),
data: {
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
title: 'GENERAL.TITLES.EXPLORE'
}),
title: 'GENERAL.TITLES.EXPLORE'
}
},
@ -46,6 +52,9 @@ const appRoutes: Routes = [
permissions: [AppPermission.ViewMyDmpPage]
},
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
title: 'GENERAL.TITLES.PLANS'
}),
title: 'GENERAL.TITLES.PLANS'
}
},
@ -54,6 +63,9 @@ const appRoutes: Routes = [
loadChildren: () => import('./ui/dmp/dmp.module').then(m => m.DmpModule),
data: {
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
title: 'GENERAL.TITLES.EXPLORE-PLANS'
}),
title: 'GENERAL.TITLES.EXPLORE-PLANS'
}
},

View File

@ -1,5 +1,6 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { BreadcrumbService } from '../misc/breadcrumb/breadcrumb.service';
// import { DescriptionWizardComponent } from './description-wizard/description-wizard.component';
// import { DescriptionOverviewComponent } from './overview/description-overview.component';
@ -8,7 +9,10 @@ const routes: Routes = [
path: 'overview',
loadChildren: () => import('./overview/description-overview.module').then(m => m.DescriptionOverviewModule),
data: {
breadcrumb: true
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
hideNavigationItem: true
}),
}
},
{

View File

@ -17,9 +17,6 @@
</div>
<div class="col-auto">
<div *ngIf="listingItems && listingItems.length > 0 || this.lookup.like" class="row">
<div class="col-12 header-title">
<p >{{(isPublic ? 'DESCRIPTION-LISTING.TITLE-EXPLORE' : 'DESCRIPTION-LISTING.TITLE') | translate}}</p>
</div>
<div class="col-12">
<app-navigation-breadcrumb />
</div>

View File

@ -117,7 +117,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
getItemLink(): string[] {
// return this.isPublic ? [`/descriptions/publicEdit/${this.description.id}`] : [`/descriptions/edit/${this.description.id}`];
return this.isPublic ? ['/descriptions/overview/public/' + this.description.id] : ['/descriptions/overview/' + this.description.id];
return this.isPublic ? ['/explore-descriptions/overview/public/' + this.description.id] : ['/descriptions/overview/' + this.description.id];
}
getDmpLink(): string[] {

View File

@ -40,6 +40,7 @@ import { TranslateService } from '@ngx-translate/core';
import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { DescriptionCopyDialogComponent } from '../description-copy-dialog/description-copy-dialog.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
@Component({
@ -92,6 +93,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
private fb: UntypedFormBuilder,
private lockService: LockService,
private analyticsService: AnalyticsService,
private breadcrumbService: BreadcrumbService
) {
super();
}
@ -115,6 +117,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
this.descriptionService.getSingle(itemId, this.lookupFields())
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);
this.description = data;
this.description.dmp.dmpUsers = data.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active);
this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
@ -155,6 +159,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
this.descriptionService.getPublicSingle(publicId, this.lookupFields())
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);
this.description = data;
this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
// this.users = this.description.dmp.users;

View File

@ -9,9 +9,6 @@ const routes: Routes = [
component: DescriptionOverviewComponent,
data: {
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
hideNavigationItem: true
}),
title: 'GENERAL.TITLES.DATASET-OVERVIEW'
},
},
@ -20,9 +17,6 @@ const routes: Routes = [
component: DescriptionOverviewComponent,
data: {
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
hideNavigationItem: true
}),
title: 'GENERAL.TITLES.DATASET-OVERVIEW'
},
}

View File

@ -1,12 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { BreadcrumbService } from '../misc/breadcrumb/breadcrumb.service';
const routes: Routes = [
{
path: 'overview',
loadChildren: () => import('./overview/dmp-overview.module').then(m => m.DmpOverviewModule),
data: {
breadcrumb: true
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
hideNavigationItem: true
}),
}
},
{

View File

@ -11,9 +11,6 @@
</div>
</div>
</div>
<div *ngIf="listingItems && listingItems.length > 0 || this.lookup.like" class="col-12">
<p class="col-auto header-title">{{(isPublic ? 'GENERAL.TITLES.EXPLORE-PLANS' : 'GENERAL.TITLES.PLANS') | translate}}</p>
</div>
<div *ngIf="listingItems && listingItems.length > 0 || this.lookup.like" class="col-12">
<app-navigation-breadcrumb />
</div>

View File

@ -49,6 +49,7 @@ import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-finalize-dialog/dmp-finalize-dialog.component';
import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component';
import { NewVersionDmpDialogComponent } from '../new-version-dialog/dmp-new-version-dialog.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
@Component({
selector: 'app-dmp-overview',
@ -104,10 +105,11 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
public fileTransformerService: FileTransformerService,
private referenceTypeService: ReferenceTypeService,
private analyticsService: AnalyticsService,
private breadcrumbService: BreadcrumbService
) {
super();
}
ngOnInit() {
this.analyticsService.trackPageView(AnalyticsService.DmpOverview);
// Gets dmp data using parameter id
@ -122,6 +124,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.dmpService.getSingle(itemId, this.lookupFields())
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);
this.dmp = data;
this.dmp.dmpUsers = data.dmpUsers.filter(x => x.isActive === IsActive.Active);
this.dmp.otherDmpVersions = data.otherDmpVersions?.filter(x => x.isActive === IsActive.Active) || null;
@ -161,6 +165,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.dmpService.getPublicSingle(publicId, this.lookupFields())
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.breadcrumbService.addIdResolvedValue(`${data.id}`, data.label);
this.dmp = data;
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
if (!this.hasDoi()) {

View File

@ -9,9 +9,6 @@ const routes: Routes = [
component: DmpOverviewComponent,
data: {
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
hideNavigationItem: true
}),
title: 'GENERAL.TITLES.PLAN-OVERVIEW'
},
},
@ -20,9 +17,6 @@ const routes: Routes = [
component: DmpOverviewComponent,
data: {
breadcrumb: true,
...BreadcrumbService.generateRouteDataConfiguration({
hideNavigationItem: true
}),
title: 'GENERAL.TITLES.PLAN-OVERVIEW'
},
}

View File

@ -6,19 +6,17 @@
<a *ngIf="(!item?.skipNavigation && !last) else regularText" [routerLink]="computePath(index)" class=" text-black" disabled>
<ng-container *ngIf="item.title !== HOME_SYMBOL else homeIcon">
<span class="breadcrumb-item p-2">
{{ item.title | translate:item.translateParams | appTitleCaseTransform }}
{{ item.title | translate:item.translateParams }}
</span>
</ng-container>
</a>
<ng-template #regularText>
<ng-container *ngIf="item.title !== HOME_SYMBOL else homeIcon">
<span class="p-2">
{{ item.title | translate:item.translateParams | appTitleCaseTransform }}
{{ item.title | translate:item.translateParams }}
</span>
</ng-container>
</ng-template>
</div>
</li>
</nav>

View File

@ -47,7 +47,7 @@ export class NavigationBreadcrumbComponent extends BaseComponent {
takeUntil(this._destroyed),
)
.subscribe(breadCrumbs => {
this.breadCrumbs = breadCrumbs
this.breadCrumbs = breadCrumbs;
this.cdr.markForCheck();
});
}
@ -145,7 +145,8 @@ export class NavigationBreadcrumbComponent extends BaseComponent {
const title = Object.keys(pathParams)
.sort((a, b) => b.length - a.length) // avoid param overlapping => :id2 (length 3) should be replaced before :id (length 2)
.reduce(
(aggr, current) => aggr.replace(`:${current}`, this.paramToStringDictionary[pathParams[current]] ?? pathParams[current])
(aggr, current) => this.paramToStringDictionary[pathParams[current]] ?? pathParams[current]
// return aggr.replace(`:${current}`, this.paramToStringDictionary[pathParams[current]] ?? pathParams[current])
, path ?? ''
);