mediawiki-extensions-Relate.../resources/ext.relatedArticles.cards/CardListView.js
Fomafix 00405b0309 Remove mediaWiki and jQuery from eslint globals
Remove all mappings in the closures like in
I7cf2426cde597259e8c6f3f6f615a1a81a0ca82b in core.

Change-Id: Ie9a2fadb8e276774784a4937bb5c3ec11f213352
2018-09-15 17:54:03 +00:00

38 lines
851 B
JavaScript

( function () {
'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 = $( this.template.render() );
// 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 );
/**
* @property {Object} compiled template
*/
CardListView.prototype.template = mw.template.get( 'ext.relatedArticles.cards', 'cards.muhogan' );
mw.cards.CardListView = CardListView;
}() );