Skip to content

Commit e5feacc

Browse files
[UXP-34] fix conflicts, align code
1 parent 59c88d8 commit e5feacc

3 files changed

Lines changed: 41 additions & 5 deletions

File tree

src/app/shared/carousel/carousel.component.html

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ngb-carousel #carousel [interval]="2000" (slide)="onSlide($event)" class="ds-carousel">
2-
<ng-template ngbSlide *ngFor="let item of items; let i = index; let last = last">
2+
<ng-template ngbSlide *ngFor="let item of currentPageItems(); let i = index; let last = last">
33
<ng-container *ngIf="getItemLink(item.indexableObject); let currentLink; else carouselContent">
44
<a *ngIf="internalLinkService.isLinkInternal(currentLink)" [routerLink]="internalLinkService.getRelativePath(currentLink)">
55
<ng-container *ngTemplateOutlet="carouselContent"></ng-container>
@@ -39,3 +39,38 @@
3939
<i class="fas fa-pause" *ngIf="!paused"></i>
4040
</button>
4141
</div>
42+
<div class="mt-4 w-100 d-flex justify-content-center align-items-center" *ngIf="totalPages > 1">
43+
<button (click)="previousPage()" [disabled]="currentPage === 1" class="prev border-0 bg-transparent">
44+
<i class="fa fa-arrow-left"></i>
45+
</button>
46+
<button
47+
*ngFor="let page of pages()"
48+
class="number"
49+
(click)="changePage(page)"
50+
style="border: none; background: none; margin: 0 5px"
51+
[style.color]="page === currentPage ? '#000000' : '#7c7c7c'">
52+
{{ page < 10 ? '0' + page : page }}
53+
</button>
54+
<button (click)="nextPage()" [disabled]="currentPage === pages().length" class="next border-0 bg-transparent">
55+
<i class="fa fa-arrow-right"></i>
56+
</button>
57+
</div>
58+
59+
<div
60+
class="carousel-content-wrapper"
61+
[ngStyle]="{
62+
'height': carouselOptions.keepAspectRatio ? null : carouselOptions.carouselHeightPx + 'px',
63+
'aspect-ratio': carouselOptions.keepAspectRatio ? carouselOptions.aspectRatio : null
64+
}"
65+
*ngIf="(isLoading$ | async)"
66+
>
67+
<a
68+
href="#"
69+
target="_blank"
70+
class="img-container-el">
71+
<div class="picsum-img-wrapper flex-column">
72+
<img class="img-fluid" src="assets/images/replacement_image.svg">
73+
{{'loading.default' | translate}}
74+
</div>
75+
</a>
76+
</div>

src/app/shared/carousel/carousel.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { CarouselOptions } from './carousel-options.model';
3838
import { SortDirection } from '../../core/cache/models/sort-options.model';
3939
import { SearchManager } from '../../core/browse/search-manager';
4040
import { toRemoteData } from '../../browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec';
41+
import { InternalLinkService } from '../../core/services/internal-link.service';
4142

4243
describe('CarouselComponent', () => {
4344
let component: CarouselComponent;
@@ -180,7 +181,8 @@ describe('CarouselComponent', () => {
180181
providers: [
181182
CarouselComponent,
182183
{ provide: ObjectCacheService, useValue: {} },
183-
{ provide: UUIDService, useValue: {} },
184+
{ provide: InternalLinkService, useValue: {} },
185+
{ provide: UUIDService, useValue: {} },
184186
{ provide: Store, useValue: {} },
185187
{ provide: RemoteDataBuildService, useValue: {} },
186188
{ provide: HALEndpointService, useValue: {} },

src/app/shared/carousel/carousel.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { SortOptions } from '../../core/cache/models/sort-options.model';
2020
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
2121
import { PaginatedSearchOptions } from '../search/models/paginated-search-options.model';
2222
import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
23+
import { InternalLinkService } from '../../core/services/internal-link.service';
2324

2425
/**
2526
* Component representing the Carousel component section.
@@ -112,6 +113,7 @@ export class CarouselComponent implements OnInit {
112113
constructor(
113114
protected bitstreamDataService: BitstreamDataService,
114115
private searchManager: SearchManager,
116+
public internalLinkService: InternalLinkService,
115117
@Inject(NativeWindowService) private _window: NativeWindowRef,
116118
) {
117119
}
@@ -215,9 +217,6 @@ export class CarouselComponent implements OnInit {
215217
return item.firstMetadataValue(this.link);
216218
}
217219

218-
isLinkInternal(link: string) {
219-
return link.startsWith('/');
220-
}
221220

222221
/**
223222
* to open a link of an item

0 commit comments

Comments
 (0)