PERF: don't render the category list if we are not showing it.
This commit is contained in:
parent
0621e87bcd
commit
7327dbc7cc
|
@ -57,6 +57,16 @@ export default Ember.Component.extend({
|
|||
|
||||
actions: {
|
||||
expand: function() {
|
||||
var self = this;
|
||||
|
||||
if(!this.get('renderCategories')){
|
||||
this.set('renderCategories',true);
|
||||
Em.run.next(function(){
|
||||
self.send('expand');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.get('expanded')) {
|
||||
this.close();
|
||||
return;
|
||||
|
@ -65,8 +75,7 @@ export default Ember.Component.extend({
|
|||
if (this.get('categories')) {
|
||||
this.set('expanded', true);
|
||||
}
|
||||
var self = this,
|
||||
$dropdown = this.$()[0];
|
||||
var $dropdown = this.$()[0];
|
||||
|
||||
this.$('a[data-drop-close]').on('click.category-drop', function() {
|
||||
self.close();
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
{{#if subCategory}}
|
||||
<div class='cat'><a {{bind-attr href=noCategoriesUrl}} data-drop-close="true" class='badge-category home'>{{i18n categories.no_subcategory}}</a></div>
|
||||
{{/if}}
|
||||
{{#if renderCategories}}
|
||||
{{#each categories}}<div class='cat'>{{category-link this allowUncategorized=true}}</div>{{/each}}
|
||||
{{/if}}
|
||||
</section>
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in New Issue