2018-09-14 05:30:46 +00:00
|
|
|
( function () {
|
2017-06-06 23:38:57 +00:00
|
|
|
'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}
|
|
|
|
*/
|
2019-04-09 16:13:19 +00:00
|
|
|
this.$el = $( '<ul>' ).attr( { class: 'ext-related-articles-card-list' } );
|
2017-06-06 23:38:57 +00:00
|
|
|
|
|
|
|
// We don't want to use template partials because we want to
|
|
|
|
// preserve event handlers of each card view.
|
2018-08-17 10:27:26 +00:00
|
|
|
this.cardViews.forEach( function ( cardView ) {
|
2017-06-06 23:38:57 +00:00
|
|
|
self.$el.append( cardView.$el );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
OO.initClass( CardListView );
|
|
|
|
|
|
|
|
mw.cards.CardListView = CardListView;
|
2018-09-14 05:30:46 +00:00
|
|
|
}() );
|