Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Adds navigation to top and bottom

AuthorDave Jarvis <email>
Date2026-02-20 18:46:33 GMT-0800
Commit13ba87a1eb0a3cb4edf2faf07d2e6592af4dc33d
Parent7ee1401
pages/CommitsPage.php
$start = $this->hash !== '' ? $this->hash : $main['hash'];
+ $commits = [];
+
$this->git->history(
$start,
self::PER_PAGE,
- function( $commit ) use ( &$count ) {
- $this->renderCommitRow( $commit );
-
- $count++;
+ function( $commit ) use ( &$commits ) {
+ $commits[] = $commit;
}
);
+
+ $count = count( $commits );
+ $nav = $this->buildPaginationData( $main['hash'], $count );
+
+ $this->renderPaginationFromData( $nav );
+
+ foreach( $commits as $commit ) {
+ $this->renderCommitRow( $commit );
+ }
echo '</div>';
- $this->renderPagination( $main['hash'], $count );
+ $this->renderPaginationFromData( $nav );
}
}, $this->currentRepo );
}
- private function renderPagination( string $mainHash, int $count ) {
- $nav = $this->buildPaginationData( $mainHash, $count );
+ private function renderPaginationFromData( array $nav ) {
$pages = $nav['pages'];
$current = $nav['current'];
Delta15 lines added, 7 lines removed, 8-line increase