mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-12-25 14:23:44 +00:00
6dee0147f4
* Move across all files * Rename ext-card- prefix to ext-related-articles- prefix ** Since all code using these prefixes is JS we do not have to worry about cached HTML Bug: T137021 Change-Id: I784fd132c36329fa0dcc49fe2804460061940347
38 lines
880 B
JavaScript
38 lines
880 B
JavaScript
( function ( $, mw ) {
|
|
'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.
|
|
$.each( this.cardViews, function ( i, 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;
|
|
}( jQuery, mediaWiki ) );
|