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
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
const
|
|
Overlay = require( 'mobile.startup' ).Overlay,
|
|
IssueList = require( './IssueList.js' ),
|
|
KEYWORD_ALL_SECTIONS = 'all',
|
|
NS_MAIN = 0,
|
|
NS_CATEGORY = 14;
|
|
|
|
/**
|
|
* Overlay for displaying page issues
|
|
*
|
|
* @param {IssueSummary[]} issues list of page issue summaries for display.
|
|
* @param {string} section
|
|
* @param {number} namespaceID
|
|
* @return {Overlay}
|
|
*/
|
|
function pageIssuesOverlay( issues, section, namespaceID ) {
|
|
var overlay,
|
|
// Note only the main namespace is expected to make use of section issues, so the
|
|
// heading will always be minerva-meta-data-issues-section-header regardless of
|
|
// namespace.
|
|
headingText = section === '0' || section === KEYWORD_ALL_SECTIONS ?
|
|
getNamespaceHeadingText( namespaceID ) :
|
|
mw.msg( 'minerva-meta-data-issues-section-header' );
|
|
|
|
overlay = new Overlay( {
|
|
className: 'overlay overlay-issues',
|
|
heading: '<strong>' + headingText + '</strong>'
|
|
} );
|
|
|
|
overlay.$el.find( '.overlay-content' ).append(
|
|
new IssueList( issues ).$el
|
|
);
|
|
return overlay;
|
|
}
|
|
|
|
/**
|
|
* Obtain a suitable heading for the issues overlay based on the namespace
|
|
*
|
|
* @param {number} namespaceID is the namespace to generate heading for
|
|
* @return {string} heading for overlay
|
|
*/
|
|
function getNamespaceHeadingText( namespaceID ) {
|
|
switch ( namespaceID ) {
|
|
case NS_CATEGORY:
|
|
return mw.msg( 'mobile-frontend-meta-data-issues-categories' );
|
|
case NS_MAIN:
|
|
return mw.msg( 'mobile-frontend-meta-data-issues' );
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
|
|
module.exports = pageIssuesOverlay;
|