mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-28 21:43:04 +00:00
Migrate page issue overlay to ES6 to fix display
In ES5 you can override getters via prototype but not with ES6. Rather than patch MobileFrontend just for this use case its easier to patch Minerva. Bug: T380314 Change-Id: I69ccdb93287dc5e080a0d5a8faa9d208dc67779d
This commit is contained in:
parent
b1eab45061
commit
ab1b4873df
resources/skins.minerva.scripts/page-issues/overlay
|
@ -12,16 +12,24 @@ const
|
||||||
*
|
*
|
||||||
* @param {IssueSummary} issues
|
* @param {IssueSummary} issues
|
||||||
*/
|
*/
|
||||||
function IssueList( issues ) {
|
class IssueList extends View {
|
||||||
this.issues = issues;
|
constructor( issues ) {
|
||||||
View.call( this, { className: 'cleanup' } );
|
super( {
|
||||||
|
className: 'cleanup',
|
||||||
|
issues
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
get tagName() {
|
||||||
|
return 'ul';
|
||||||
|
}
|
||||||
|
|
||||||
|
postRender() {
|
||||||
|
super.postRender();
|
||||||
|
this.append(
|
||||||
|
( this.options.issues || [] ).map( ( issue ) => new IssueNotice( issue ).$el )
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
OO.inheritClass( IssueList, View );
|
|
||||||
IssueList.prototype.tagName = 'ul';
|
|
||||||
IssueList.prototype.postRender = function () {
|
|
||||||
View.prototype.postRender.apply( this, arguments );
|
|
||||||
this.append(
|
|
||||||
( this.issues || [] ).map( ( issue ) => new IssueNotice( issue ).$el )
|
|
||||||
);
|
|
||||||
};
|
|
||||||
module.exports = IssueList;
|
module.exports = IssueList;
|
||||||
|
|
|
@ -11,14 +11,23 @@ const
|
||||||
*
|
*
|
||||||
* @param {IssueSummary} props
|
* @param {IssueSummary} props
|
||||||
*/
|
*/
|
||||||
function IssueNotice( props ) {
|
class IssueNotice extends View {
|
||||||
View.call( this, props );
|
constructor( props ) {
|
||||||
|
super( props );
|
||||||
|
}
|
||||||
|
|
||||||
|
get tagName() {
|
||||||
|
return 'li';
|
||||||
|
}
|
||||||
|
|
||||||
|
get template() {
|
||||||
|
return mw.template.get( 'skins.minerva.scripts', 'IssueNotice.mustache' );
|
||||||
|
}
|
||||||
|
|
||||||
|
postRender() {
|
||||||
|
super.postRender();
|
||||||
|
this.$el.find( '.issue-notice' ).prepend( this.options.issue.iconElement );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
OO.inheritClass( IssueNotice, View );
|
|
||||||
IssueNotice.prototype.tagName = 'li';
|
|
||||||
IssueNotice.prototype.template = mw.template.get( 'skins.minerva.scripts', 'IssueNotice.mustache' );
|
|
||||||
IssueNotice.prototype.postRender = function () {
|
|
||||||
View.prototype.postRender.apply( this, arguments );
|
|
||||||
this.$el.find( '.issue-notice' ).prepend( this.options.issue.iconElement );
|
|
||||||
};
|
|
||||||
module.exports = IssueNotice;
|
module.exports = IssueNotice;
|
||||||
|
|
|
@ -23,15 +23,10 @@ function pageIssuesOverlay( issues, section, namespaceID ) {
|
||||||
getNamespaceHeadingText( namespaceID ) :
|
getNamespaceHeadingText( namespaceID ) :
|
||||||
mw.msg( 'minerva-meta-data-issues-section-header' );
|
mw.msg( 'minerva-meta-data-issues-section-header' );
|
||||||
|
|
||||||
const overlay = new Overlay( {
|
return Overlay.make( {
|
||||||
className: 'overlay overlay-issues',
|
className: 'overlay overlay-issues',
|
||||||
heading: '<strong>' + headingText + '</strong>'
|
heading: `<strong>${ headingText }</strong>`
|
||||||
} );
|
}, new IssueList( issues ) );
|
||||||
|
|
||||||
overlay.$el.find( '.overlay-content' ).append(
|
|
||||||
new IssueList( issues ).$el
|
|
||||||
);
|
|
||||||
return overlay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue