jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/405986 )
Change subject: cover: Fix cover-extension breadcrumbs to work on different mount paths ...................................................................... cover: Fix cover-extension breadcrumbs to work on different mount paths For local dev. Matches logic we use in top nav already. Change-Id: Ifcd41842ca5944ef29ca6c4d04d4e466fb69271c --- M shared/CoveragePage.php M shared/Page.php 2 files changed, 13 insertions(+), 6 deletions(-) Approvals: Krinkle: Looks good to me, approved jenkins-bot: Verified Objections: Reedy: There's a problem with this change, please improve diff --git a/shared/CoveragePage.php b/shared/CoveragePage.php index 67d583a..8bb60e5 100644 --- a/shared/CoveragePage.php +++ b/shared/CoveragePage.php @@ -48,16 +48,18 @@ $this->embedCSS( file_get_contents( __DIR__ . '/cover.css' ) ); if ( $this->pageName === 'Test coverage' ) { + $href = $this->fixNavUrl( '/cover-extensions/' ); $breadcrumbs = <<<HTML <ol class="breadcrumb"> <li class="active">Coverage home</li> - <li><a href="/cover-extensions/">MediaWiki extensions</a></li> + <li><a href="$href">MediaWiki extensions</a></li> </ol> HTML; } else { + $href = $this->fixNavUrl( '/cover/' ); $breadcrumbs = <<<HTML <ol class="breadcrumb"> - <li><a href="/cover/">Coverage home</a></li> + <li><a href="$href">Coverage home</a></li> <li class="active">MediaWiki extensions</li> </ol> HTML; diff --git a/shared/Page.php b/shared/Page.php index 801aa40..c82aa7a 100644 --- a/shared/Page.php +++ b/shared/Page.php @@ -248,15 +248,20 @@ ); } + protected function fixNavUrl( $href ) { + if ( $href[0] === '/' ) { + // Expand relatively so that it works even if the site is mounted in a sub directory. + $href = substr( $this->getRootPath(), 0, -1 ) . $href; + } + return $href; + } + protected function getNavHtml() { $html = '<ul class="navbar-nav nav">'; $cur = $this->getRequestPath(); foreach ( $this->getNavItems() as $href => $text ) { $active = ( $href === "/$cur" ? ' class="active"' : '' ); - if ( $href[0] === '/' ) { - // Expand relatively so that it works even if the site is mounted in a sub directory. - $href = substr( $this->getRootPath(), 0, -1 ) . $href; - } + $href = $this->fixNavUrl( $href ); $html .= '<li' . $active . '><a href="' . htmlspecialchars( $href ) . '">' . htmlspecialchars( $text ) . '</a></li>'; } $html .= '</ul>'; -- To view, visit https://gerrit.wikimedia.org/r/405986 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifcd41842ca5944ef29ca6c4d04d4e466fb69271c Gerrit-PatchSet: 2 Gerrit-Project: integration/docroot Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Hashar <has...@free.fr> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits