mirror of
https://github.com/flarum/core.git
synced 2025-08-02 14:37:49 +02:00
Initialize item-lists on init event; allow items to be hidden
This commit is contained in:
@@ -13,12 +13,12 @@ export default Ember.Component.extend({
|
|||||||
if (!Ember.isArray(items)) {
|
if (!Ember.isArray(items)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
var instances = [];
|
||||||
items.forEach(function(item) {
|
items.forEach(function(item) {
|
||||||
item.reopenClass({
|
item = item.create();
|
||||||
isListItem: item.proto().tagName === 'li',
|
item.set('isListItem', item.constructor.proto().tagName === 'li');
|
||||||
listItemClass: item.proto().listItemClass
|
instances.pushObject(item);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
return items;
|
return instances;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@@ -7,7 +7,7 @@ import SeparatorItem from 'flarum/components/ui/separator-item';
|
|||||||
export default Ember.Mixin.create({
|
export default Ember.Mixin.create({
|
||||||
itemLists: [],
|
itemLists: [],
|
||||||
|
|
||||||
initItemLists: Ember.on('didInsertElement', function() {
|
initItemLists: Ember.on('init', function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.get('itemLists').forEach(function(name) {
|
this.get('itemLists').forEach(function(name) {
|
||||||
self.initItemList(name);
|
self.initItemList(name);
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
{{#each item in listItems}}
|
{{#each item in listItems}}
|
||||||
{{#if item.isListItem}}
|
{{#unless item.isHiddenInList}}
|
||||||
{{view item}}
|
{{#if item.isListItem}}
|
||||||
{{else}}
|
{{view item}}
|
||||||
<li class="{{item.listItemClass}}">{{view item}}</li>
|
{{else}}
|
||||||
{{/if}}
|
<li class="{{item.listItemClass}}">{{view item}}</li>
|
||||||
|
{{/if}}
|
||||||
|
{{/unless}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@@ -54,12 +54,14 @@ export default Ember.View.extend(HasItemLists, {
|
|||||||
buttonClass: 'btn-primary',
|
buttonClass: 'btn-primary',
|
||||||
listItemClass: 'primary-control',
|
listItemClass: 'primary-control',
|
||||||
}), 'controls');
|
}), 'controls');
|
||||||
|
},
|
||||||
|
|
||||||
items.pushObjectWithTag(StreamScrubber.extend({
|
addStreamScrubber: Ember.on('didInsertElement', function() {
|
||||||
|
this.get('sidebar').pushObjectWithTag(StreamScrubber.extend({
|
||||||
streamContent: this.get('streamContent'),
|
streamContent: this.get('streamContent'),
|
||||||
listItemClass: 'title-control'
|
listItemClass: 'title-control'
|
||||||
}), 'scrubber');
|
}), 'scrubber');
|
||||||
},
|
}),
|
||||||
|
|
||||||
populateControls: function(items) {
|
populateControls: function(items) {
|
||||||
var view = this;
|
var view = this;
|
||||||
|
Reference in New Issue
Block a user