mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-12-19 11:30:44 +00:00
911d78e8ee
Follow up to I9442b0336e22ca795cc06f76068215266fe81271 Bug: T306228 Change-Id: Ifb1f1937009b098999471cfa5e820a063dc5a4a0
31 lines
680 B
JavaScript
31 lines
680 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* View that renders multiple {@link mw.cards.CardView cards}
|
|
*
|
|
* @class mw.cards.CardListView
|
|
* @param {mw.cards.CardView[]} cardViews
|
|
*/
|
|
function CardListView( cardViews ) {
|
|
var self = this;
|
|
|
|
/**
|
|
* @property {mw.cards.CardView[]|Array}
|
|
*/
|
|
this.cardViews = cardViews || [];
|
|
|
|
/**
|
|
* @property {jQuery}
|
|
*/
|
|
this.$el = $( '<ul>' ).attr( { class: 'ext-related-articles-card-list' } );
|
|
|
|
// We don't want to use template partials because we want to
|
|
// preserve event handlers of each card view.
|
|
this.cardViews.forEach( function ( cardView ) {
|
|
self.$el.append( cardView.$el );
|
|
} );
|
|
}
|
|
OO.initClass( CardListView );
|
|
|
|
module.exports = CardListView;
|