mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-13 22:49:46 +00:00
ca28efc9c7
This restores the previously reverted patchset If5b76245bf60bfa9cf977cdbf37ee0d6bb65f9d9 Changes since original: * Added Depends-On to MobileFrontend * Uses OOUI classes for page issues rather than es6 classes - ES6 classes do not support modifications to class prior to running super so MobileFrontend's View class is not compatible without significant refactors. Depends-On: I24ad75adf8519102ca356d64d99d765ab69180cc Bug: T348807 Change-Id: I4ff82af0251254c846f2caee330af5af738f6029
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
( function () {
|
|
var
|
|
newPageIssueLink = require( './PageIssueLink.js' ),
|
|
newPageIssueLearnMoreLink = require( './PageIssueLearnMoreLink.js' );
|
|
|
|
/**
|
|
* Modifies the `issue` DOM to create a banner designed for single / multiple issue templates,
|
|
* and handles event-binding for that issues overlay.
|
|
*
|
|
* @param {IssueSummary} issue
|
|
* @param {string} msg
|
|
* @param {string} overlayUrl
|
|
* @param {Object} overlayManager
|
|
* @param {boolean} [multiple]
|
|
*/
|
|
function insertPageIssueBanner( issue, msg, overlayUrl, overlayManager, multiple ) {
|
|
var $learnMoreEl = newPageIssueLearnMoreLink( msg ),
|
|
$issueContainer = multiple ?
|
|
issue.$el.parents( '.mbox-text-span, .mbox-text-div' ) :
|
|
issue.$el.find( '.mbox-text' ),
|
|
$clickContainer = multiple ? issue.$el.parents( '.mbox-text' ) : issue.$el;
|
|
|
|
$issueContainer.prepend( issue.issue.iconElement );
|
|
$issueContainer.prepend( $learnMoreEl );
|
|
|
|
$clickContainer.on( 'click', function () {
|
|
overlayManager.router.navigate( overlayUrl );
|
|
return false;
|
|
} );
|
|
}
|
|
|
|
/**
|
|
* Modifies the page DOM to insert a page-issue notice below the title of the page,
|
|
* containing a link with a message like "this page has issues".
|
|
* Used on category namespaces, or when page-issue banners have been disabled.
|
|
*
|
|
* @param {string} labelText
|
|
* @param {string} section
|
|
*/
|
|
function insertPageIssueNotice( labelText, section ) {
|
|
var $link = newPageIssueLink( labelText );
|
|
$link.attr( 'href', '#/issues/' + section );
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
$link.insertAfter( $( 'h1.mw-first-heading' ) );
|
|
}
|
|
|
|
module.exports = {
|
|
insertPageIssueBanner,
|
|
insertPageIssueNotice
|
|
};
|
|
}() );
|