mirror of
https://github.com/flarum/framework.git
synced 2025-01-11 05:43:40 +08:00
8683025ef6
This means the component instance is created in the template, meaning properties can be overridden in the view helper. It also just makes more sense - a view instance doesn’t need to exist until it is rendered in the template.
22 lines
519 B
JavaScript
22 lines
519 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 [];
|
|
}
|
|
items.forEach(function(item) {
|
|
item.reopenClass({isListItem: item.proto().tagName === 'li'});
|
|
});
|
|
return items;
|
|
})
|
|
});
|