PERF: don't render the category list if we are not showing it.

This commit is contained in:
Sam 2014-10-29 17:17:32 +11:00
parent 0621e87bcd
commit 7327dbc7cc
2 changed files with 13 additions and 2 deletions

View File

@ -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();

View File

@ -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}}