Add attributes for Minerva click tracking

Bug: T295490
Change-Id: I05fa96280c8dacc801b071d22086568ee0f11d86
This commit is contained in:
Bartosz Dziewoński 2022-05-27 03:55:09 +02:00
parent f083d129e2
commit 28124e7f1e
2 changed files with 9 additions and 2 deletions

View file

@ -350,13 +350,15 @@ class PageHooks implements
// talk page feature is enabled, but we shouldn't depend on code from there.
$output->enableOOUI();
$output->addHTML(
new ButtonWidget( [
( new ButtonWidget( [
'href' => $title->getLinkURL( [ 'action' => 'edit', 'section' => 'new' ] ),
// TODO: Make this a local message if the Minerva feature goes away
'label' => $context->msg( 'minerva-talk-add-topic' )->text(),
'flags' => [ 'progressive', 'primary' ],
'classes' => [ 'ext-discussiontools-init-new-topic' ]
] )
] ) )
// For compatibility with Minerva click tracking (T295490)
->setAttributes( [ 'data-event-name' => 'talkpage.add-topic' ] )
);
}
}

View file

@ -244,6 +244,11 @@ function init( $container, state ) {
// Lazy-load postEdit module, may be required later (on desktop)
mw.loader.using( 'mediawiki.action.view.postEdit' );
if ( OO.ui.isMobile() && mw.config.get( 'skin' ) === 'minerva' ) {
// For compatibility with Minerva click tracking (T295490)
$container.find( '.section-heading' ).attr( 'data-event-name', 'talkpage.section' );
}
$pageContainer = $container;
linksController = new ReplyLinksController( $pageContainer );
var parser = new Parser( require( './parser/data.json' ) );