Skip to content

Commit

Permalink
Merged in task/dspace-cris-2023_02_x/DSC-2017 (pull request DSpace#2512)
Browse files Browse the repository at this point in the history
[DSC-2017] Fix problem with link in the item page navbar

Approved-by: Andrea Barbasso
  • Loading branch information
atarix83 authored and Andrea Barbasso committed Nov 7, 2024
2 parents f9b04ef + ca02b2b commit 3ff917f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<div id="collapsingNav">
<ul class="navbar-nav mr-auto shadow-none">
<ng-container *ngIf="!!(activeTab$ |async)">
<ds-cris-layout-sidebar-item *ngFor="let tab of tabs;" [tab]="tab" [layout]="'horizontal'" [activeTab]="(activeTab$ |async)"
<ds-cris-layout-sidebar-item *ngFor="let tab of tabs;" [itemBaseUrl]="itemBaseUrl" [tab]="tab" [layout]="'horizontal'" [activeTab]="(activeTab$ |async)"
(tabSelectedChange)="setActiveTab($event)"></ds-cris-layout-sidebar-item>
</ng-container>
</ul>
</div>
</div>
</div>
</nav>
</nav>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div>
<ul class="list-unstyled components mb-5">
<ng-container *ngIf="!!(activeTab$ |async)">
<ds-cris-layout-sidebar-item *ngFor="let tab of tabs;" [tab]="tab" [layout]="'vertical'" [activeTab]="(activeTab$ |async)"
<ds-cris-layout-sidebar-item *ngFor="let tab of tabs;" [itemBaseUrl]="itemBaseUrl" [tab]="tab" [layout]="'vertical'" [activeTab]="(activeTab$ |async)"
(tabSelectedChange)="setActiveTab($event)"></ds-cris-layout-sidebar-item>
</ng-container>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ export abstract class CrisLayoutTabsComponent {
*/
@Output() selectedTab = new EventEmitter<CrisLayoutTab>();

/**
* The item base url
*/
itemBaseUrl: string;

constructor(public location: Location, public router: Router, public route: ActivatedRoute) {
}

init(): void {
this.itemBaseUrl = getItemPageRoute(this.item) + '/';
if (this.tabs && this.tabs.length > 0) {
if (isNotNull(this.route.snapshot.paramMap.get('tab'))) {
this.parseTabs(this.route.snapshot.paramMap.get('tab'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<li class="sidebar-section h-100" [ngClass]="{ 'active' : !!tab && !!activeTab && (tab.isActive || tab.id == activeTab.id), 'expanded': expanded, 'vertical': layout == 'vertical', 'horizontal': layout == 'horizontal' }">
<div class="icon-wrapper" *ngIf="!tab.children || tab.children.length == 0 ">
<a class="nav-item shortcut-icon" href="javascript:;" [ngClass]="{ 'px-4 justify-content-between' : layout == 'vertical' }"
[title]="getTabHeader(tab)" (click)="$event.preventDefault();selectTab(tab)" [innerHTML]="getTabHeader(tab)">

</a>
<a class="nav-item shortcut-icon"
href="javascript:void(0);"
[ngClass]="{ 'px-4 justify-content-between' : layout == 'vertical' }"
[title]="getTabHeader(tab)"
[routerLink]="itemBaseUrl + tab.shortname"
(click)="$event.stopPropagation();$event.preventDefault();selectTab(tab)"
[innerHTML]="getTabHeader(tab)"></a>
</div>
<div *ngIf="!!tab.children && tab.children.length > 0 " class="sidebar-collapsible h-100">
<a class="nav-item shortcut-icon" href="javascript:;" [ngClass]="{ 'px-4 justify-content-between' : layout == 'vertical' }"
Expand All @@ -19,10 +22,14 @@
</a>
<ul class="sidebar-sub-level-items list-unstyled" @slide *ngIf="expanded">
<li *ngFor="let subTab of tab.children" [ngClass]="{'active' : !!subTab && !!activeTab && subTab.id == activeTab.id}">
<a class="nav-item shortcut-icon" href="javascript:;" [ngClass]="{ 'px-4 justify-content-between' : layout == 'vertical' }"
(click)="$event.preventDefault();selectTab(subTab)">
<span id="sidebarName-{{subTab.id}}" class="pl-3 section-header-text" [innerHTML]="getTabHeader(subTab)">
</span>
<a class="nav-item shortcut-icon"
href="javascript:void(0);"
[ngClass]="{ 'px-4 justify-content-between' : layout == 'vertical' }"
[routerLink]="itemBaseUrl + subTab.shortname"
(click)="$event.stopPropagation();$event.preventDefault();selectTab(subTab)">
<span id="sidebarName-{{subTab.id}}"
class="pl-3 section-header-text"
[innerHTML]="getTabHeader(subTab)"></span>
</a>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import { TranslateService } from '@ngx-translate/core';
animations: [rotate, slide, rotateNavbar]
})
export class CrisLayoutSidebarItemComponent {
/**
* Contains the items base url
*/
@Input() itemBaseUrl: string;

/**
* The tab that will be shown
*/
Expand Down

0 comments on commit 3ff917f

Please sign in to comment.