Merge pull request #273 from GruberViktor/dev

Added nav buttons in the document detail view
This commit is contained in:
shamoon
2022-03-11 11:57:03 -08:00
committed by GitHub
3 changed files with 63 additions and 2 deletions

View File

@@ -34,11 +34,25 @@
</svg>&nbsp;<span class="d-none d-lg-inline" i18n>More like this</span>
</button>
<button type="button" class="btn btn-sm btn-outline-primary" (click)="close()">
<button type="button" class="btn btn-sm btn-outline-primary me-2" i18n-title title="Close" (click)="close()">
<svg class="buttonicon" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#x" />
</svg>&nbsp;<span class="d-none d-lg-inline" i18n>Close</span>
</svg>
</button>
<div class="button-group">
<button type="button" class="btn btn-sm btn-outline-primary me-2" i18n-title title="Previous" (click)="previousDoc()" [disabled]="!hasPrevious()">
<svg class="buttonicon" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#arrow-left" />
</svg>
</button>
<button type="button" class="btn btn-sm btn-outline-primary" i18n-title title="Next" (click)="nextDoc()" [disabled]="!hasNext()">
<svg class="buttonicon" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#arrow-right" />
</svg>
</button>
</div>
</app-page-header>

View File

@@ -292,6 +292,22 @@ export class DocumentDetailComponent implements OnInit, OnDestroy, DirtyComponen
return this.documentListViewService.hasNext(this.documentId)
}
hasPrevious() {
return this.documentListViewService.hasPrevious(this.documentId)
}
nextDoc() {
this.documentListViewService.getNext(this.document.id).subscribe((nextDocId: number) => {
this.router.navigate(['documents', nextDocId])
})
}
previousDoc () {
this.documentListViewService.getPrevious(this.document.id).subscribe((prevDocId: number) => {
this.router.navigate(['documents', prevDocId])
})
}
pdfPreviewLoaded(pdf: PDFDocumentProxy) {
this.previewNumPages = pdf.numPages
}