Merge "pageIssuesOverlay is a factory function that returns an Overlay"
This commit is contained in:
commit
9258806a0f
|
@ -101,7 +101,9 @@ class MinervaHooks {
|
||||||
'resources/skins.minerva.scripts/pageIssuesParser.js',
|
'resources/skins.minerva.scripts/pageIssuesParser.js',
|
||||||
'resources/skins.minerva.scripts/downloadPageAction.js',
|
'resources/skins.minerva.scripts/downloadPageAction.js',
|
||||||
'resources/skins.minerva.scripts/AB.js',
|
'resources/skins.minerva.scripts/AB.js',
|
||||||
'resources/skins.minerva.scripts/PageIssuesOverlay.js',
|
'resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.js',
|
||||||
|
'resources/skins.minerva.scripts/page-issues/overlay/IssueList.js',
|
||||||
|
'resources/skins.minerva.scripts/page-issues/overlay/pageIssuesOverlay.js',
|
||||||
'resources/skins.minerva.scripts/pageIssues.js',
|
'resources/skins.minerva.scripts/pageIssues.js',
|
||||||
// test files
|
// test files
|
||||||
'tests/qunit/skins.minerva.scripts/downloadPageAction.test.js',
|
'tests/qunit/skins.minerva.scripts/downloadPageAction.test.js',
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<ul class="cleanup">
|
|
||||||
{{#issues}}
|
|
||||||
<li>
|
|
||||||
<div class="issue-notice" data-severity="{{severity}}">
|
|
||||||
{{{iconString}}}
|
|
||||||
<div class="issue-details">{{{text}}}</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{{/issues}}
|
|
||||||
</ul>
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
( function ( M ) {
|
||||||
|
var View = M.require( 'mobile.startup' ).View,
|
||||||
|
IssueNotice = M.require( 'skins.minerva.scripts/IssueNotice' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IssueList
|
||||||
|
* @class IssueList
|
||||||
|
* @extends View
|
||||||
|
*
|
||||||
|
* @param {IssueSummary} issues
|
||||||
|
*/
|
||||||
|
function IssueList( issues ) {
|
||||||
|
this.issues = issues;
|
||||||
|
View.call( this, { className: 'cleanup' } );
|
||||||
|
}
|
||||||
|
|
||||||
|
OO.mfExtend( IssueList, View, {
|
||||||
|
tagName: 'ul',
|
||||||
|
postRender: function () {
|
||||||
|
View.prototype.postRender.apply( this, arguments );
|
||||||
|
this.append(
|
||||||
|
this.issues.map( function ( issue ) {
|
||||||
|
return new IssueNotice( issue ).$el;
|
||||||
|
} )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
M.define( 'skins.minerva.scripts/IssueList', IssueList );
|
||||||
|
}( mw.mobileFrontend ) );
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="issue-notice" data-severity="{{#issue}}{{severity}}{{/issue}}">
|
||||||
|
<div class="issue-details">{{{text}}}</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,23 @@
|
||||||
|
( function ( M ) {
|
||||||
|
var View = M.require( 'mobile.startup' ).View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IssueNotice
|
||||||
|
* @class IssueNotice
|
||||||
|
* @extends View
|
||||||
|
*
|
||||||
|
* @param {IssueSummary} props
|
||||||
|
*/
|
||||||
|
function IssueNotice( props ) {
|
||||||
|
View.call( this, props );
|
||||||
|
}
|
||||||
|
OO.mfExtend( IssueNotice, View, {
|
||||||
|
tagName: 'li',
|
||||||
|
template: mw.template.get( 'skins.minerva.scripts', 'IssueNotice.hogan' ),
|
||||||
|
postRender: function () {
|
||||||
|
View.prototype.postRender.apply( this, arguments );
|
||||||
|
this.$( '.issue-notice' ).prepend( this.options.issue.icon.$el );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
M.define( 'skins.minerva.scripts/IssueNotice', IssueNotice );
|
||||||
|
}( mw.mobileFrontend ) );
|
|
@ -1,4 +1,4 @@
|
||||||
@import '../../minerva.less/minerva.variables';
|
@import '../../../../minerva.less/minerva.variables';
|
||||||
|
|
||||||
@smallIconSize: 24px;
|
@smallIconSize: 24px;
|
||||||
@largeIconSize: 50px;
|
@largeIconSize: 50px;
|
|
@ -1,7 +1,7 @@
|
||||||
( function ( M, mwMsg ) {
|
( function ( M, mwMsg ) {
|
||||||
var
|
var
|
||||||
Overlay = M.require( 'mobile.startup/Overlay' ),
|
Overlay = M.require( 'mobile.startup/Overlay' ),
|
||||||
util = M.require( 'mobile.startup/util' ),
|
IssueList = M.require( 'skins.minerva.scripts/IssueList' ),
|
||||||
KEYWORD_ALL_SECTIONS = 'all',
|
KEYWORD_ALL_SECTIONS = 'all',
|
||||||
NS_MAIN = 0,
|
NS_MAIN = 0,
|
||||||
NS_TALK = 1,
|
NS_TALK = 1,
|
||||||
|
@ -9,15 +9,14 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlay for displaying page issues
|
* Overlay for displaying page issues
|
||||||
* @class PageIssuesOverlay
|
|
||||||
* @extends Overlay
|
|
||||||
*
|
*
|
||||||
* @param {IssueSummary[]} issues list of page issue summaries for display.
|
* @param {IssueSummary[]} issues list of page issue summaries for display.
|
||||||
* @param {string} section
|
* @param {string} section
|
||||||
* @param {number} namespaceID
|
* @param {number} namespaceID
|
||||||
|
* @return {Overlay}
|
||||||
*/
|
*/
|
||||||
function PageIssuesOverlay( issues, section, namespaceID ) {
|
function pageIssuesOverlay( issues, section, namespaceID ) {
|
||||||
var
|
var overlay,
|
||||||
// Note only the main namespace is expected to make use of section issues, so the
|
// 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
|
// heading will always be minerva-meta-data-issues-section-header regardless of
|
||||||
// namespace.
|
// namespace.
|
||||||
|
@ -25,22 +24,16 @@
|
||||||
getNamespaceHeadingText( namespaceID ) :
|
getNamespaceHeadingText( namespaceID ) :
|
||||||
mwMsg( 'minerva-meta-data-issues-section-header' );
|
mwMsg( 'minerva-meta-data-issues-section-header' );
|
||||||
|
|
||||||
Overlay.call( this, {
|
overlay = new Overlay( {
|
||||||
issues: issues,
|
|
||||||
className: 'overlay overlay-issues',
|
className: 'overlay overlay-issues',
|
||||||
heading: '<strong>' + headingText + '</strong>'
|
heading: '<strong>' + headingText + '</strong>'
|
||||||
} );
|
} );
|
||||||
}
|
|
||||||
|
|
||||||
OO.mfExtend( PageIssuesOverlay, Overlay, {
|
overlay.$( '.overlay-content' ).append(
|
||||||
/**
|
new IssueList( issues ).$el
|
||||||
* @memberof PageIssuesOverlay
|
);
|
||||||
* @instance
|
return overlay;
|
||||||
*/
|
}
|
||||||
templatePartials: util.extend( {}, Overlay.prototype.templatePartials, {
|
|
||||||
content: mw.template.get( 'skins.minerva.scripts', 'PageIssuesOverlayContent.hogan' )
|
|
||||||
} )
|
|
||||||
} );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a suitable heading for the issues overlay based on the namespace
|
* Obtain a suitable heading for the issues overlay based on the namespace
|
||||||
|
@ -60,5 +53,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
M.define( 'skins.minerva.scripts/PageIssuesOverlay', PageIssuesOverlay );
|
M.define( 'skins.minerva.scripts/pageIssuesOverlay', pageIssuesOverlay );
|
||||||
}( mw.mobileFrontend, mw.msg ) );
|
}( mw.mobileFrontend, mw.msg ) );
|
|
@ -9,7 +9,7 @@
|
||||||
CURRENT_NS = config.get( 'wgNamespaceNumber' ),
|
CURRENT_NS = config.get( 'wgNamespaceNumber' ),
|
||||||
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
||||||
pageIssuesParser = M.require( 'skins.minerva.scripts/pageIssuesParser' ),
|
pageIssuesParser = M.require( 'skins.minerva.scripts/pageIssuesParser' ),
|
||||||
PageIssuesOverlay = M.require( 'skins.minerva.scripts/PageIssuesOverlay' ),
|
pageIssuesOverlay = M.require( 'skins.minerva.scripts/pageIssuesOverlay' ),
|
||||||
// When the query string flag is set force on new treatment.
|
// When the query string flag is set force on new treatment.
|
||||||
// When wgMinervaPageIssuesNewTreatment is the default this line can be removed.
|
// When wgMinervaPageIssuesNewTreatment is the default this line can be removed.
|
||||||
QUERY_STRING_FLAG = mw.util.getParamValue( 'minerva-issues' ),
|
QUERY_STRING_FLAG = mw.util.getParamValue( 'minerva-issues' ),
|
||||||
|
@ -267,8 +267,9 @@
|
||||||
|
|
||||||
// Setup the overlay route.
|
// Setup the overlay route.
|
||||||
overlayManager.add( new RegExp( '^/issues/(\\d+|' + KEYWORD_ALL_SECTIONS + ')$' ), function ( section ) {
|
overlayManager.add( new RegExp( '^/issues/(\\d+|' + KEYWORD_ALL_SECTIONS + ')$' ), function ( section ) {
|
||||||
return new PageIssuesOverlay(
|
return pageIssuesOverlay(
|
||||||
getIssues( section ), section, CURRENT_NS );
|
getIssues( section ), section, CURRENT_NS
|
||||||
|
);
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,10 +419,10 @@
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"resources/skins.minerva.scripts/styles.less",
|
"resources/skins.minerva.scripts/styles.less",
|
||||||
"resources/skins.minerva.scripts/PageIssuesOverlay.less"
|
"resources/skins.minerva.scripts/page-issues/overlay/PageIssuesOverlay.less"
|
||||||
],
|
],
|
||||||
"templates": {
|
"templates": {
|
||||||
"PageIssuesOverlayContent.hogan": "resources/skins.minerva.scripts/PageIssuesOverlayContent.hogan"
|
"IssueNotice.hogan": "resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.hogan"
|
||||||
},
|
},
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"resources/skins.minerva.scripts/errorLogging.js",
|
"resources/skins.minerva.scripts/errorLogging.js",
|
||||||
|
@ -430,7 +430,9 @@
|
||||||
"resources/skins.minerva.scripts/downloadPageAction.js",
|
"resources/skins.minerva.scripts/downloadPageAction.js",
|
||||||
"resources/skins.minerva.scripts/pageIssuesParser.js",
|
"resources/skins.minerva.scripts/pageIssuesParser.js",
|
||||||
"resources/skins.minerva.scripts/AB.js",
|
"resources/skins.minerva.scripts/AB.js",
|
||||||
"resources/skins.minerva.scripts/PageIssuesOverlay.js",
|
"resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.js",
|
||||||
|
"resources/skins.minerva.scripts/page-issues/overlay/IssueList.js",
|
||||||
|
"resources/skins.minerva.scripts/page-issues/overlay/pageIssuesOverlay.js",
|
||||||
"resources/skins.minerva.scripts/pageIssues.js",
|
"resources/skins.minerva.scripts/pageIssues.js",
|
||||||
"resources/skins.minerva.scripts/init.js",
|
"resources/skins.minerva.scripts/init.js",
|
||||||
"resources/skins.minerva.scripts/initLogging.js",
|
"resources/skins.minerva.scripts/initLogging.js",
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
mw.template.add( 'skins.minerva.scripts', 'PageIssuesOverlayContent.hogan', '' );
|
// Since tests.minerva.scripts does
|
||||||
|
// not pull in the entire module skins.minerva.scripts
|
||||||
|
// we have to stub certain templates to make it appear like its been loaded.
|
||||||
|
mw.template.add( 'skins.minerva.scripts', 'IssueNotice.hogan', '' );
|
||||||
|
|
Loading…
Reference in New Issue