88300: Fix next button tooltip

This commit is contained in:
Marie Verdonck
2022-03-17 14:35:28 +01:00
parent 97dc241c52
commit c50e6c224d
2 changed files with 8 additions and 2 deletions

View File

@@ -35,7 +35,7 @@
<div> <div>
<button id="nav-prev" type="button" class="btn btn-outline-primary float-left" (click)="goPrev()" [disabled]="objects?.payload?.currentPage <= 1"><i class="fas fa-angle-left"></i> {{'browse.previous.button' |translate}}</button> <button id="nav-prev" type="button" class="btn btn-outline-primary float-left" (click)="goPrev()" [disabled]="objects?.payload?.currentPage <= 1"><i class="fas fa-angle-left"></i> {{'browse.previous.button' |translate}}</button>
<button id="nav-next" type="button" class="btn btn-outline-primary float-right" (click)="goNext()" [disabled]="objects?.payload?.currentPage >= objects?.payload?.totalPages"> <button id="nav-next" type="button" class="btn btn-outline-primary float-right" (click)="goNext()" [disabled]="objects?.payload?.currentPage >= objects?.payload?.totalPages">
<span [ngbTooltip]="objects?.payload?.currentPage >= objects?.payload?.totalPages ? 'browse.next.button.disabled.tooltip': null"> <span [ngbTooltip]="objects?.payload?.currentPage >= objects?.payload?.totalPages ? getTranslation('browse.next.button.disabled.tooltip') : null">
<i class="fas fa-angle-right"></i> {{'browse.next.button' |translate}} <i class="fas fa-angle-right"></i> {{'browse.next.button' |translate}}
</span> </span>
</button> </button>

View File

@@ -11,6 +11,8 @@ import { PaginationService } from '../../core/pagination/pagination.service';
import { RouteService } from '../../core/services/route.service'; import { RouteService } from '../../core/services/route.service';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { hasValue } from '../empty.util'; import { hasValue } from '../empty.util';
import { Location } from '@angular/common';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
selector: 'ds-browse-by', selector: 'ds-browse-by',
@@ -107,7 +109,8 @@ export class BrowseByComponent implements OnInit {
public constructor(private injector: Injector, public constructor(private injector: Injector,
protected paginationService: PaginationService, protected paginationService: PaginationService,
private routeService: RouteService private routeService: RouteService,
protected translate: TranslateService
) { ) {
} }
@@ -164,7 +167,10 @@ export class BrowseByComponent implements OnInit {
this.shouldDisplayResetButton$ = observableCombineLatest([startsWith$, value$]).pipe( this.shouldDisplayResetButton$ = observableCombineLatest([startsWith$, value$]).pipe(
map(([startsWith, value]) => hasValue(startsWith) || hasValue(value)) map(([startsWith, value]) => hasValue(startsWith) || hasValue(value))
); );
}
getTranslation(key: string): Observable<string> {
return this.translate.instant(key);
} }
} }