mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 09:03:36 +08:00
25 lines
613 B
JavaScript
25 lines
613 B
JavaScript
import Ember from 'ember';
|
|
|
|
/**
|
|
Output a list of components within a <ul>, making sure each one is contained
|
|
in an <li> element.
|
|
*/
|
|
export default Ember.Component.extend({
|
|
layoutName: 'components/ui/item-list',
|
|
tagName: 'ul',
|
|
|
|
listItems: Ember.computed('items.[]', function() {
|
|
var items = this.get('items');
|
|
if (!Ember.isArray(items)) {
|
|
return [];
|
|
}
|
|
var instances = [];
|
|
items.forEach(function(item) {
|
|
item = item.create();
|
|
item.set('isListItem', item.constructor.proto().tagName === 'li');
|
|
instances.pushObject(item);
|
|
});
|
|
return instances;
|
|
})
|
|
});
|