The MinervaTemplate getHistoryLink method generates data and creates a new instance of TemplateParser to render a Mustache template called history. The data generation should be moved to SkinMinerva::getTemplateData
- MinervaTemplate::getHistoryLinkHtml should not exist
- SkinMinerva::getTemplateData should set a field data-history-link that can be used inside minerva.mustache to be passed into history.mustache
- The new method should be consolidated with this code in SkinMinerva::prepareHeaderAndFooter
if ( $this->canUseWikiPage() && $this->getWikiPage()->exists() ) { $tpl->set( 'historyLink', $this->getHistoryLink( $title ) ); }
- SkinMinerva should not create another instance of TemplateParser <<< this should be completely removed in T293815
Developer notes
The history link function:
protected function getHistoryLinkHtml( $data ) { $action = Action::getActionName( RequestContext::getMain() ); if ( isset( $data['historyLink'] ) && $action === 'view' ) { $args = [ 'historyIconClass' => MinervaUI::iconClass( 'history-base20', 'mw-ui-icon-small', '', 'wikimedia' ), 'arrowIconClass' => MinervaUI::iconClass( 'expand-gray', 'small', 'mf-mw-ui-icon-rotate-anti-clockwise indicator', // Uses icon in MobileFrontend so must be prefixed mf. // Without MobileFrontend it will not render. // Rather than maintain 2 versions (and variants) of the arrow icon which can conflict // with each othe and bloat CSS, we'll // use the MobileFrontend one. Long term when T177432 and T160690 are resolved // we should be able to use one icon definition and break this dependency. 'mf' ), ] + $data['historyLink']; $templateParser = new TemplateParser( __DIR__ ); return $templateParser->processTemplate( 'history', $args ); } return '';
QA steps
- Navigate to the bottom of an article page using the minerva skin on beta cluster i.e.
- Note that the history link in the footer looks the same as production
QA Results - Beta & Prod
AC | Status | Details |
---|---|---|
1 | ✅ | T292554#7487905 |