File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11< ngb-carousel #carousel [interval] ="2000 " (slide) ="onSlide($event) " class ="ds-carousel ">
22 < ng-template ngbSlide *ngFor ="let item of items; let i = index; let last = last ">
33 < ng-container *ngIf ="getItemLink(item.indexableObject); let currentLink; else carouselContent ">
4- < a *ngIf ="isLinkInternal(currentLink) " [routerLink] ="currentLink ">
4+ < a *ngIf ="internalLinkService. isLinkInternal(currentLink) " [routerLink] ="internalLinkService.getRelativePath( currentLink) ">
55 < ng-container *ngTemplateOutlet ="carouselContent "> </ ng-container >
66 </ a >
7- < a *ngIf ="!isLinkInternal(currentLink) " [href] ="currentLink " [target] ="carouselOptions.targetBlank ? '_blank' : null ">
7+ < a *ngIf ="!internalLinkService. isLinkInternal(currentLink) " [href] ="currentLink " [target] ="carouselOptions.targetBlank ? '_blank' : null ">
88 < ng-container *ngTemplateOutlet ="carouselContent "> </ ng-container >
99 </ a >
1010 </ ng-container >
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import { createPaginatedList } from '../testing/utils.test';
3535import { ItemSearchResult } from '../object-collection/shared/item-search-result.model' ;
3636import { BitstreamFormat } from '../../core/shared/bitstream-format.model' ;
3737import { CarouselOptions } from './carousel-options.model' ;
38+ import { InternalLinkService } from 'src/app/core/services/internal-link.service' ;
3839
3940describe ( 'CarouselComponent' , ( ) => {
4041 let component : CarouselComponent ;
@@ -168,6 +169,7 @@ describe('CarouselComponent', () => {
168169 providers : [
169170 CarouselComponent ,
170171 { provide : ObjectCacheService , useValue : { } } ,
172+ { provide : InternalLinkService , useValue : { } } ,
171173 { provide : UUIDService , useValue : { } } ,
172174 { provide : Store , useValue : { } } ,
173175 { provide : RemoteDataBuildService , useValue : { } } ,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import {Bitstream} from '../../core/shared/bitstream.model';
88import { BitstreamDataService } from '../../core/data/bitstream-data.service' ;
99import { NativeWindowRef , NativeWindowService } from '../../core/services/window.service' ;
1010import { getFirstCompletedRemoteData } from '../../core/shared/operators' ;
11+ import { InternalLinkService } from '../../core/services/internal-link.service' ;
1112import { hasValue } from '../empty.util' ;
1213import { ItemSearchResult } from '../object-collection/shared/item-search-result.model' ;
1314import { followLink } from '../utils/follow-link-config.model' ;
@@ -82,6 +83,7 @@ export class CarouselComponent implements OnInit {
8283 isLoading$ = new BehaviorSubject ( true ) ;
8384
8485 constructor (
86+ public internalLinkService : InternalLinkService ,
8587 protected bitstreamDataService : BitstreamDataService ,
8688 @Inject ( NativeWindowService ) private _window : NativeWindowRef ,
8789 ) {
@@ -157,10 +159,6 @@ export class CarouselComponent implements OnInit {
157159 return item . firstMetadataValue ( this . link ) ;
158160 }
159161
160- isLinkInternal ( link : string ) {
161- return link . startsWith ( '/' ) ;
162- }
163-
164162 /**
165163 * to open a link of an item
166164 */
You can’t perform that action at this time.
0 commit comments