2018-08-17 19:00:57 +00:00
|
|
|
( function ( M, mwMsg ) {
|
|
|
|
var
|
|
|
|
Overlay = M.require( 'mobile.startup/Overlay' ),
|
|
|
|
util = M.require( 'mobile.startup/util' ),
|
|
|
|
KEYWORD_ALL_SECTIONS = 'all',
|
|
|
|
NS_MAIN = 0,
|
|
|
|
NS_TALK = 1,
|
|
|
|
NS_CATEGORY = 14;
|
2018-08-16 19:00:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Overlay for displaying page issues
|
|
|
|
* @class PageIssuesOverlay
|
|
|
|
* @extends Overlay
|
|
|
|
*
|
2018-08-17 19:00:57 +00:00
|
|
|
* @param {IssueSummary[]} issues list of page issue summaries for display.
|
|
|
|
* @param {string} section
|
|
|
|
* @param {number} namespaceID
|
2018-08-16 19:00:38 +00:00
|
|
|
*/
|
2018-10-10 21:49:25 +00:00
|
|
|
function PageIssuesOverlay( issues, section, namespaceID ) {
|
2018-08-17 19:00:57 +00:00
|
|
|
var
|
2018-09-13 15:33:20 +00:00
|
|
|
// 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.
|
2018-08-17 19:00:57 +00:00
|
|
|
headingText = section === '0' || section === KEYWORD_ALL_SECTIONS ?
|
|
|
|
getNamespaceHeadingText( namespaceID ) :
|
|
|
|
mwMsg( 'minerva-meta-data-issues-section-header' );
|
|
|
|
|
2018-10-10 21:49:25 +00:00
|
|
|
Overlay.call( this, {
|
|
|
|
issues: issues,
|
|
|
|
heading: '<strong>' + headingText + '</strong>'
|
|
|
|
} );
|
2018-08-16 19:00:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OO.mfExtend( PageIssuesOverlay, Overlay, {
|
|
|
|
/**
|
|
|
|
* @memberof PageIssuesOverlay
|
|
|
|
* @instance
|
|
|
|
*/
|
|
|
|
className: 'overlay overlay-issues',
|
2018-08-17 19:00:57 +00:00
|
|
|
|
2018-08-16 19:00:38 +00:00
|
|
|
/**
|
|
|
|
* @memberof PageIssuesOverlay
|
|
|
|
* @instance
|
|
|
|
*/
|
|
|
|
templatePartials: util.extend( {}, Overlay.prototype.templatePartials, {
|
|
|
|
content: mw.template.get( 'skins.minerva.scripts', 'PageIssuesOverlayContent.hogan' )
|
2018-10-10 21:49:25 +00:00
|
|
|
} )
|
2018-08-16 19:00:38 +00:00
|
|
|
} );
|
2018-08-17 19:00:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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_TALK:
|
|
|
|
return mw.msg( 'mobile-frontend-meta-data-issues-talk' );
|
|
|
|
case NS_MAIN:
|
|
|
|
return mw.msg( 'mobile-frontend-meta-data-issues' );
|
|
|
|
default:
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-16 19:00:38 +00:00
|
|
|
M.define( 'skins.minerva.scripts/PageIssuesOverlay', PageIssuesOverlay );
|
2018-08-17 19:00:57 +00:00
|
|
|
}( mw.mobileFrontend, mw.msg ) );
|